mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(mobile): store backup settings on device (#2054)
Co-authored-by: Fynn Petersen-Frey <zoodyy@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
32a065afc7
commit
40832f0ea7
9 changed files with 26 additions and 105 deletions
|
|
@ -39,6 +39,7 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||
allAssetsInDatabase: const [],
|
||||
progressInPercentage: 0,
|
||||
cancelToken: CancellationToken(),
|
||||
autoBackup: Store.get(StoreKey.autoBackup, false),
|
||||
backgroundBackup: false,
|
||||
backupRequireWifi: Store.get(StoreKey.backupRequireWifi, true),
|
||||
backupRequireCharging:
|
||||
|
|
@ -121,6 +122,11 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||
_updateBackupAssetCount();
|
||||
}
|
||||
|
||||
void setAutoBackup(bool enabled) {
|
||||
Store.put(StoreKey.autoBackup, enabled);
|
||||
state = state.copyWith(autoBackup: enabled);
|
||||
}
|
||||
|
||||
void configureBackgroundBackup({
|
||||
bool? enabled,
|
||||
bool? requireWifi,
|
||||
|
|
@ -550,8 +556,7 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||
}
|
||||
|
||||
// Check if this device is enable backup by the user
|
||||
if ((_authState.deviceInfo.deviceId == _authState.deviceId) &&
|
||||
_authState.deviceInfo.isAutoBackup) {
|
||||
if (state.autoBackup) {
|
||||
// check if backup is alreayd in process - then return
|
||||
if (state.backupProgress == BackUpProgressEnum.inProgress) {
|
||||
log.info("[_resumeBackup] Backup is already in progress - abort");
|
||||
|
|
@ -567,7 +572,6 @@ class BackupNotifier extends StateNotifier<BackUpState> {
|
|||
log.info("[_resumeBackup] Start back up");
|
||||
await startBackupProcess();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue