diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index ae3ec6f90..2b620b52d 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -4631,6 +4631,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni { [secureBackupSetupCoordinatorBridgePresenter dismissWithAnimated:YES completion:nil]; secureBackupSetupCoordinatorBridgePresenter = nil; + + // BWI: #5706 fix alert triggering for new users + [self afterAppUnlockedByPin:[UIApplication sharedApplication]]; } - (void)secureBackupSetupCoordinatorBridgePresenterDelegateDidCancel:(SecureBackupSetupCoordinatorBridgePresenter *)coordinatorBridgePresenter diff --git a/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift b/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift index 7f92f15f6..2ff21d755 100644 --- a/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift +++ b/Riot/Modules/Home/AllChats/AllChatsCoordinator.swift @@ -767,7 +767,6 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { checkMaintenanceStatus() enableMaintenanceTimer(true) - self.bwiCheckForMatomoPromt() BWIAnalytics.sharedTracker.readUserConfig() if BWIBuildSettings.shared.bwiPersonalNotesRoom { @@ -775,7 +774,10 @@ class AllChatsCoordinator: NSObject, SplitViewMasterCoordinatorProtocol { } // bwi #4478: refresh wellknown a bit more often - self.currentMatrixSession?.refreshHomeserverWellknown(false, success: nil, failure: nil) + self.currentMatrixSession?.refreshHomeserverWellknown(false, success: { _ in + // bwi: #5706 fix crash: only show matomo alert when wellknown is available + self.bwiCheckForMatomoPromt() + }, failure: nil) } } @@ -800,7 +802,16 @@ extension AllChatsCoordinator: AllChatsViewControllerDelegate { func allChatsViewControllerDidCompleteAuthentication(_ allChatsViewController: AllChatsViewController) { self.delegate?.splitViewMasterCoordinatorDidCompleteAuthentication(self) - onBWIAppStart() + // BWI: #5706 fix alert triggering for new users. Only trigger onBWIAppStart when session has recovery set + guard let matrixSession = self.parameters.userSessionsService.mainUserSession?.matrixSession else { + return + } + guard let crypto = matrixSession.crypto else { + return + } + if crypto.recoveryService.hasRecovery() { + onBWIAppStart() + } } func allChatsViewController(_ allChatsViewController: AllChatsViewController, didSelectRoomWithParameters roomNavigationParameters: RoomNavigationParameters, completion: @escaping () -> Void) { diff --git a/Riot/Modules/Home/AllChats/AllChatsViewController.swift b/Riot/Modules/Home/AllChats/AllChatsViewController.swift index 1e0b8c109..e3d4189c4 100644 --- a/Riot/Modules/Home/AllChats/AllChatsViewController.swift +++ b/Riot/Modules/Home/AllChats/AllChatsViewController.swift @@ -325,6 +325,10 @@ class AllChatsViewController: HomeViewController { } func presentFederationIntroductionSheet() { + guard let mainSession = self.mainSession else { + return + } + guard BWIBuildSettings.shared.showFederationIntroduction else { return } @@ -333,7 +337,11 @@ class AllChatsViewController: HomeViewController { return } - guard self.mainSession.homeserverWellknown.shouldShowFederationIntroduction() else { + guard let homeserverWellknown = mainSession.homeserverWellknown else { + return + } + + guard homeserverWellknown.shouldShowFederationIntroduction() else { return } @@ -523,7 +531,15 @@ class AllChatsViewController: HomeViewController { // bwi: 5706 show federation announcement promt func bwiCheckForFederationAnnouncementPromt() { - guard self.mainSession.homeserverWellknown.shouldShowFederationAnnouncement() else { + guard let mainSession = self.mainSession else { + return + } + + guard let homeserverWellknown = mainSession.homeserverWellknown else { + return + } + + guard homeserverWellknown.shouldShowFederationAnnouncement() else { return }