Show an alert when entering an account provider that requires Element Pro. (#4326)

This commit is contained in:
Doug
2025-07-17 13:41:26 +01:00
committed by GitHub
parent 247c7a4617
commit f655fbc28b
30 changed files with 253 additions and 5 deletions
@@ -13,6 +13,7 @@ typealias ServerSelectionScreenViewModelType = StateStoreViewModelV2<ServerSelec
class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, ServerSelectionScreenViewModelProtocol {
private let authenticationService: AuthenticationServiceProtocol
private let authenticationFlow: AuthenticationFlow
private let appSettings: AppSettings
private let userIndicatorController: UserIndicatorControllerProtocol
private var actionsSubject: PassthroughSubject<ServerSelectionScreenViewModelAction, Never> = .init()
@@ -23,9 +24,11 @@ class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, Server
init(authenticationService: AuthenticationServiceProtocol,
authenticationFlow: AuthenticationFlow,
appSettings: AppSettings,
userIndicatorController: UserIndicatorControllerProtocol) {
self.authenticationService = authenticationService
self.authenticationFlow = authenticationFlow
self.appSettings = appSettings
self.userIndicatorController = userIndicatorController
let bindings = ServerSelectionScreenBindings(homeserverAddress: authenticationService.homeserver.value.address)
@@ -96,6 +99,14 @@ class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, Server
state.bindings.alertInfo = AlertInfo(id: .registrationAlert,
title: L10n.commonServerNotSupported,
message: L10n.errorAccountCreationNotPossible)
case .elementProRequired(let serverName):
state.bindings.alertInfo = AlertInfo(id: .elementProAlert,
title: L10n.screenChangeServerErrorElementProRequiredTitle,
message: L10n.screenChangeServerErrorElementProRequiredMessage(serverName),
primaryButton: .init(title: L10n.screenChangeServerErrorElementProRequiredActionIos) {
UIApplication.shared.open(self.appSettings.elementProAppStoreURL)
},
secondaryButton: .init(title: L10n.actionCancel, role: .cancel, action: nil))
default:
showFooterMessage(L10n.errorUnknown)
}