diff --git a/lib/pages/chat_list/chat_list.dart b/lib/pages/chat_list/chat_list.dart index 8f5515fc4..ec34a5b81 100644 --- a/lib/pages/chat_list/chat_list.dart +++ b/lib/pages/chat_list/chat_list.dart @@ -911,11 +911,12 @@ class ChatListController extends State await client.roomsLoading; await client.accountDataLoading; await client.userDeviceKeysLoading; - if (client.prevBatch == null) { + // #Pangea + // See here for explanation of this change: https://github.com/pangeachat/client/pull/539 + // if (client.prevBatch == null) { + if (client.onSync.value?.nextBatch == null) { + // Pangea# await client.onSync.stream.first; - // #Pangea - pangeaController.startChatWithBotIfNotPresent(); - //Pangea# // Display first login bootstrap if enabled // #Pangea @@ -930,9 +931,19 @@ class ChatListController extends State } // #Pangea + await _initPangeaControllers(client); + // Pangea# + if (!mounted) return; + setState(() { + waitForFirstSync = true; + }); + } + + // #Pangea + Future _initPangeaControllers(Client client) async { if (mounted) { - // TODO try not to await so much GoogleAnalytics.analyticsUserUpdate(client.userID); + pangeaController.startChatWithBotIfNotPresent(); await pangeaController.subscriptionController.initialize(); await pangeaController.myAnalytics.initialize(); pangeaController.afterSyncAndFirstLoginInitialization(context); @@ -943,14 +954,9 @@ class ChatListController extends State ErrorHandler.logError( m: "didn't run afterSyncAndFirstLoginInitialization because not mounted", ); - // debugger(when: kDebugMode); } - // Pangea# - if (!mounted) return; - setState(() { - waitForFirstSync = true; - }); } + // Pangea# void cancelAction() { if (selectMode == SelectMode.share) {