From 6616314d779c68aaacb9b2736a90a96842c6cb3b Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Fri, 30 Dec 2022 13:09:21 +0100 Subject: [PATCH] fix: Hide google services warning after marked --- lib/pages/chat_list/chat_list.dart | 6 ++++-- lib/utils/background_push.dart | 13 +------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index fe09469b..cc3ebd33 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -362,11 +362,13 @@ class ChatListController extends State _hackyWebRTCFixForWeb(); CallKeepManager().initialize(); WidgetsBinding.instance.addPostFrameCallback((_) async { - searchServer = await Store().getItem(_serverStoreNamespace); + if (mounted) { + searchServer = await Store().getItem(_serverStoreNamespace); + Matrix.of(context).backgroundPush?.setupPush(); + } }); _checkTorBrowser(); - Matrix.of(context).backgroundPush?.setupPush(); _onSyncStatus = Matrix.of(context).client.onSyncStatus.stream.listen((status) { Logs().v('Sync Status: ${status.status.name}'); diff --git a/lib/utils/background_push.dart b/lib/utils/background_push.dart index 18db4caf..2f8fdc36 100644 --- a/lib/utils/background_push.dart +++ b/lib/utils/background_push.dart @@ -84,7 +84,6 @@ class BackgroundPush { activeRoomId: router?.currentState?.pathParameters['roomid'], onSelectNotification: goToRoom, ), - onNewToken: _newFcmToken, ); if (Platform.isAndroid) { UnifiedPush.initialize( @@ -113,21 +112,11 @@ class BackgroundPush { instance.router = router; // ignore: prefer_initializing_formals instance.onFcmError = onFcmError; - instance.fullInit(); return instance; } - Future fullInit() => setupPush(); - - void handleLoginStateChanged(_) => setupPush(); - StreamSubscription? onRoomSync; - void _newFcmToken(String token) { - _fcmToken = token; - setupPush(); - } - Future setupPusher({ String? gatewayUrl, String? token, @@ -255,7 +244,7 @@ class BackgroundPush { if (context == null) { return; } - if (await store.getItemBool(SettingKeys.showNoGoogle, true) != true) { + if (await store.getItemBool(SettingKeys.showNoGoogle, true) == true) { return; } await loadLocale();