MESSENGER-3662 Infodialog

This commit is contained in:
Frank Rotermund
2022-12-01 11:11:35 +00:00
parent a2fcf22f0d
commit 068eaba5b4
7 changed files with 31 additions and 1 deletions

View File

@@ -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";

View File

@@ -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";

View File

@@ -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")

View File

@@ -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
}

View File

@@ -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.

View File

@@ -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)? )
}

View File

@@ -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
}
}