diff --git a/mobile/lib/providers/background_sync.provider.dart b/mobile/lib/providers/background_sync.provider.dart index 37b3145eb4..ce8991f45b 100644 --- a/mobile/lib/providers/background_sync.provider.dart +++ b/mobile/lib/providers/background_sync.provider.dart @@ -1,10 +1,13 @@ +import 'package:drift/drift.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/domain/utils/background_sync.dart'; import 'package:immich_mobile/providers/backup/drift_backup.provider.dart'; +import 'package:immich_mobile/providers/infrastructure/db.provider.dart'; import 'package:immich_mobile/providers/sync_status.provider.dart'; final backgroundSyncProvider = Provider((ref) { final syncStatusNotifier = ref.read(syncStatusProvider.notifier); + final db = ref.read(driftProvider); final manager = BackgroundSyncManager( onRemoteSyncStart: () { @@ -20,10 +23,14 @@ final backgroundSyncProvider = Provider((ref) { if (backupProvider.mounted) { backupProvider.updateError(isSuccess == true ? BackupError.none : BackupError.syncFailed); } + db.notifyUpdates({TableUpdate.onTable(db.remoteAssetEntity, kind: UpdateKind.update)}); }, onRemoteSyncError: syncStatusNotifier.errorRemoteSync, onLocalSyncStart: syncStatusNotifier.startLocalSync, - onLocalSyncComplete: syncStatusNotifier.completeLocalSync, + onLocalSyncComplete: () { + syncStatusNotifier.completeLocalSync(); + db.notifyUpdates({TableUpdate.onTable(db.localAssetEntity, kind: UpdateKind.update)}); + }, onLocalSyncError: syncStatusNotifier.errorLocalSync, onHashingStart: syncStatusNotifier.startHashJob, onHashingComplete: syncStatusNotifier.completeHashJob,