Show fallback on login screen

This commit is contained in:
ismailgulek
2022-05-27 17:51:54 +03:00
parent c10064fb00
commit d6a15e4385
8 changed files with 127 additions and 5 deletions

View File

@@ -61,6 +61,10 @@ struct AuthenticationLoginScreen: View {
ssoButtons
.padding(.top, 16)
}
if !viewModel.viewState.homeserver.showLoginForm && !viewModel.viewState.showSSOButtons {
fallbackButton
}
}
.readableFrame()
@@ -137,6 +141,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")
}
/// Give focus to the password text field.
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