mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor(mobile): move timeline methods to timeline repo (#16526)
* refactor: move timeline calls to timeline repo * refactor: review changes --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
3d6a6f77a8
commit
4db8f0c666
12 changed files with 64 additions and 61 deletions
|
|
@ -59,7 +59,11 @@ class AssetNotifier extends StateNotifier<bool> {
|
|||
await clearAllAssets();
|
||||
log.info("Manual refresh requested, cleared assets and albums from db");
|
||||
}
|
||||
final bool changedUsers = await _userService.refreshUsers();
|
||||
final users = await _userService.getUsersFromServer();
|
||||
bool changedUsers = false;
|
||||
if (users != null) {
|
||||
changedUsers = await _syncService.syncUsersFromServer(users);
|
||||
}
|
||||
final bool newRemote = await _assetService.refreshRemoteAssets();
|
||||
final bool newLocal = await _albumService.refreshDeviceAlbums();
|
||||
debugPrint(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import 'package:immich_mobile/entities/store.entity.dart';
|
|||
import 'package:immich_mobile/entities/user.entity.dart';
|
||||
import 'package:immich_mobile/providers/api.provider.dart';
|
||||
import 'package:immich_mobile/services/api.service.dart';
|
||||
import 'package:immich_mobile/services/user.service.dart';
|
||||
import 'package:immich_mobile/services/timeline.service.dart';
|
||||
|
||||
class CurrentUserProvider extends StateNotifier<User?> {
|
||||
CurrentUserProvider(this._apiService) : super(null) {
|
||||
|
|
@ -46,14 +46,15 @@ final currentUserProvider =
|
|||
});
|
||||
|
||||
class TimelineUserIdsProvider extends StateNotifier<List<int>> {
|
||||
TimelineUserIdsProvider(this._userService) : super([]) {
|
||||
_userService.getTimelineUserIds().then((users) => state = users);
|
||||
streamSub =
|
||||
_userService.watchTimelineUserIds().listen((users) => state = users);
|
||||
TimelineUserIdsProvider(this._timelineService) : super([]) {
|
||||
_timelineService.getTimelineUserIds().then((users) => state = users);
|
||||
streamSub = _timelineService
|
||||
.watchTimelineUserIds()
|
||||
.listen((users) => state = users);
|
||||
}
|
||||
|
||||
late final StreamSubscription<List<int>> streamSub;
|
||||
final UserService _userService;
|
||||
final TimelineService _timelineService;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
|
@ -64,5 +65,5 @@ class TimelineUserIdsProvider extends StateNotifier<List<int>> {
|
|||
|
||||
final timelineUsersIdsProvider =
|
||||
StateNotifierProvider<TimelineUserIdsProvider, List<int>>((ref) {
|
||||
return TimelineUserIdsProvider(ref.watch(userServiceProvider));
|
||||
return TimelineUserIdsProvider(ref.watch(timelineServiceProvider));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue