diff --git a/Config/BWIBuildSettings.swift b/Config/BWIBuildSettings.swift index a68e9d1d1..1cc804479 100644 --- a/Config/BWIBuildSettings.swift +++ b/Config/BWIBuildSettings.swift @@ -560,4 +560,7 @@ class BWIBuildSettings: NSObject { // MARK: User Search var sortUserSearchResultsAlphabetically = true + + // MARK: Client error search term + var clientErrorSearchTerm = "Request failed: client error" } diff --git a/Riot/Assets/de.lproj/Bwi.strings b/Riot/Assets/de.lproj/Bwi.strings index ae89a1c82..51cd44b12 100644 --- a/Riot/Assets/de.lproj/Bwi.strings +++ b/Riot/Assets/de.lproj/Bwi.strings @@ -34,6 +34,8 @@ "settings_downtime_message_same_day" = "Der %@ steht von %@-%@ Uhr (UTC%@) nicht zur Verfügung."; "settings_downtime_message_different_days" = "Der %@ steht von %@ Uhr (UTC%@) bis %@ Uhr (UTC%@) nicht zur Verfügung."; "settings_copyright" = "Copyright"; +"standard_error_alert_title_downtime" = "Der Server ist momentan nicht erreichbar. Versuche es später erneut."; +"standard_error_alert_title_no_downtime" = "Der Server ist momentan nicht erreichbar. Versuche es später erneut."; // MARK: - Server Selection (beta) diff --git a/Riot/Assets/en.lproj/Bwi.strings b/Riot/Assets/en.lproj/Bwi.strings index e54121835..84c178075 100644 --- a/Riot/Assets/en.lproj/Bwi.strings +++ b/Riot/Assets/en.lproj/Bwi.strings @@ -34,6 +34,8 @@ "settings_downtime_message_same_day" = "The BwMessenger is not available between %@-%@ (UTC%@). Messages may not be sent or received during that time."; "settings_downtime_message_different_days" = "The BwMessenger is not available from %@ (UTC%@) to %@ (UTC%@). Messages may not be sent or received during that time."; "settings_copyright" = "Copyright"; +"standard_error_alert_title_downtime" = "The server is currently unavailable. Try again later."; +"standard_error_alert_title_no_downtime" = "The server is currently unavailable. Try again later."; // MARK: - Server Selection (beta) diff --git a/Riot/Generated/BWIStrings.swift b/Riot/Generated/BWIStrings.swift index 90bf8cd90..9d3121fd1 100644 --- a/Riot/Generated/BWIStrings.swift +++ b/Riot/Generated/BWIStrings.swift @@ -1575,6 +1575,14 @@ public class BWIL10n: NSObject { public static var splashScreenTitle: String { return BWIL10n.tr("Bwi", "splash_screen_title") } + /// Der Server ist momentan nicht erreichbar. Versuche es später erneut. + public static var standardErrorAlertTitleDowntime: String { + return BWIL10n.tr("Bwi", "standard_error_alert_title_downtime") + } + /// Der Server ist momentan nicht erreichbar. Versuche es später erneut. + public static var standardErrorAlertTitleNoDowntime: String { + return BWIL10n.tr("Bwi", "standard_error_alert_title_no_downtime") + } /// Starte public static var start: String { return BWIL10n.tr("Bwi", "start") diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index ffe41dac9..4c9b72989 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1021,6 +1021,17 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni - (UIAlertController*)showAlertWithTitle:(NSString*)title message:(NSString*)message { + // bwi: (#4174) handling of client errors that are shown when the backend is down + if ([title containsString:BWIBuildSettings.shared.clientErrorSearchTerm]) { + ServerDowntimeDefaultService *service = [[ServerDowntimeDefaultService alloc] init]; + + if ([service isDowntimeNow]) { + title = BWIL10n.standardErrorAlertTitleDowntime; + } else { + title = BWIL10n.standardErrorAlertTitleNoDowntime; + } + } + [_errorNotification dismissViewControllerAnimated:NO completion:nil]; _errorNotification = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];