Merge branch 'feature/4231_add_new_loginflow' into 'develop'

MESSENGER-4231 add new loginflow

See merge request bwmessenger/bundesmessenger/bundesmessenger-ios!98
This commit is contained in:
Arnfried Griesert
2023-03-02 13:09:34 +00:00
12 changed files with 182 additions and 36 deletions
@@ -130,27 +130,33 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
}
let flow: AuthenticationFlow = initialScreen == .login ? .login : .register
do {
// Start the flow using the default server (or a provisioning link if set).
try await authenticationService.startFlow(flow)
} catch {
MXLog.error("[AuthenticationCoordinator] start: Failed to start, showing server selection.")
// bwi: force serverselection on test apps
if BWIBuildSettings.shared.authScreenShowTestServerOptions && BWIBuildSettings.shared.bwiLoginFlowLayout {
showServerSelectionScreen(for: flow)
return
}
switch initialScreen {
case .registration:
if authenticationService.state.homeserver.needsRegistrationFallback {
showFallback(for: flow)
} else {
showRegistrationScreen()
} else {
do {
// Start the flow using the default server (or a provisioning link if set).
try await authenticationService.startFlow(flow)
} catch {
MXLog.error("[AuthenticationCoordinator] start: Failed to start, showing server selection.")
showServerSelectionScreen(for: flow)
return
}
case .login:
if authenticationService.state.homeserver.needsLoginFallback {
showFallback(for: flow)
} else {
showLoginScreen()
switch initialScreen {
case .registration:
if authenticationService.state.homeserver.needsRegistrationFallback {
showFallback(for: flow)
} else {
showRegistrationScreen()
}
case .login:
if authenticationService.state.homeserver.needsLoginFallback {
showFallback(for: flow)
} else {
showLoginScreen()
}
}
}
}
@@ -161,8 +161,13 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
/// Displays the next view in the flow after the splash screen.
private func bwiSplashScreenCoordinator(_ coordinator: OnboardingBwiSplashScreenCoordinator, didCompleteWith result: OnboardingBwiSplashScreenViewModelResult) {
if BWIBuildSettings.shared.onboardingEnableNewAuthenticationFlow {
self.showWelcomeExperience()
if BWIBuildSettings.shared.onboardingEnableNewAuthenticationFlow {
// bwi: show app specific welcoming screens if enabled
if BWIBuildSettings.shared.onboardingShowWelcomeScreens {
self.showWelcomeExperience()
} else {
self.beginAuthentication(with: .login)
}
} else {
showLegacyAuthenticationScreen(forceAsRootModule: true)
}