feat: use sqlite timeline user provider (#19577)

use sqlite timeline user provider

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2025-06-27 18:59:27 +05:30 committed by GitHub
parent 30b4f334d8
commit 72a53f43c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import 'package:immich_mobile/infrastructure/repositories/timeline.repository.da
import 'package:immich_mobile/presentation/widgets/timeline/timeline.state.dart';
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
import 'package:immich_mobile/providers/infrastructure/setting.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
final timelineRepositoryProvider = Provider<DriftTimelineRepository>(
(ref) => DriftTimelineRepository(ref.watch(driftProvider)),
@ -25,3 +26,16 @@ final timelineFactoryProvider = Provider<TimelineFactory>(
settingsService: ref.watch(settingsProvider),
),
);
final timelineUsersProvider = StreamProvider<List<String>>(
(ref) {
final currentUserId = ref.watch(currentUserProvider.select((u) => u?.id));
if (currentUserId == null) {
return Stream.value([]);
}
return ref
.watch(timelineRepositoryProvider)
.watchTimelineUserIds(currentUserId);
},
);