fix(mobile): Start up from splash screen does not trigger foreground backup (#1042)

This commit is contained in:
Alex
2022-12-01 09:20:53 -06:00
committed by GitHub
parent a384798779
commit a3971543b5
5 changed files with 21 additions and 28 deletions

View File

@@ -69,7 +69,6 @@ class BackupNotifier extends StateNotifier<BackUpState> {
final AuthenticationState _authState;
final BackgroundService _backgroundService;
final Ref ref;
var isGettingBackupInfo = false;
///
/// UI INTERACTION
@@ -375,20 +374,14 @@ class BackupNotifier extends StateNotifier<BackUpState> {
/// which albums are selected or excluded
/// and then update the UI according to those information
Future<void> getBackupInfo() async {
if (!isGettingBackupInfo) {
isGettingBackupInfo = true;
var isEnabled = await _backgroundService.isBackgroundBackupEnabled();
var isEnabled = await _backgroundService.isBackgroundBackupEnabled();
state = state.copyWith(backgroundBackup: isEnabled);
state = state.copyWith(backgroundBackup: isEnabled);
if (state.backupProgress != BackUpProgressEnum.inBackground) {
await _getBackupAlbumsInfo();
await _updateServerInfo();
await _updateBackupAssetCount();
}
isGettingBackupInfo = false;
if (state.backupProgress != BackUpProgressEnum.inBackground) {
await _getBackupAlbumsInfo();
await _updateServerInfo();
await _updateBackupAssetCount();
}
}
@@ -415,6 +408,7 @@ class BackupNotifier extends StateNotifier<BackUpState> {
/// Invoke backup process
Future<void> startBackupProcess() async {
debugPrint("Start backup process");
assert(state.backupProgress == BackUpProgressEnum.idle);
state = state.copyWith(backupProgress: BackUpProgressEnum.inProgress);
@@ -431,7 +425,6 @@ class BackupNotifier extends StateNotifier<BackUpState> {
}
Set<AssetEntity> assetsWillBeBackup = Set.from(state.allUniqueAssets);
// Remove item that has already been backed up
for (var assetId in state.allAssetsInDatabase) {
assetsWillBeBackup.removeWhere((e) => e.id == assetId);