diff --git a/mobile/lib/domain/utils/background_sync.dart b/mobile/lib/domain/utils/background_sync.dart index a3ff81981c..abe69f5fa5 100644 --- a/mobile/lib/domain/utils/background_sync.dart +++ b/mobile/lib/domain/utils/background_sync.dart @@ -128,7 +128,6 @@ class BackgroundSyncManager { }); } - // No need to cancel the task, as it can also be run when the user logs out Future hashAssets() { if (_hashTask != null) { return _hashTask!.future; diff --git a/mobile/lib/providers/app_life_cycle.provider.dart b/mobile/lib/providers/app_life_cycle.provider.dart index 3da653444c..8e50350d52 100644 --- a/mobile/lib/providers/app_life_cycle.provider.dart +++ b/mobile/lib/providers/app_life_cycle.provider.dart @@ -161,15 +161,6 @@ class AppLifeCycleNotifier extends StateNotifier { } } - // Check if app is still active before hashing - if (_shouldContinueOperation()) { - try { - await backgroundManager.hashAssets(); - } catch (e, stackTrace) { - _log.warning("Failed hashAssets: $e", e, stackTrace); - } - } - // Check if app is still active before remote sync if (_shouldContinueOperation()) { try { @@ -187,6 +178,15 @@ class AppLifeCycleNotifier extends StateNotifier { } } + // Check if app is still active before hashing + if (_shouldContinueOperation()) { + try { + await backgroundManager.hashAssets(); + } catch (e, stackTrace) { + _log.warning("Failed hashAssets: $e", e, stackTrace); + } + } + // Handle backup resume only if still active if (_shouldContinueOperation()) { final isEnableBackup = _ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.enableBackup);