From 68000c21a8bfc93dc81903982256cdd17c515468 Mon Sep 17 00:00:00 2001 From: Fynn Petersen-Frey <10599762+fyfrey@users.noreply.github.com> Date: Sun, 5 Nov 2023 17:07:57 +0100 Subject: [PATCH] fix(mobile): backup indicator wrong when only background backup is enabled (#4842) Co-authored-by: Fynn Petersen-Frey --- mobile/lib/modules/backup/providers/backup.provider.dart | 6 +++++- mobile/lib/shared/models/store.dart | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mobile/lib/modules/backup/providers/backup.provider.dart b/mobile/lib/modules/backup/providers/backup.provider.dart index 673991c5d..0df8bc90d 100644 --- a/mobile/lib/modules/backup/providers/backup.provider.dart +++ b/mobile/lib/modules/backup/providers/backup.provider.dart @@ -40,7 +40,7 @@ class BackupNotifier extends StateNotifier { progressInPercentage: 0, cancelToken: CancellationToken(), autoBackup: Store.get(StoreKey.autoBackup, false), - backgroundBackup: false, + backgroundBackup: Store.get(StoreKey.backgroundBackup, false), backupRequireWifi: Store.get(StoreKey.backupRequireWifi, true), backupRequireCharging: Store.get(StoreKey.backupRequireCharging, false), @@ -171,6 +171,7 @@ class BackupNotifier extends StateNotifier { state.backupRequireCharging, ); await Store.put(StoreKey.backupTriggerDelay, state.backupTriggerDelay); + await Store.put(StoreKey.backgroundBackup, state.backgroundBackup); } else { state = state.copyWith( backgroundBackup: wasEnabled, @@ -383,6 +384,9 @@ class BackupNotifier extends StateNotifier { final isEnabled = await _backgroundService.isBackgroundBackupEnabled(); state = state.copyWith(backgroundBackup: isEnabled); + if (isEnabled != Store.get(StoreKey.backgroundBackup, !isEnabled)) { + Store.put(StoreKey.backgroundBackup, isEnabled); + } if (state.backupProgress != BackUpProgressEnum.inBackground) { await _getBackupAlbumsInfo(); diff --git a/mobile/lib/shared/models/store.dart b/mobile/lib/shared/models/store.dart index 8f24899f1..40258f304 100644 --- a/mobile/lib/shared/models/store.dart +++ b/mobile/lib/shared/models/store.dart @@ -156,6 +156,7 @@ enum StoreKey { accessToken(11, type: String), serverEndpoint(12, type: String), autoBackup(13, type: bool), + backgroundBackup(14, type: bool), // user settings from [AppSettingsEnum] below: loadPreview(100, type: bool), loadOriginal(101, type: bool),