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
This commit is contained in:
Zack Pollard 2025-08-04 22:41:44 +01:00 committed by GitHub
parent 10141504a2
commit 278668b8c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,11 +86,12 @@ class AppLifeCycleNotifier extends StateNotifier<AppLifeCycleEnum> {
// 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(),