diff --git a/Riot/Assets/de.lproj/Bwi.strings b/Riot/Assets/de.lproj/Bwi.strings index 6e612d12e..5918a0242 100644 --- a/Riot/Assets/de.lproj/Bwi.strings +++ b/Riot/Assets/de.lproj/Bwi.strings @@ -513,6 +513,8 @@ // MARK: - Login Protection "bwi_login_protection_error_message" = "Der angegebene Server ist nicht für die Nutzung mit dem %@ vorgesehen"; +"bwi_login_protection_info_message" = "Dein Server ist leider noch nicht für den %@ eingerichtet. Wenn du aus der Öffentlichen Verwaltung bist und Fragen hast, wie Du den %@ nutzen kannst, besuche unserer Website."; +"bwi_login_protection_info_button" = "Website"; // MARK: - Polls "room_event_action_end_poll" = "Umfrage beenden"; diff --git a/Riot/Assets/en.lproj/Bwi.strings b/Riot/Assets/en.lproj/Bwi.strings index c245e9712..81c294d83 100644 --- a/Riot/Assets/en.lproj/Bwi.strings +++ b/Riot/Assets/en.lproj/Bwi.strings @@ -381,6 +381,8 @@ // MARK: - Login Protection "bwi_login_protection_error_message" = "The selected server is not allowed for using with %@"; +"bwi_login_protection_info_message" = "Your server is not yet set up for the %@. If you are from the public sector and have questions about how to use the %@, please visit our website."; +"bwi_login_protection_info_button" = "Website"; // MARK: - Polls "room_event_action_remove_poll" = "Remove poll"; diff --git a/Riot/Generated/BWIStrings.swift b/Riot/Generated/BWIStrings.swift index c23697477..3dd8286f5 100644 --- a/Riot/Generated/BWIStrings.swift +++ b/Riot/Generated/BWIStrings.swift @@ -163,6 +163,14 @@ public class BWIL10n: NSObject { public static func bwiLoginProtectionErrorMessage(_ p1: String) -> String { return BWIL10n.tr("Bwi", "bwi_login_protection_error_message", p1) } + /// Website + public static var bwiLoginProtectionInfoButton: String { + return BWIL10n.tr("Bwi", "bwi_login_protection_info_button") + } + /// Dein Server ist leider noch nicht für den %@ eingerichtet. Wenn du aus der Öffentlichen Verwaltung bist und Fragen hast, wie Du den %@ nutzen kannst, besuche unserer Website. + public static func bwiLoginProtectionInfoMessage(_ p1: String, _ p2: String) -> String { + return BWIL10n.tr("Bwi", "bwi_login_protection_info_message", p1, p2) + } /// Die Konfiguration hat sich geändert. Bitte melde dich neu an. public static var bwiMdmLogoutMessage: String { return BWIL10n.tr("Bwi", "bwi_mdm_logout_message") diff --git a/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionModels.swift b/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionModels.swift index 2803c4a1a..c4f43434d 100644 --- a/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionModels.swift +++ b/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionModels.swift @@ -82,4 +82,6 @@ enum AuthenticationServerSelectionErrorType: Hashable { case footerMessage(String) /// An error occurred when trying to open the EMS link case openURLAlert + /// bwi: When an invalid or nonexisting server is selected at login an info message is displayed + case openInvalidServerInfo } diff --git a/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionViewModel.swift b/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionViewModel.swift index b7c6d7c09..791f2b20e 100644 --- a/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionViewModel.swift +++ b/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionViewModel.swift @@ -57,9 +57,17 @@ class AuthenticationServerSelectionViewModel: AuthenticationServerSelectionViewM } case .openURLAlert: state.bindings.alertInfo = AlertInfo(id: .openURLAlert, title: VectorL10n.roomMessageUnableOpenLinkErrorMessage) + case .openInvalidServerInfo: break + } } + @MainActor func displayInfo(_ message: String, buttonTitle: String, completion: (()->Void)? ) { + state.bindings.alertInfo = AlertInfo(id: .openInvalidServerInfo, + title: message, + primaryButton: (buttonTitle, completion)) + } + // MARK: - Private /// Clear any errors shown in the text field footer. diff --git a/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionViewModelProtocol.swift b/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionViewModelProtocol.swift index a4e8abe4a..a2e42dec7 100644 --- a/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionViewModelProtocol.swift +++ b/RiotSwiftUI/Modules/Authentication/ServerSelection/AuthenticationServerSelectionViewModelProtocol.swift @@ -22,4 +22,6 @@ protocol AuthenticationServerSelectionViewModelProtocol { /// Displays an error to the user. @MainActor func displayError(_ type: AuthenticationServerSelectionErrorType) + /// Displays an info with a completion to a user + @MainActor func displayInfo(_ message: String, buttonTitle: String, completion: (()->Void)? ) } diff --git a/RiotSwiftUI/Modules/Authentication/ServerSelection/Coordinator/AuthenticationServerSelectionCoordinator.swift b/RiotSwiftUI/Modules/Authentication/ServerSelection/Coordinator/AuthenticationServerSelectionCoordinator.swift index 885957df4..e7ef1aaa2 100644 --- a/RiotSwiftUI/Modules/Authentication/ServerSelection/Coordinator/AuthenticationServerSelectionCoordinator.swift +++ b/RiotSwiftUI/Modules/Authentication/ServerSelection/Coordinator/AuthenticationServerSelectionCoordinator.swift @@ -122,7 +122,13 @@ final class AuthenticationServerSelectionCoordinator: Coordinator, Presentable { guard protectionService.isValid(homeserverAddress) else { stopLoading() - authenticationServerSelectionViewModel.displayError(.footerMessage(BWIL10n.bwiLoginProtectionErrorMessage(AppInfo.current.displayName))) + let primaryButtonCompletion: (() -> Void)? = { () in + if let url = URL(string: "https://messenger.bwi.de/ich-will-bum") { + UIApplication.shared.open(url) + } + } + + authenticationServerSelectionViewModel.displayInfo(BWIL10n.bwiLoginProtectionInfoMessage(AppInfo.current.displayName, AppInfo.current.displayName), buttonTitle: BWIL10n.bwiLoginProtectionInfoButton, completion: primaryButtonCompletion) return } }