diff --git a/Config/BWIBuildSettings.swift b/Config/BWIBuildSettings.swift index 4f8aa8aa8..dc91a1047 100644 --- a/Config/BWIBuildSettings.swift +++ b/Config/BWIBuildSettings.swift @@ -241,7 +241,7 @@ class BWIBuildSettings: NSObject { var applicationWebAppUrlString = "" // Default servers proposed on the authentication screen - var serverConfigDefaultHomeserverUrlString = "" + var serverConfigDefaultHomeserverUrlString = "https://bundesmessenger.isthebest.real" var serverConfigDefaultIdentityServerUrlString = "" var serverConfigPreSelections = ["":""] var serverConfigSygnalAPIUrlString = "http://push-local/_matrix/push/v1/notify" @@ -460,6 +460,7 @@ class BWIBuildSettings: NSObject { var onboardingEnableNewAuthenticationFlow = true // show app specific welcoming screens var onboardingShowWelcomeScreens = true + var disableLegacyAuthentication = true // --- diff --git a/Riot/Generated/BWIStrings.swift b/Riot/Generated/BWIStrings.swift index 02780a29f..ff895dcad 100644 --- a/Riot/Generated/BWIStrings.swift +++ b/Riot/Generated/BWIStrings.swift @@ -1671,6 +1671,14 @@ public class BWIL10n: NSObject { public static var userAvatarViewAccessibilityLabel: String { return BWIL10n.tr("Bwi", "user_avatar_view_accessibility_label") } + /// Alle anzeigen (%d) + public static func userSessionButtonViewAll(_ p1: Int) -> String { + return BWIL10n.tr("Bwi", "user_session_button_view_all", p1) + } + /// Du hast deine Sitzung durch Eingabe des Wiederherstellungsschlüssels oder durch die Verifizierung mit einem anderen Gerät bestätigt. Dies bedeutet, dass du alle Schlüssel zum Entschlüsseln deiner Nachrichten hast und anderen bestätigst, dieser Sitzung zu vertrauen. + public static var userSessionVerifiedSessionDescription: String { + return BWIL10n.tr("Bwi", "user_session_verified_session_description") + } /// Ansehen public static var view: String { return BWIL10n.tr("Bwi", "view") diff --git a/Riot/Modules/Authentication/AuthenticationCoordinator.swift b/Riot/Modules/Authentication/AuthenticationCoordinator.swift index 3ce727c48..6f31a5415 100644 --- a/Riot/Modules/Authentication/AuthenticationCoordinator.swift +++ b/Riot/Modules/Authentication/AuthenticationCoordinator.swift @@ -142,7 +142,8 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc let flow: AuthenticationFlow = initialScreen == .login ? .login : .register // bwi: force serverselection on test apps - if BWIBuildSettings.shared.authScreenShowTestServerOptions && BWIBuildSettings.shared.bwiLoginFlowLayout { + if (BWIBuildSettings.shared.authScreenShowTestServerOptions && BWIBuildSettings.shared.bwiLoginFlowLayout) || + BWIBuildSettings.shared.bumLoginFlowLayout { showServerSelectionScreen(for: flow) } else { do { diff --git a/Riot/Modules/Onboarding/OnboardingCoordinator.swift b/Riot/Modules/Onboarding/OnboardingCoordinator.swift index 168e22154..2074b9456 100644 --- a/Riot/Modules/Onboarding/OnboardingCoordinator.swift +++ b/Riot/Modules/Onboarding/OnboardingCoordinator.swift @@ -45,8 +45,9 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { private var navigationRouter: NavigationRouterType { parameters.router } + // bwi: disable usage because of sideeffects when starting the app without serverurls (#4646) /// A strong ref to the legacy authVC as we need to init early to preload its view. - private let legacyAuthenticationCoordinator: LegacyAuthenticationCoordinator + private var legacyAuthenticationCoordinator: LegacyAuthenticationCoordinator? /// The currently active authentication coordinator, otherwise `nil`. private weak var authenticationCoordinator: AuthenticationCoordinatorProtocol? @@ -84,11 +85,13 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { init(parameters: OnboardingCoordinatorParameters) { self.parameters = parameters - // Preload the legacy authVC (it is *really* slow to load in realtime) - let params = LegacyAuthenticationCoordinatorParameters(navigationRouter: parameters.router, - canPresentAdditionalScreens: false) - legacyAuthenticationCoordinator = LegacyAuthenticationCoordinator(parameters: params) - + if !BWIBuildSettings.shared.disableLegacyAuthentication { + // Preload the legacy authVC (it is *really* slow to load in realtime) + let params = LegacyAuthenticationCoordinatorParameters(navigationRouter: parameters.router, + canPresentAdditionalScreens: false) + legacyAuthenticationCoordinator = LegacyAuthenticationCoordinator(parameters: params) + } + indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: parameters.router.toPresentable()) super.init() @@ -211,8 +214,10 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { private func splashScreenCoordinator(_ coordinator: OnboardingSplashScreenCoordinator, didCompleteWith result: OnboardingSplashScreenViewModelResult) { splashScreenResult = result - // Set the auth type early on the legacy auth to allow network requests to finish during display of the use case screen. - legacyAuthenticationCoordinator.update(authenticationFlow: result.flow) + if !BWIBuildSettings.shared.disableLegacyAuthentication { + // Set the auth type early on the legacy auth to allow network requests to finish during display of the use case screen. + legacyAuthenticationCoordinator?.update(authenticationFlow: result.flow) + } switch result { case .register: @@ -299,37 +304,42 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol { /// Show the legacy authentication screen. Any parameters that have been set in previous screens are be applied. /// - Parameter forceAsRootModule: Force setting the module as root instead of pushing private func showLegacyAuthenticationScreen(forceAsRootModule: Bool = false) { - MXLog.debug("[OnboardingCoordinator] showLegacyAuthenticationScreen") - - let coordinator = legacyAuthenticationCoordinator - coordinator.callback = { [weak self, weak coordinator] result in - guard let self = self, let coordinator = coordinator else { return } + if !BWIBuildSettings.shared.disableLegacyAuthentication { + MXLog.debug("[OnboardingCoordinator] showLegacyAuthenticationScreen") - switch result { - case .didLogin(let session, let authenticationFlow, let authenticationType): - self.authenticationCoordinator(coordinator, didLoginWith: session, and: authenticationFlow, using: authenticationType) - case .didComplete: - self.authenticationCoordinatorDidComplete(coordinator) - case .clearAllData: - self.showClearAllDataConfirmation() - case .didStart, .cancel: - // These results are only sent by the new flow. - break + guard let coordinator = legacyAuthenticationCoordinator else { + return } - } - authenticationCoordinator = coordinator - - coordinator.start() - add(childCoordinator: coordinator) + coordinator.callback = { [weak self, weak coordinator] result in + guard let self = self, let coordinator = coordinator else { return } + + switch result { + case .didLogin(let session, let authenticationFlow, let authenticationType): + self.authenticationCoordinator(coordinator, didLoginWith: session, and: authenticationFlow, using: authenticationType) + case .didComplete: + self.authenticationCoordinatorDidComplete(coordinator) + case .clearAllData: + self.showClearAllDataConfirmation() + case .didStart, .cancel: + // These results are only sent by the new flow. + break + } + } + authenticationCoordinator = coordinator + + coordinator.start() + add(childCoordinator: coordinator) - if navigationRouter.modules.isEmpty || forceAsRootModule || BWIBuildSettings.shared.showBUMLottieAnimation { - navigationRouter.setRootModule(coordinator, popCompletion: nil) - } else { - navigationRouter.push(coordinator, animated: true) { [weak self] in - self?.remove(childCoordinator: coordinator) + if navigationRouter.modules.isEmpty || forceAsRootModule || BWIBuildSettings.shared.showBUMLottieAnimation { + navigationRouter.setRootModule(coordinator, popCompletion: nil) + } else { + navigationRouter.push(coordinator, animated: true) { [weak self] in + self?.remove(childCoordinator: coordinator) + } } + stopLoading() } - stopLoading() + } /// Cancels the registration flow, returning to the Use Case screen. diff --git a/Riot/target-messenger.yml b/Riot/target-messenger.yml index e12959cef..8b53a33c5 100644 --- a/Riot/target-messenger.yml +++ b/Riot/target-messenger.yml @@ -88,6 +88,7 @@ targets: - path: ../bwi excludes: - "Tests" + - "ServerURLs/serverurls.json" - path: ../RiotShareExtension/Shared - path: Modules/MatrixKit excludes: diff --git a/bwi/ServerURLs/ServerURLHelper.swift b/bwi/ServerURLs/ServerURLHelper.swift index 026db48f5..7f533b7ea 100644 --- a/bwi/ServerURLs/ServerURLHelper.swift +++ b/bwi/ServerURLs/ServerURLHelper.swift @@ -32,7 +32,11 @@ import Foundation var selectedIndex: Int { get { - return UserDefaults.standard.integer(forKey: "Bwi_Server_Url_Helper_Index") + if UserDefaults.standard.object(forKey: "Bwi_Server_Url_Helper_Index") != nil { + return UserDefaults.standard.integer(forKey: "Bwi_Server_Url_Helper_Index") + } else { + return -1 + } } set(newSelectedIndex) { UserDefaults.standard.set(newSelectedIndex, forKey: "Bwi_Server_Url_Helper_Index")