Merge pull request #6210 from vector-im/ismail/6176_auth_fallback

This commit is contained in:
ismailgulek
2022-05-31 19:11:32 +03:00
committed by GitHub
21 changed files with 259 additions and 20 deletions

View File

@@ -61,6 +61,10 @@ struct AuthenticationLoginScreen: View {
ssoButtons
.padding(.top, 16)
}
if !viewModel.viewState.homeserver.showLoginForm && !viewModel.viewState.showSSOButtons {
fallbackButton
}
}
.readableFrame()
@@ -139,6 +143,15 @@ struct AuthenticationLoginScreen: View {
}
}
}
/// A fallback button that can be used for login.
var fallbackButton: some View {
Button(action: fallback) {
Text(VectorL10n.login)
}
.buttonStyle(PrimaryActionButtonStyle())
.accessibilityIdentifier("fallbackButton")
}
/// Parses the username for a homeserver.
func usernameEditingChanged(isEditing: Bool) {
@@ -158,6 +171,11 @@ struct AuthenticationLoginScreen: View {
guard viewModel.viewState.hasValidCredentials else { return }
viewModel.send(viewAction: .next)
}
/// Sends the `fallback` view action.
func fallback() {
viewModel.send(viewAction: .fallback)
}
}
// MARK: - Previews