From a3971543b58208194d01c692386e444fcd2bf27a Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 1 Dec 2022 09:20:53 -0600 Subject: [PATCH] fix(mobile): Start up from splash screen does not trigger foreground backup (#1042) --- mobile/android/fastlane/report.xml | 6 +++--- mobile/ios/Runner.xcodeproj/project.pbxproj | 6 +++--- mobile/ios/Runner/Info.plist | 4 ++-- mobile/ios/fastlane/report.xml | 12 +++++------ .../backup/providers/backup.provider.dart | 21 +++++++------------ 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/mobile/android/fastlane/report.xml b/mobile/android/fastlane/report.xml index da68f11b20..52da1b7299 100644 --- a/mobile/android/fastlane/report.xml +++ b/mobile/android/fastlane/report.xml @@ -5,17 +5,17 @@ - + - + - + diff --git a/mobile/ios/Runner.xcodeproj/project.pbxproj b/mobile/ios/Runner.xcodeproj/project.pbxproj index d546a2daed..95c7de92f2 100644 --- a/mobile/ios/Runner.xcodeproj/project.pbxproj +++ b/mobile/ios/Runner.xcodeproj/project.pbxproj @@ -360,7 +360,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 72; + CURRENT_PROJECT_VERSION = 73; DEVELOPMENT_TEAM = 2F67MQ8R79; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -495,7 +495,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 72; + CURRENT_PROJECT_VERSION = 73; DEVELOPMENT_TEAM = 2F67MQ8R79; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -522,7 +522,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 72; + CURRENT_PROJECT_VERSION = 73; DEVELOPMENT_TEAM = 2F67MQ8R79; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; diff --git a/mobile/ios/Runner/Info.plist b/mobile/ios/Runner/Info.plist index cacb14f32a..73f4b0779e 100644 --- a/mobile/ios/Runner/Info.plist +++ b/mobile/ios/Runner/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.36.1 + 1.37.0 CFBundleSignature ???? CFBundleVersion - 72 + 73 LSRequiresIPhoneOS MGLMapboxMetricsEnabledSettingShownInApp diff --git a/mobile/ios/fastlane/report.xml b/mobile/ios/fastlane/report.xml index aadffa85f3..c40a2fb5fe 100644 --- a/mobile/ios/fastlane/report.xml +++ b/mobile/ios/fastlane/report.xml @@ -5,32 +5,32 @@ - + - + - + - + - + - + diff --git a/mobile/lib/modules/backup/providers/backup.provider.dart b/mobile/lib/modules/backup/providers/backup.provider.dart index 0b3a61cc4c..aabad64c1e 100644 --- a/mobile/lib/modules/backup/providers/backup.provider.dart +++ b/mobile/lib/modules/backup/providers/backup.provider.dart @@ -69,7 +69,6 @@ class BackupNotifier extends StateNotifier { final AuthenticationState _authState; final BackgroundService _backgroundService; final Ref ref; - var isGettingBackupInfo = false; /// /// UI INTERACTION @@ -375,20 +374,14 @@ class BackupNotifier extends StateNotifier { /// which albums are selected or excluded /// and then update the UI according to those information Future 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 { /// Invoke backup process Future 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 { } Set 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);