Add Supa account and search changes

This commit is contained in:
Fabian Freund
2026-05-22 18:10:22 +02:00
parent 3a19865b2e
commit 51289f1266
374 changed files with 54061 additions and 5013 deletions
@@ -21,6 +21,7 @@ import 'package:exceptions/exceptions.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:weblibre/features/bangs/data/database/database.dart';
import 'package:weblibre/features/bangs/data/models/bang_group.dart';
import 'package:weblibre/features/bangs/data/models/web_search_bang.dart';
import 'package:weblibre/features/bangs/data/providers.dart';
import 'package:weblibre/features/bangs/data/services/data_source.dart';
@@ -170,6 +171,21 @@ class BangSyncRepository extends _$BangSyncRepository {
.watchSingleOrNull();
}
Future<Result<void>> _syncSyntheticBangs() async {
try {
await ref.read(bangDatabaseProvider).bangDao.upsertBang(webSearchBang);
return Result.success(null);
} catch (e) {
return Result.failure(
ErrorMessage(
message: 'Failed to sync synthetic Bangs',
source: 'BangSync',
details: e,
),
);
}
}
Future<Map<BangGroup, Result<void>>> syncBundledBangGroups({
Set<BangGroup>? groups,
}) async {
@@ -183,7 +199,10 @@ class BangSyncRepository extends _$BangSyncRepository {
).then((result) => MapEntry(source, result)),
);
return Map.fromEntries(await Future.wait(futures));
return {
...Map.fromEntries(await Future.wait(futures)),
BangGroup.weblibre: await _syncSyntheticBangs(),
};
}
@override