mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-23 10:02:46 +02:00
MESSENGER-3662 Infodialog
This commit is contained in:
+2
@@ -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
|
||||
}
|
||||
|
||||
+8
@@ -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.
|
||||
|
||||
+2
@@ -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)? )
|
||||
}
|
||||
|
||||
+7
-1
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user