mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-04-18 21:12:54 +00:00
fix logging issue for background execution
This commit is contained in:
parent
337b9567c6
commit
6cc2ad3a65
1 changed files with 12 additions and 0 deletions
|
|
@ -49,7 +49,18 @@ void callbackDispatcher() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _isInitialized = false;
|
||||||
|
|
||||||
Future<bool> initBackgroundExecution() async {
|
Future<bool> initBackgroundExecution() async {
|
||||||
|
if (_isInitialized) {
|
||||||
|
// Reload the users, as on Android the background isolate can
|
||||||
|
// stay alive for multiple hours between task executions
|
||||||
|
final user = await getUser();
|
||||||
|
if (user == null) return false;
|
||||||
|
gUser = user;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
SentryWidgetsFlutterBinding.ensureInitialized();
|
SentryWidgetsFlutterBinding.ensureInitialized();
|
||||||
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
|
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
|
||||||
globalApplicationSupportDirectory =
|
globalApplicationSupportDirectory =
|
||||||
|
|
@ -65,6 +76,7 @@ Future<bool> initBackgroundExecution() async {
|
||||||
apiService = ApiService();
|
apiService = ApiService();
|
||||||
globalIsInBackgroundTask = true;
|
globalIsInBackgroundTask = true;
|
||||||
|
|
||||||
|
_isInitialized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue