Trigger sync when a background push is received

This commit is contained in:
vishnukvmd 2021-10-28 12:41:38 +05:30
parent 3ebc0a085b
commit 02c56e852f

View file

@ -317,13 +317,12 @@ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
_scheduleSuicide(kBGPushTimeout); // To prevent OS from punishing us
}
await _init(true);
UpdateService.instance.showUpdateNotification();
await _sync(isAppInBackground: true);
}, prefix: "[bg]");
} else {
_logger
.info("Background push received, but app is already in the foreground");
// App has already been initialized, will let foreground handle everything
.info("Background push received when app is alive");
await _sync(isAppInBackground: true);
}
}