Add Supa account and search changes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user