fix logging issue for background execution

This commit is contained in:
otsmr 2026-04-05 21:50:31 +02:00
parent 337b9567c6
commit 6cc2ad3a65

View file

@ -49,7 +49,18 @@ void callbackDispatcher() {
});
}
bool _isInitialized = false;
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();
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
globalApplicationSupportDirectory =
@ -65,6 +76,7 @@ Future<bool> initBackgroundExecution() async {
apiService = ApiService();
globalIsInBackgroundTask = true;
_isInitialized = true;
return true;
}