From 278668b8c5c9698a38eccc17b37e7d0a0f7e2fc9 Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Mon, 4 Aug 2025 22:41:44 +0100 Subject: [PATCH] fix: improvements to sync and upload when resuming app (#20524) - App will now kick off hashing after local sync if the lifecycle is in resumed or active state - We now wait for hashing to complete before we kick off the upload process --- mobile/lib/providers/app_life_cycle.provider.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mobile/lib/providers/app_life_cycle.provider.dart b/mobile/lib/providers/app_life_cycle.provider.dart index 31342bf23e..0696a8d7f1 100644 --- a/mobile/lib/providers/app_life_cycle.provider.dart +++ b/mobile/lib/providers/app_life_cycle.provider.dart @@ -86,11 +86,12 @@ class AppLifeCycleNotifier extends StateNotifier { // Ensure proper cleanup before starting new background tasks try { await Future.wait([ - backgroundManager.syncLocal().then((_) { + Future(() async { + await backgroundManager.syncLocal(); Logger("AppLifeCycleNotifier").fine("Hashing assets after syncLocal"); // Check if app is still active before hashing - if (state == AppLifeCycleEnum.resumed) { - backgroundManager.hashAssets(); + if ([AppLifeCycleEnum.resumed, AppLifeCycleEnum.active].contains(state)) { + await backgroundManager.hashAssets(); } }), backgroundManager.syncRemote(),