mirror of
https://github.com/immich-app/immich.git
synced 2026-01-16 23:11:47 -08:00
* use adjustment time in iOS for hash reset # Conflicts: # mobile/lib/infrastructure/repositories/local_album.repository.dart # mobile/lib/presentation/pages/drift_asset_troubleshoot.page.dart * migration * feat: sync cloudId and eTag on sync * fixes fixes * more fixes * re-sync updated eTags * add server version check & auto sync cloud ids on compatible servers * fix test * remove button from sync status page * chore: modify for testing * more changes * chore: add commas in toString * use cached provider in splash screen * read upload service provider to prevent reset * log errors from fetching cloud id mapping * WIP: migrate cloud id - debug log * ignore locked asset update * bulk update metadata * change log text --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
38 lines
1.6 KiB
Dart
38 lines
1.6 KiB
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/sync_status.provider.dart';
|
|
|
|
final backgroundSyncProvider = Provider<BackgroundSyncManager>((ref) {
|
|
final syncStatusNotifier = ref.read(syncStatusProvider.notifier);
|
|
|
|
final manager = BackgroundSyncManager(
|
|
onRemoteSyncStart: () {
|
|
syncStatusNotifier.startRemoteSync();
|
|
final backupProvider = ref.read(driftBackupProvider.notifier);
|
|
if (backupProvider.mounted) {
|
|
backupProvider.updateError(BackupError.none);
|
|
}
|
|
},
|
|
onRemoteSyncComplete: (isSuccess) {
|
|
syncStatusNotifier.completeRemoteSync();
|
|
final backupProvider = ref.read(driftBackupProvider.notifier);
|
|
if (backupProvider.mounted) {
|
|
backupProvider.updateError(isSuccess == true ? BackupError.none : BackupError.syncFailed);
|
|
}
|
|
},
|
|
onRemoteSyncError: syncStatusNotifier.errorRemoteSync,
|
|
onLocalSyncStart: syncStatusNotifier.startLocalSync,
|
|
onLocalSyncComplete: syncStatusNotifier.completeLocalSync,
|
|
onLocalSyncError: syncStatusNotifier.errorLocalSync,
|
|
onHashingStart: syncStatusNotifier.startHashJob,
|
|
onHashingComplete: syncStatusNotifier.completeHashJob,
|
|
onHashingError: syncStatusNotifier.errorHashJob,
|
|
onCloudIdSyncStart: syncStatusNotifier.startCloudIdSync,
|
|
onCloudIdSyncComplete: syncStatusNotifier.completeCloudIdSync,
|
|
onCloudIdSyncError: syncStatusNotifier.errorCloudIdSync,
|
|
);
|
|
ref.onDispose(manager.cancel);
|
|
return manager;
|
|
});
|