Add sunset banners guiding users to install Element X when registering against a server with MAS. (#7890)

This commit is contained in:
Doug
2025-01-10 13:22:03 +00:00
committed by GitHub
parent 7da4b1c139
commit ee2073a8e3
33 changed files with 498 additions and 60 deletions
@@ -20,6 +20,7 @@ enum MockAuthenticationRegistrationScreenState: MockScreenState, CaseIterable {
case passwordWithUsernameError
case ssoOnly
case fallback
case mas
/// The associated screen
var screenType: Any.Type {
@@ -31,22 +32,29 @@ enum MockAuthenticationRegistrationScreenState: MockScreenState, CaseIterable {
let viewModel: AuthenticationRegistrationViewModel
switch self {
case .matrixDotOrg:
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockMatrixDotOrg)
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockMatrixDotOrg, showReplacementAppBanner: false)
case .passwordOnly:
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer)
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer, showReplacementAppBanner: false)
case .passwordWithCredentials:
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer)
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer, showReplacementAppBanner: false)
viewModel.context.username = "alice"
viewModel.context.password = "password"
Task { await viewModel.confirmUsernameAvailability("alice") }
case .passwordWithUsernameError:
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer)
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockBasicServer, showReplacementAppBanner: false)
viewModel.state.hasEditedUsername = true
Task { await viewModel.displayError(.usernameUnavailable(VectorL10n.authInvalidUserName)) }
case .ssoOnly:
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockEnterpriseSSO)
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockEnterpriseSSO, showReplacementAppBanner: false)
case .fallback:
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockFallback)
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockFallback, showReplacementAppBanner: false)
case .mas:
viewModel = AuthenticationRegistrationViewModel(homeserver: .init(address: "beta.matrix.org",
showLoginForm: false,
showRegistrationForm: false,
showQRLogin: false,
ssoIdentityProviders: []), // The initial discovery failed so the OIDC provider is not known.
showReplacementAppBanner: true)
}
// can simulate service and viewModel actions here if needs be.