mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 17:42:45 +02:00
Add AuthenticationHomeserverViewData to easily map AuthenticationState.Homeserver to a type in the SwiftUI target.
This commit is contained in:
+5
-13
@@ -39,27 +39,19 @@ enum MockAuthenticationRegistrationScreenState: MockScreenState, CaseIterable {
|
||||
let viewModel: AuthenticationRegistrationViewModel
|
||||
switch self {
|
||||
case .matrixDotOrg:
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserverAddress: "https://matrix.org", ssoIdentityProviders: [
|
||||
SSOIdentityProvider(id: "1", name: "Apple", brand: "apple", iconURL: nil),
|
||||
SSOIdentityProvider(id: "2", name: "Facebook", brand: "facebook", iconURL: nil),
|
||||
SSOIdentityProvider(id: "3", name: "GitHub", brand: "github", iconURL: nil),
|
||||
SSOIdentityProvider(id: "4", name: "GitLab", brand: "gitlab", iconURL: nil),
|
||||
SSOIdentityProvider(id: "5", name: "Google", brand: "google", iconURL: nil)
|
||||
])
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockMatrixDotOrg)
|
||||
case .passwordOnly:
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserverAddress: "https://example.com", ssoIdentityProviders: [])
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer)
|
||||
case .passwordWithCredentials:
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserverAddress: "https://example.com", ssoIdentityProviders: [])
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer)
|
||||
viewModel.context.username = "alice"
|
||||
viewModel.context.password = "password"
|
||||
case .passwordWithUsernameError:
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserverAddress: "https://example.com", ssoIdentityProviders: [])
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer)
|
||||
viewModel.state.hasEditedUsername = true
|
||||
Task { await viewModel.displayError(.usernameUnavailable(VectorL10n.authInvalidUserName)) }
|
||||
case .ssoOnly:
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserverAddress: "https://company.com",
|
||||
showRegistrationForm: false,
|
||||
ssoIdentityProviders: [SSOIdentityProvider(id: "test", name: "SAML", brand: nil, iconURL: nil)])
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockEnterpriseSSO)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user