From 4abaab4061e798e452020aefae8338162afa6060 Mon Sep 17 00:00:00 2001 From: JanNiklas Grabowski Date: Fri, 16 Jun 2023 17:01:12 +0200 Subject: [PATCH] MESSENGER-4742 fix permalink info when room is not available --- Riot/Assets/de.lproj/Bwi.strings | 2 ++ Riot/Assets/en.lproj/Bwi.strings | 2 ++ Riot/Generated/BWIStrings.swift | 8 ++++++++ Riot/Modules/Application/LegacyAppDelegate.m | 8 +++++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Riot/Assets/de.lproj/Bwi.strings b/Riot/Assets/de.lproj/Bwi.strings index 87ea882eb..c8bc4ea9b 100644 --- a/Riot/Assets/de.lproj/Bwi.strings +++ b/Riot/Assets/de.lproj/Bwi.strings @@ -597,6 +597,8 @@ // MARK: - Permalink "settings_permalink_prefix_picker_title" = "Permalink Prefix"; +"bwi_error_room_not_available_title" = "Link ungültig"; +"bwi_error_room_not_available_message" = "Der Raum wurde bereits geschlossen, daher kannst Du nicht mehr beitreten."; // MARK: - Notification Settings "settings_notify_me_for" = "Benachrichtige mich für"; diff --git a/Riot/Assets/en.lproj/Bwi.strings b/Riot/Assets/en.lproj/Bwi.strings index dad7187c4..a9fd60ee2 100644 --- a/Riot/Assets/en.lproj/Bwi.strings +++ b/Riot/Assets/en.lproj/Bwi.strings @@ -507,6 +507,8 @@ // MARK: - Permalink "settings_permalink_prefix_picker_title" = "Permalink Prefix"; +"bwi_error_room_not_available_title" = "Link invalid"; +"bwi_error_room_not_available_message" = "The room has already been closed, you can no longer join."; // MARK: - Notification Settings "settings_notify_me_for" = "Notify me for"; diff --git a/Riot/Generated/BWIStrings.swift b/Riot/Generated/BWIStrings.swift index c5f4c7907..c2223a09b 100644 --- a/Riot/Generated/BWIStrings.swift +++ b/Riot/Generated/BWIStrings.swift @@ -215,6 +215,14 @@ public class BWIL10n: NSObject { public static var bwiErrorLogoutOffline: String { return BWIL10n.tr("Bwi", "bwi_error_logout_offline") } + /// Der Raum wurde bereits geschlossen, daher kannst Du nicht mehr beitreten. + public static var bwiErrorRoomNotAvailableMessage: String { + return BWIL10n.tr("Bwi", "bwi_error_room_not_available_message") + } + /// Link ungültig + public static var bwiErrorRoomNotAvailableTitle: String { + return BWIL10n.tr("Bwi", "bwi_error_room_not_available_title") + } /// Du kannst jetzt aktive und vergangene Umfragen gesammelt in den Raumdetails einsehen (erreichbar unter Raumdetails, im Bereich "Umfrageverlauf"). public static var bwiFeatureBannerAdvertisementText: String { return BWIL10n.tr("Bwi", "bwi_feature_banner_advertisement_text") diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index 9891eead1..5cd25ca35 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -1672,7 +1672,13 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni [self peekInRoomWithNavigationParameters:roomPreviewNavigationParameters pathParams:pathParams]; } } failure:^(NSError *error) { - [self peekInRoomWithNavigationParameters:roomPreviewNavigationParameters pathParams:pathParams]; + // bwi #4742: check if the room is still available + NSHTTPURLResponse *response = error.userInfo[@"httpResponse"]; + if (response.statusCode == 404) { + [self showAlertWithTitle:BWIL10n.bwiErrorRoomNotAvailableTitle message:BWIL10n.bwiErrorRoomNotAvailableMessage]; + } else { + [self peekInRoomWithNavigationParameters:roomPreviewNavigationParameters pathParams:pathParams]; + } }]; }