[mob] Add missing await

This commit is contained in:
Neeraj Gupta
2024-10-15 14:59:50 +05:30
parent 2e36ea788c
commit 5e401cc9a8

View File

@@ -145,7 +145,7 @@ Future<void> _runBackgroundTask(String taskId, {String mode = 'normal'}) async {
if (_isProcessRunning) {
_logger.info("Background task triggered when process was already running");
await _sync('bgTaskActiveProcess');
BackgroundFetch.finish(taskId);
await BackgroundFetch.finish(taskId);
} else {
_runWithLogs(
() async {
@@ -162,7 +162,7 @@ Future<void> _runInBackground(String taskId) async {
await Future.delayed(const Duration(seconds: 3));
if (await _isRunningInForeground()) {
_logger.info("FG task running, skipping BG taskID: $taskId");
BackgroundFetch.finish(taskId);
await BackgroundFetch.finish(taskId);
return;
} else {
_logger.info("FG task is not running");
@@ -182,7 +182,7 @@ Future<void> _runInBackground(String taskId) async {
}(),
],
);
BackgroundFetch.finish(taskId);
await BackgroundFetch.finish(taskId);
}
// https://stackoverflow.com/a/73796478/546896
@@ -428,7 +428,7 @@ Future<void> _killBGTask([String? taskId]) async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove(kLastBGTaskHeartBeatTime);
if (taskId != null) {
BackgroundFetch.finish(taskId);
await BackgroundFetch.finish(taskId);
}
}