Feature/3811 appconfig

This commit is contained in:
Frank Rotermund
2023-09-19 11:21:12 +00:00
parent e3cfb301a9
commit 5dd5dc2db7
13 changed files with 205 additions and 145 deletions
@@ -144,7 +144,12 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
// bwi: force serverselection on test apps
if (BWIBuildSettings.shared.authScreenShowTestServerOptions && BWIBuildSettings.shared.bwiLoginFlowLayout) ||
BWIBuildSettings.shared.bumLoginFlowLayout {
showServerSelectionScreen(for: flow)
// bwi #3811: when there is a valid url from app config don't show server selection
if BWIBuildSettings.shared.avoidServerSelectionOnAppConfig && AppConfigService.shared.isAppConfig {
self.useHomeserver(AppConfigService.shared.serverUrl())
} else {
showServerSelectionScreen(for: flow)
}
} else {
do {
// Start the flow using the default server (or a provisioning link if set).
@@ -267,6 +272,21 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
callback?(.cancel(.register))
}
/// Updates the login flow using the supplied homeserver address, or shows an error when this isn't possible.
@MainActor private func useHomeserver(_ homeserverAddress: String) {
let homeserverAddress = HomeserverAddress.sanitized(homeserverAddress)
Task {
do {
try await authenticationService.startFlow(.login, for: homeserverAddress)
showLoginScreen()
} catch {
displayError(message: error.localizedDescription)
}
}
}
// MARK: - Login
/// Shows the login screen.
@@ -189,7 +189,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
private func showWelcomeExperience() {
let welcomeVC = WelcomeExperienceViewController.makeViewController(completion: { [weak self] in
let welcomeVC = WelcomeExperienceViewController.makeViewController(completion: { [weak self] in
if BWIBuildSettings.shared.onboardingEnableNewAuthenticationFlow {
self?.startLoading()
self?.beginAuthentication(with: .login) { [weak self] in