From 17892119aeb2a007520192f2e56f24f33c94a053 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sat, 4 Nov 2023 21:21:06 +0100 Subject: [PATCH] Revert "refactor: Do not init client in background mode on Android" This reverts commit 3cea32e1c8022506759320feb7fd5c347ed85ab7. --- lib/main.dart | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 26f0e61a..c3dd3466 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,19 +21,15 @@ void main() async { // widget bindings are initialized already. WidgetsFlutterBinding.ensureInitialized(); - final backgroundMode = PlatformInfos.isAndroid && - AppLifecycleState.detached == WidgetsBinding.instance.lifecycleState; Logs().nativeColors = !PlatformInfos.isIOS; final store = await SharedPreferences.getInstance(); - final clients = await ClientManager.getClients( - store: store, - initialize: !backgroundMode, - ); + final clients = await ClientManager.getClients(store: store); // If the app starts in detached mode, we assume that it is in // background fetch mode for processing push notifications. This is // currently only supported on Android. - if (backgroundMode) { + if (PlatformInfos.isAndroid && + AppLifecycleState.detached == WidgetsBinding.instance.lifecycleState) { // In the background fetch mode we do not want to waste ressources with // starting the Flutter engine but process incoming push notifications. BackgroundPush.clientOnly(clients.first);