mainly refactoring & addons
This commit is contained in:
@@ -2,31 +2,32 @@ import 'package:lensai/features/bangs/data/models/bang.dart';
|
||||
import 'package:lensai/features/bangs/data/models/bang_data.dart';
|
||||
import 'package:lensai/features/bangs/domain/repositories/data.dart';
|
||||
import 'package:lensai/features/bangs/domain/repositories/sync.dart';
|
||||
import 'package:riverpod/riverpod.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'providers.g.dart';
|
||||
|
||||
@Riverpod()
|
||||
Stream<BangData?> bangData(BangDataRef ref, String? trigger) {
|
||||
Stream<BangData?> bangData(Ref ref, String? trigger) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
return repository.watchBang(trigger);
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
Stream<BangData?> kagiSearchBangData(KagiSearchBangDataRef ref) {
|
||||
Stream<BangData?> kagiSearchBangData(Ref ref) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
return repository.watchBang('kagi');
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Stream<Map<String, List<String>>> bangCategories(BangCategoriesRef ref) {
|
||||
Stream<Map<String, List<String>>> bangCategories(Ref ref) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
return repository.watchCategories();
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Stream<List<BangData>> bangDataList(
|
||||
BangDataListRef ref, {
|
||||
Ref ref, {
|
||||
({
|
||||
Iterable<BangGroup>? groups,
|
||||
String? domain,
|
||||
@@ -44,14 +45,14 @@ Stream<List<BangData>> bangDataList(
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Stream<List<BangData>> frequentBangDataList(FrequentBangDataListRef ref) {
|
||||
Stream<List<BangData>> frequentBangDataList(Ref ref) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
return repository.watchFrequentBangs();
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Future<BangData> bangDataEnsureIcon(
|
||||
BangDataEnsureIconRef ref,
|
||||
Ref ref,
|
||||
BangData bang,
|
||||
) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
@@ -62,7 +63,7 @@ Future<BangData> bangDataEnsureIcon(
|
||||
|
||||
@Riverpod()
|
||||
Stream<DateTime?> lastSyncOfGroup(
|
||||
LastSyncOfGroupRef ref,
|
||||
Ref ref,
|
||||
BangGroup group,
|
||||
) {
|
||||
final repository = ref.watch(bangSyncRepositoryProvider.notifier);
|
||||
@@ -71,7 +72,7 @@ Stream<DateTime?> lastSyncOfGroup(
|
||||
|
||||
@Riverpod()
|
||||
Stream<int> bangCountOfGroup(
|
||||
BangCountOfGroupRef ref,
|
||||
Ref ref,
|
||||
BangGroup group,
|
||||
) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
@@ -79,7 +80,7 @@ Stream<int> bangCountOfGroup(
|
||||
}
|
||||
|
||||
@Riverpod()
|
||||
Stream<double> bangIconCacheSizeMegabytes(BangIconCacheSizeMegabytesRef ref) {
|
||||
Stream<double> bangIconCacheSizeMegabytes(Ref ref) {
|
||||
final repository = ref.watch(bangDataRepositoryProvider.notifier);
|
||||
return repository.watchIconCacheSize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user