From dae40a18a377adbacd03a15c226e05e71181d8c7 Mon Sep 17 00:00:00 2001 From: Doug Date: Thu, 15 Jul 2021 18:23:36 +0100 Subject: [PATCH 1/9] Drop use of deprecated currentUserNotificationSettings property in favour of UNUserNotificationCenter. --- Riot/Modules/Settings/SettingsViewController.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index a6dad221f6..a3afaec1cd 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -2790,10 +2790,19 @@ - (void)onRemove3PID:(NSIndexPath*)indexPath } - (void)togglePushNotifications:(id)sender +{ + // Get the user's notification settings to check check authorization status. + [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self togglePushNotifications:sender withNotificationSettings:settings]; + }); + }]; +} + +- (void)togglePushNotifications:(id)sender withNotificationSettings:(UNNotificationSettings * _Nonnull)settings { // Check first whether the user allow notification from device settings - UIUserNotificationType currentUserNotificationTypes = UIApplication.sharedApplication.currentUserNotificationSettings.types; - if (currentUserNotificationTypes == UIUserNotificationTypeNone) + if (settings.authorizationStatus == UNAuthorizationStatusDenied) { [currentAlert dismissViewControllerAnimated:NO completion:nil]; From 2fb4bd3a17b31157e670dbf2fed43bc1b7428773 Mon Sep 17 00:00:00 2001 From: Doug Date: Thu, 15 Jul 2021 18:24:02 +0100 Subject: [PATCH 2/9] Typo. --- Riot/Modules/Settings/SettingsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index a3afaec1cd..63e8e5a335 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -2791,7 +2791,7 @@ - (void)onRemove3PID:(NSIndexPath*)indexPath - (void)togglePushNotifications:(id)sender { - // Get the user's notification settings to check check authorization status. + // Get the user's notification settings to check their authorization status. [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) { dispatch_async(dispatch_get_main_queue(), ^{ [self togglePushNotifications:sender withNotificationSettings:settings]; From ef9676a62aa06a7de6d11a414288a650c5018201 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 27 Jul 2021 17:15:43 +0100 Subject: [PATCH 3/9] Fix compile error. --- Riot/Modules/Settings/SettingsViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 9b8251cf07..747b261c3a 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -2812,7 +2812,7 @@ - (void)togglePushNotifications:(UISwitch *)sender }]; } -- (void)togglePushNotifications:(id)sender withNotificationSettings:(UNNotificationSettings * _Nonnull)settings +- (void)togglePushNotifications:(UISwitch *)sender withNotificationSettings:(UNNotificationSettings * _Nonnull)settings { // Check first whether the user allow notification from device settings if (settings.authorizationStatus == UNAuthorizationStatusDenied) From 8b1d6c4c5591ceb58329dbc47851754bd001f657 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 27 Jul 2021 17:31:22 +0100 Subject: [PATCH 4/9] Cherry-pick ceb5a35 and 949d3d9 as an additional option, rather than replacing the toggle. --- .../Modules/Settings/SettingsViewController.m | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 747b261c3a..ea0332be61 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -89,6 +89,7 @@ enum { NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX = 0, + NOTIFICATION_SETTINGS_SYSTEM_SETTINGS, NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT, NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX, NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX, @@ -351,6 +352,7 @@ - (void)updateSections Section *sectionNotificationSettings = [Section sectionWithTag:SECTION_TAG_NOTIFICATIONS]; [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX]; + [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SYSTEM_SETTINGS]; if (RiotSettings.shared.settingsScreenShowNotificationDecodedContentOption) { [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT]; @@ -1798,6 +1800,22 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = labelAndSwitchCell; } + else if (row == NOTIFICATION_SETTINGS_SYSTEM_SETTINGS) + { + cell = [tableView dequeueReusableCellWithIdentifier:kSettingsViewControllerPhoneBookCountryCellId]; + if (!cell) + { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kSettingsViewControllerPhoneBookCountryCellId]; + } + + cell.textLabel.textColor = ThemeService.shared.theme.textPrimaryColor; + + cell.textLabel.text = NSLocalizedStringFromTable(@"settings_enable_push_notif", @"Vector", nil); + cell.detailTextLabel.text = @""; + + [cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme]; + cell.selectionStyle = UITableViewCellSelectionStyleDefault; + } else if (row == NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT) { MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath]; @@ -2501,6 +2519,10 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; [self showInviteFriendsFromSourceView:selectedCell]; } + else if (section == SECTION_TAG_NOTIFICATIONS && row == NOTIFICATION_SETTINGS_SYSTEM_SETTINGS) + { + [self openSystemSettingsApp]; + } else if (section == SECTION_TAG_DISCOVERY) { [self.settingsDiscoveryTableViewSection selectRow:row]; @@ -2880,6 +2902,12 @@ - (void)togglePushNotifications:(UISwitch *)sender withNotificationSettings:(UNN } } +- (void)openSystemSettingsApp +{ + NSURL *settingsAppURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; + [[UIApplication sharedApplication] openURL:settingsAppURL options:@{} completionHandler:nil]; +} + - (void)toggleCallKit:(UISwitch *)sender { [MXKAppSettings standardAppSettings].enableCallKit = sender.isOn; From 88660d566b4dc310d67217d7381aff568d0bc8f8 Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 27 Jul 2021 17:38:40 +0100 Subject: [PATCH 5/9] Update string. --- Riot/Assets/en.lproj/Vector.strings | 1 + Riot/Generated/Strings.swift | 4 ++++ Riot/Modules/Settings/SettingsViewController.m | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 80c55d9894..aabfb8eada 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -492,6 +492,7 @@ Tap the + to start adding people."; "settings_security" = "SECURITY"; "settings_enable_push_notif" = "Notifications on this device"; +"settings_device_notifications" = "Device notifications"; "settings_show_decrypted_content" = "Show decrypted content"; "settings_global_settings_info" = "Global notification settings are available on your %@ web client"; "settings_pin_rooms_with_missed_notif" = "Pin rooms with missed notifications"; diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 3de870902a..76dfc1fde4 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -4114,6 +4114,10 @@ internal enum VectorL10n { internal static var settingsDeactivateMyAccount: String { return VectorL10n.tr("Vector", "settings_deactivate_my_account") } + /// Device notifications + internal static var settingsDeviceNotifications: String { + return VectorL10n.tr("Vector", "settings_device_notifications") + } /// SESSIONS internal static var settingsDevices: String { return VectorL10n.tr("Vector", "settings_devices") diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index ea0332be61..4f306d2174 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -1810,7 +1810,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.textLabel.textColor = ThemeService.shared.theme.textPrimaryColor; - cell.textLabel.text = NSLocalizedStringFromTable(@"settings_enable_push_notif", @"Vector", nil); + cell.textLabel.text = NSLocalizedStringFromTable(@"settings_device_notifications", @"Vector", nil); cell.detailTextLabel.text = @""; [cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme]; From f4c6104513345c2fe9fc3d37075902eb4b782a19 Mon Sep 17 00:00:00 2001 From: Doug Date: Wed, 28 Jul 2021 11:38:49 +0100 Subject: [PATCH 6/9] Turn the toggle off if notifications were denied. --- .../Modules/Settings/SettingsViewController.m | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 4f306d2174..eda70d0c82 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -236,6 +236,11 @@ @interface SettingsViewController () Date: Wed, 28 Jul 2021 12:45:06 +0100 Subject: [PATCH 7/9] Update notifications disabled alert. --- Riot/Assets/bg.lproj/Vector.strings | 1 - Riot/Assets/ca.lproj/Vector.strings | 1 - Riot/Assets/cy.lproj/Vector.strings | 1 - Riot/Assets/de.lproj/Vector.strings | 1 - Riot/Assets/en.lproj/Vector.strings | 3 ++- Riot/Assets/eo.lproj/Vector.strings | 1 - Riot/Assets/es.lproj/Vector.strings | 1 - Riot/Assets/et.lproj/Vector.strings | 1 - Riot/Assets/eu.lproj/Vector.strings | 1 - Riot/Assets/fr.lproj/Vector.strings | 1 - Riot/Assets/hu.lproj/Vector.strings | 1 - Riot/Assets/is.lproj/Vector.strings | 1 - Riot/Assets/it.lproj/Vector.strings | 1 - Riot/Assets/ja.lproj/Vector.strings | 1 - Riot/Assets/kab.lproj/Vector.strings | 1 - Riot/Assets/nb-NO.lproj/Vector.strings | 1 - Riot/Assets/nl.lproj/Vector.strings | 1 - Riot/Assets/pl.lproj/Vector.strings | 1 - Riot/Assets/pt_BR.lproj/Vector.strings | 1 - Riot/Assets/ru.lproj/Vector.strings | 1 - Riot/Assets/sq.lproj/Vector.strings | 1 - Riot/Assets/sv.lproj/Vector.strings | 1 - Riot/Assets/vi.lproj/Vector.strings | 1 - Riot/Assets/zh_Hans.lproj/Vector.strings | 1 - Riot/Assets/zh_Hant.lproj/Vector.strings | 1 - Riot/Generated/Strings.swift | 12 ++++++--- .../Modules/Settings/SettingsViewController.m | 26 +++++++++++++++---- 27 files changed, 31 insertions(+), 34 deletions(-) diff --git a/Riot/Assets/bg.lproj/Vector.strings b/Riot/Assets/bg.lproj/Vector.strings index 04a6695243..854c51242b 100644 --- a/Riot/Assets/bg.lproj/Vector.strings +++ b/Riot/Assets/bg.lproj/Vector.strings @@ -298,7 +298,6 @@ "settings_global_settings_info" = "Глобални настройки на известия са налични на Вашия %@ уеб клиент"; "settings_pin_rooms_with_missed_notif" = "Закачане на стаи с пропуснати известия"; "settings_pin_rooms_with_unread" = "Закачане на стаи с непрочетени съобщения"; -"settings_on_denied_notification" = "Известията са отказани за %@. Моля, включете ги в настройките на устройството"; "settings_enable_callkit" = "Интегрирани разговори"; "settings_callkit_info" = "Получаване на входящи повиквания при заключен екран. Показване на Element разговори в историята на системата. Ако iCloud е включен, историята на разговорите се споделя с Apple."; "settings_ui_language" = "Език"; diff --git a/Riot/Assets/ca.lproj/Vector.strings b/Riot/Assets/ca.lproj/Vector.strings index 75c7c7fe20..d690d7efeb 100644 --- a/Riot/Assets/ca.lproj/Vector.strings +++ b/Riot/Assets/ca.lproj/Vector.strings @@ -295,7 +295,6 @@ "settings_global_settings_info" = "Els paràmetres de notificació globals estan disponibles al teu client web %@"; "settings_pin_rooms_with_missed_notif" = "Fixa sales amb notificacions pendents"; "settings_pin_rooms_with_unread" = "Fixa sales amb missatges pendents"; -"settings_on_denied_notification" = "%@ no permet notificacions, si us plau activa-les en els ajustos del teu dispositiu"; "settings_enable_callkit" = "Trucades integrades"; "settings_callkit_info" = "Rep les trucades entrants a la pantalla de bloqueig. Consulta les trucades de Element a l'historial de trucades del sistema. Si està habilitat iCloud, aquest historial de trucades es compartirà amb Apple."; "settings_ui_language" = "Llenguatge"; diff --git a/Riot/Assets/cy.lproj/Vector.strings b/Riot/Assets/cy.lproj/Vector.strings index 868341391d..36b72d7b50 100644 --- a/Riot/Assets/cy.lproj/Vector.strings +++ b/Riot/Assets/cy.lproj/Vector.strings @@ -373,7 +373,6 @@ "settings_global_settings_info" = "Mae gosodiadau hysbysu eang ar gael ar eich cleient %@ gwe"; "settings_pin_rooms_with_missed_notif" = "Pinio ystafelloedd gyda hysbysiadau heb eu gweld"; "settings_pin_rooms_with_unread" = "Pinio ystafelloedd gyda negeseuon heb eu darllen"; -"settings_on_denied_notification" = "Gwrthodir hysbysiadau i %@, caniatewch nhw yn eich gosodiadau dyfais"; "settings_enable_callkit" = "Galw integredig"; "settings_callkit_info" = "Derbyn galwadau sy'n dod i mewn ar eich sgrin clo. Gwelwch eich galwadau Element yn hanes galwadau'r system. Os yw iCloud wedi'i alluogi, bydd yr hanes galw hwn yn cael ei rannu gydag Apple."; "settings_calls_stun_server_fallback_button" = "Caniatáu gweinydd cymorth galw wrth gefn"; diff --git a/Riot/Assets/de.lproj/Vector.strings b/Riot/Assets/de.lproj/Vector.strings index df37ce7c2a..32aabeaf5e 100644 --- a/Riot/Assets/de.lproj/Vector.strings +++ b/Riot/Assets/de.lproj/Vector.strings @@ -316,7 +316,6 @@ "settings_global_settings_info" = "Globale Benachrichtigungseinstellungen sind auf deinem %@ web-Client verfügbar"; "settings_pin_rooms_with_missed_notif" = "Pinnen von Räumen mit verpassten Benachrichtigungen"; "settings_pin_rooms_with_unread" = "Pinnen von Räumen mit ungelesenen Nachrichten"; -"settings_on_denied_notification" = "Benachrichtigungen verboten für %@, bitte in den Geräte-Einstellungen erlauben"; "settings_contacts_discover_matrix_users" = "Entdecke andere Benutzer mittels E-Mail-Adressen oder Telefonnummern"; "settings_labs_e2e_encryption_prompt_message" = "Zum Fertigstellen der Verschlüsselung bitte neu anmelden."; "settings_third_party_notices" = "Anmerkungen von Dritten"; diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index aabfb8eada..ee302e5c72 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -497,7 +497,8 @@ Tap the + to start adding people."; "settings_global_settings_info" = "Global notification settings are available on your %@ web client"; "settings_pin_rooms_with_missed_notif" = "Pin rooms with missed notifications"; "settings_pin_rooms_with_unread" = "Pin rooms with unread messages"; -"settings_on_denied_notification" = "Notifications are denied for %@, please allow them in your device settings"; +"settings_notifications_disabled_alert_title" = "Notifications disabled"; +"settings_notifications_disabled_alert_message" = "To enable notifications, go to your device settings."; //"settings_enable_all_notif" = "Enable all notifications"; //"settings_messages_my_display_name" = "Msg containing my display name"; //"settings_messages_my_user_name" = "Msg containing my user name"; diff --git a/Riot/Assets/eo.lproj/Vector.strings b/Riot/Assets/eo.lproj/Vector.strings index bf7636ecb4..5fb7c67074 100644 --- a/Riot/Assets/eo.lproj/Vector.strings +++ b/Riot/Assets/eo.lproj/Vector.strings @@ -975,7 +975,6 @@ "settings_calls_stun_server_fallback_description" = "Permesi repaŝan servilon %@ asistan je vokoj, kiam la hejmservilo ne provizas servilon (via IP-adreso ne doniĝus dum voko)."; "settings_calls_stun_server_fallback_button" = "Permesi repaŝan servilon asistan je vokoj"; "settings_callkit_info" = "Ricevi vokpetojn ĉe via ŝlosa ekrano. Vidi viajn vokojn de Element ĉe la sistema vokhistorio. Se iCloud estas ŝaltita, la vokhistorio doniĝas ankaŭ al Apple."; -"settings_on_denied_notification" = "Sciigo por %s estas malŝaltitaj, bonvole permesu ilin per la agordoj de via aparato"; "settings_pin_rooms_with_unread" = "Alpingli ĉambrojn kun nelegitaj mesaĝoj"; "settings_pin_rooms_with_missed_notif" = "Alpinigli ĉambrojn kun nerimarkitaj sciigoj"; "settings_show_decrypted_content" = "Montri malĉifritajn enhavojn"; diff --git a/Riot/Assets/es.lproj/Vector.strings b/Riot/Assets/es.lproj/Vector.strings index 216722a928..bcb6247d5f 100644 --- a/Riot/Assets/es.lproj/Vector.strings +++ b/Riot/Assets/es.lproj/Vector.strings @@ -321,7 +321,6 @@ "settings_global_settings_info" = "Los ajustes de notificación globales están disponibles en tu cliente web %@"; "settings_pin_rooms_with_missed_notif" = "Fijar salas con notificaciones pendientes"; "settings_pin_rooms_with_unread" = "Fijar salas con mensajes no leídos"; -"settings_on_denied_notification" = "Las notificaciones están denegadas para %@, por favor habilita notificaciones en los ajustes de tu dispositivo"; "settings_enable_callkit" = "Integración de llamadas"; "settings_callkit_info" = "Recibe llamadas entrantes en tu pantalla de bloqueo. Ve tus llamadas de Element en el historial de llamadas del sistema. Si iCloud está habilitado, este historial de llamadas se compartirá con Apple."; "settings_ui_language" = "Idioma"; diff --git a/Riot/Assets/et.lproj/Vector.strings b/Riot/Assets/et.lproj/Vector.strings index 4844bde615..b1a08d6a5c 100644 --- a/Riot/Assets/et.lproj/Vector.strings +++ b/Riot/Assets/et.lproj/Vector.strings @@ -497,7 +497,6 @@ "settings_global_settings_info" = "Üldised teavituste seadistused leiduvad sinu %@ veebikliendis"; "settings_pin_rooms_with_missed_notif" = "Klammerda jututoad, kus leidub lugemata teavitusi"; "settings_pin_rooms_with_unread" = "Klammerda jututoad, kus leidub lugemata sõnumeid"; -"settings_on_denied_notification" = "Teavitused on %@ jaoks keelatud, palun luba nad oma seadme seadistustes"; "settings_enable_callkit" = "Lõimitud helistamine"; "settings_callkit_info" = "Vasta kõnedele lukustuskuvalt. Vaata Element'i kõnesid süsteemi kõnelogist. Kui iCloud on kasutusel, siis kõnede ajalugu jagatakse Applega."; "settings_calls_stun_server_fallback_button" = "Kasuta kõnehõlbustusserverit"; diff --git a/Riot/Assets/eu.lproj/Vector.strings b/Riot/Assets/eu.lproj/Vector.strings index 9278d4a1d6..b3651544f5 100644 --- a/Riot/Assets/eu.lproj/Vector.strings +++ b/Riot/Assets/eu.lproj/Vector.strings @@ -396,7 +396,6 @@ "room_participants_remove_third_party_invite_msg" = "Hirugarrengoen gonbidapenak kentzea ez da onartzen APIa ez dagoen bitartean"; "settings_sign_out_e2e_warn" = "Zure muturretik muturrerako zifratze gakoak galduko dituzu. Horrek esan nahi du ezin izango dituzula mezu zaharrak gehiago irakurri zifratutako geletan gailu honetatik."; "settings_global_settings_info" = "Jakinarazpen orokorren ezarpenak eskuragarri daude zure %@ web bezeroan"; -"settings_on_denied_notification" = "Jakinarazpenak ukatu dira %@(e)n, baimendu zure gailuaren ezarpenetan"; "room_details_history_section_prompt_msg" = "Historiala nork irakurri dezakeen aldatzea gelak honetara aurrerantzean bidalitako mezuei besterik ez zaie aplikatuko. Badagoen historialaren ikusgaitasuna ez da aldatuko."; // Call "call_incoming_voice_prompt" = "%@ erabiltzailearen deia jasotzen"; diff --git a/Riot/Assets/fr.lproj/Vector.strings b/Riot/Assets/fr.lproj/Vector.strings index 2f632e10c6..d7734038b0 100644 --- a/Riot/Assets/fr.lproj/Vector.strings +++ b/Riot/Assets/fr.lproj/Vector.strings @@ -278,7 +278,6 @@ "settings_global_settings_info" = "Les paramètres de notification globaux sont disponibles sur votre client web %@"; "settings_pin_rooms_with_missed_notif" = "Épingler les salons avec des notifications non lues"; "settings_pin_rooms_with_unread" = "Épingler les salons avec des messages non lus"; -"settings_on_denied_notification" = "Les notifications sont refusées pour %@, merci de les autoriser dans les paramètres de votre appareil"; "settings_unignore_user" = "Afficher tous les messages de %@ ?"; "settings_contacts_discover_matrix_users" = "Utiliser un e-mail ou un numéro de téléphone pour retrouver des utilisateurs"; "settings_contacts_phonebook_country" = "Pays pour le répertoire téléphonique"; diff --git a/Riot/Assets/hu.lproj/Vector.strings b/Riot/Assets/hu.lproj/Vector.strings index 0d516eb935..01905a26f3 100644 --- a/Riot/Assets/hu.lproj/Vector.strings +++ b/Riot/Assets/hu.lproj/Vector.strings @@ -311,7 +311,6 @@ "settings_global_settings_info" = "Globális értesítési beállításokat a webes kliensedben találod: %@"; "settings_pin_rooms_with_missed_notif" = "Szobák kitűzése elszalasztott értesítésekkel"; "settings_pin_rooms_with_unread" = "Szobák kitűzése olvasatlan üzenetekkel"; -"settings_on_denied_notification" = "Az értesítések tiltva vannak ehhez: %@, kérlek engedélyezd az eszköz beállításaiban"; "settings_enable_callkit" = "Beépített hívás"; "settings_callkit_info" = "Hívások fogadása a zárolt képernyőn. Element hívások megjelenítése a rendszer hívás naplójában. Ha az iCloud engedélyezett akkor a hívásnapló az Apple-el megosztásra kerül."; "settings_ui_language" = "Nyelv"; diff --git a/Riot/Assets/is.lproj/Vector.strings b/Riot/Assets/is.lproj/Vector.strings index bd4577fdac..a34e891adc 100644 --- a/Riot/Assets/is.lproj/Vector.strings +++ b/Riot/Assets/is.lproj/Vector.strings @@ -442,7 +442,6 @@ "settings_fail_to_update_profile" = "Mistókst að uppfæra notandasnið"; "settings_pin_rooms_with_missed_notif" = "Festa spjallrásir með óskoðuðum tilkynningum"; "settings_pin_rooms_with_unread" = "Festa spjallrásir með ólesnum skilaboðum"; -"settings_on_denied_notification" = "Tilkynningum er hafnað fyrir %@, leyfðu þær í stillingum tækisins"; "settings_ui_theme_picker_message" = "\"Sjálfvirkt\" notar \"Umsnúa litum\" stillingar tækisins"; "settings_contacts_discover_matrix_users" = "Notaðu tölvupóstföng og símanúmer til að finna notendur"; "settings_labs_e2e_encryption_prompt_message" = "Til að ljúka við uppsetningu á dulritun verðurðu að skrá þig inn aftur."; diff --git a/Riot/Assets/it.lproj/Vector.strings b/Riot/Assets/it.lproj/Vector.strings index 0a7d64e0e6..0a0d7b6cad 100644 --- a/Riot/Assets/it.lproj/Vector.strings +++ b/Riot/Assets/it.lproj/Vector.strings @@ -327,7 +327,6 @@ "settings_global_settings_info" = "Le impostazioni di notifica avanzate sono disponibili nel tuo %@ web client"; "settings_pin_rooms_with_missed_notif" = "Segna le stanze con notifiche perse"; "settings_pin_rooms_with_unread" = "Segna le stanze con messaggi non letti"; -"settings_on_denied_notification" = "Le notifiche non sono permesse per %@, abilitale nelle impostazioni del tuo dispositivo"; "settings_enable_callkit" = "Chiamate integrate"; "settings_callkit_info" = "Ricevi le chiamate in arrivo sul blocca schermo. Mostra le chiamate Element nella cronologia di chiamate del dispositivo. Se iCloud è attivo, questa cronologia sarà condivisa con Apple."; "settings_ui_language" = "Lingua"; diff --git a/Riot/Assets/ja.lproj/Vector.strings b/Riot/Assets/ja.lproj/Vector.strings index 6ccb42bc3a..2ca4ac3b86 100644 --- a/Riot/Assets/ja.lproj/Vector.strings +++ b/Riot/Assets/ja.lproj/Vector.strings @@ -289,7 +289,6 @@ "settings_show_decrypted_content" = "復号化された文章を表示"; "settings_global_settings_info" = "あなたの %@ webクライアント上で、全体の通知設定が可能です"; "settings_pin_rooms_with_missed_notif" = "通知の届かなかった部屋をピン止めする"; -"settings_on_denied_notification" = "%@で通知されないように設定されています。あなたの端末設定で許可してください"; "settings_callkit_info" = "画面がロックされているときに着信がありました。Elementの着信はシステムの通話履歴で確認できます。 iCloudが有効になっている場合、この通話履歴はAppleと共有されます。"; "settings_ui_language" = "言語"; "settings_ui_theme" = "外観"; diff --git a/Riot/Assets/kab.lproj/Vector.strings b/Riot/Assets/kab.lproj/Vector.strings index 1fa265a061..58166fb8fe 100644 --- a/Riot/Assets/kab.lproj/Vector.strings +++ b/Riot/Assets/kab.lproj/Vector.strings @@ -1305,7 +1305,6 @@ "security_settings_blacklist_unverified_devices" = "Ɣur-k·m ad tazneḍ akk iznan ɣer tɣimiyin ur nettwattkal ara"; "security_settings_crypto_sessions_description_2" = "MA yella ur tessineḍ ara anekcum, senfel awal-ik·imuffir, rnu wennez aḥraz aɣellsan."; "settings_send_crash_report" = "Azen tura tura isefka yerrẓen & useqdec"; -"settings_on_denied_notification" = "Ttwagin yilɣa i %@, ttxil-k·m sireg-iten deg yiɣewaren n yibenk-inek·inem"; "settings_global_settings_info" = "Iɣewwaren n yilɣa imatuyen llan ɣef umsaɣ-inek·inem web %@"; "room_participants_start_new_chat_error_using_user_email_without_identity_server" = "Ulac aqeddac n timagit i yettusbadun, ihi ur tezmireḍ ara ad tebduḍ adiwenni akked unermis isseqdacen imayl."; "contacts_address_book_permission_required" = "Ttusrant tsirag i unekcum ɣer yinermisen idiganen"; diff --git a/Riot/Assets/nb-NO.lproj/Vector.strings b/Riot/Assets/nb-NO.lproj/Vector.strings index 744f540335..418c89a9c9 100644 --- a/Riot/Assets/nb-NO.lproj/Vector.strings +++ b/Riot/Assets/nb-NO.lproj/Vector.strings @@ -857,7 +857,6 @@ "room_details_photo_for_dm" = "Bilde"; "room_details_photo" = "Rombilde"; "settings_flair" = "Vis kobling hvor tillatt"; -"settings_on_denied_notification" = "Varsler er ikke tillat for %@, vennligst tillat dem i enhetens innstillinger"; "settings_pin_rooms_with_missed_notif" = "Fest rom med tapte varsler"; "room_info_list_several_members" = "%@ medlemmer"; "pin_protection_not_allowed_pin" = "Av sikkerhetsårsaker er denne PIN-koden ikke tilgjengelig. Prøv en annen PIN-kode"; diff --git a/Riot/Assets/nl.lproj/Vector.strings b/Riot/Assets/nl.lproj/Vector.strings index 5c7a00cae3..a7ba063a6f 100644 --- a/Riot/Assets/nl.lproj/Vector.strings +++ b/Riot/Assets/nl.lproj/Vector.strings @@ -289,7 +289,6 @@ "settings_global_settings_info" = "Globale meldingsinstellingen zijn beschikbaar op uw %@-webcliënt"; "settings_pin_rooms_with_missed_notif" = "Gesprekken met gemiste meldingen vastprikken"; "settings_pin_rooms_with_unread" = "Gesprekken met ongelezen berichten vastprikken"; -"settings_on_denied_notification" = "Meldingen worden geweigerd voor %@, sta ze toe in uw apparaatinstellingen"; //"settings_enable_all_notif" = "Alle notificaties aanzetten"; //"settings_messages_my_display_name" = "Bericht dat mijn naam bevat"; //"settings_messages_my_user_name" = "Bericht dat mijn gebruikersnaam bevat"; diff --git a/Riot/Assets/pl.lproj/Vector.strings b/Riot/Assets/pl.lproj/Vector.strings index 9fc3c92a91..96af5fb0b9 100644 --- a/Riot/Assets/pl.lproj/Vector.strings +++ b/Riot/Assets/pl.lproj/Vector.strings @@ -503,7 +503,6 @@ "settings_key_backup" = "KOPIA ZAPASOWA KLUCZY"; "settings_enable_push_notif" = "Powiadomienia na tym urządzeniu"; "settings_global_settings_info" = "Globalne i szczegółowe ustawienia powiadomień są dostępne z poziomu klienta webowego: %@"; -"settings_on_denied_notification" = "Powiadomienia dla aplikacji %@ są wyłączone. Proszę zezwól na nie w ustawieniach urządzenia"; "settings_callkit_info" = "Odbieraj połączenia przychodzące na ekranie blokady. Zobacz swoje połęczenia Element w historii połączeń w systemie. Jeśli usługa iCloud jest włączona, historia połączeń zostanie udostępniona Apple."; "settings_ui_theme_picker_message" = "\"Auto\" używa ustawienia \"Odwróć kolory\" Twojego urządzenia"; "close" = "Zamknij"; diff --git a/Riot/Assets/pt_BR.lproj/Vector.strings b/Riot/Assets/pt_BR.lproj/Vector.strings index 5af6546560..81f3d77999 100644 --- a/Riot/Assets/pt_BR.lproj/Vector.strings +++ b/Riot/Assets/pt_BR.lproj/Vector.strings @@ -317,7 +317,6 @@ "settings_enable_push_notif" = "Notificações neste dispositivo"; "settings_show_decrypted_content" = "Mostrar conteúdo decriptado"; "settings_global_settings_info" = "Configurações de notificação globais estão disponíveis em seu cliente web %@"; -"settings_on_denied_notification" = "Notificações são negadas para %@, por favor permita-as nas configurações de seu dispositivo"; "settings_enable_callkit" = "Chamamento integrado"; "settings_callkit_info" = "Receba chamadas chegando em sua tela de bloqueio. Veja suas chamadas Element no histórico de chamadas do sistema. Se iCloud está ativado, este histórico de chamadas vai ser compartilhado com Apple."; "settings_ui_language" = "Língua"; diff --git a/Riot/Assets/ru.lproj/Vector.strings b/Riot/Assets/ru.lproj/Vector.strings index 0ad6dbef63..0091c576a4 100644 --- a/Riot/Assets/ru.lproj/Vector.strings +++ b/Riot/Assets/ru.lproj/Vector.strings @@ -259,7 +259,6 @@ "settings_fail_to_update_profile" = "Не удалось обновить профиль"; "settings_enable_push_notif" = "Уведомления на этом устройстве"; "settings_global_settings_info" = "Глобальные настройки уведомлений доступны в вашем %@ веб-клиенте"; -"settings_on_denied_notification" = "Уведомления для %@ запрещены, пожалуйста, разрешите их в настройках вашего устройства"; "settings_ui_language" = "Язык"; "settings_unignore_user" = "Показать все сообщения от %@?"; "settings_labs_e2e_encryption" = "Сквозное шифрование"; diff --git a/Riot/Assets/sq.lproj/Vector.strings b/Riot/Assets/sq.lproj/Vector.strings index 295c8a932e..7a6eb2f8c2 100644 --- a/Riot/Assets/sq.lproj/Vector.strings +++ b/Riot/Assets/sq.lproj/Vector.strings @@ -493,7 +493,6 @@ "settings_sign_out_e2e_warn" = "Do të humbni kyçet tuaj të fshehtëzimit skaj-më-skaj. Kjo do të thotë se s’do të jeni më në gjendje të lexoni mesazhe të vjetër te dhoma të fshehtëzuara në këtë pajisje."; "settings_surname" = "Mbiemër"; "settings_global_settings_info" = "Rregullimet globale për njoftime i gjeni te klienti juaj %@ web"; -"settings_on_denied_notification" = "Njoftimet për %@ s’pranohen, ju lutemi, lejojini që nga rregullimet e pajisjes tuaj"; "settings_enable_callkit" = "Thirrje të integruara"; "settings_callkit_info" = "Merrini thirrjet ardhëse edhe me ekran të kyçur. Shihni thirrjet tuaja nën Element te historiku i thirrjeve të sistemit. Nëse iCloud është i aktivizuar, ky historik thirrjesh do t’i jepet kompanisë Apple."; "settings_ui_theme_picker_message" = "\"Auto\" përdor rregullimet \"Përmbysi Ngjyrat\" të pajisjes tuaj"; diff --git a/Riot/Assets/sv.lproj/Vector.strings b/Riot/Assets/sv.lproj/Vector.strings index 1bbec2ef64..8316784a1b 100644 --- a/Riot/Assets/sv.lproj/Vector.strings +++ b/Riot/Assets/sv.lproj/Vector.strings @@ -309,7 +309,6 @@ "settings_show_decrypted_content" = "Visa avkrypterat innehåll"; "settings_pin_rooms_with_missed_notif" = "Fäst rum med missade aviseringar"; "settings_pin_rooms_with_unread" = "Fäst rum med olästa meddelanden"; -"settings_on_denied_notification" = "Aviseringar har nekats för %@, vänligen tillåt dem i dina enhetsinställningar"; "settings_enable_callkit" = "Integrerade samtal"; "settings_integrations_allow_button" = "Hantera integrationer"; "settings_ui_language" = "Språk"; diff --git a/Riot/Assets/vi.lproj/Vector.strings b/Riot/Assets/vi.lproj/Vector.strings index 88fc75f851..c401d32686 100644 --- a/Riot/Assets/vi.lproj/Vector.strings +++ b/Riot/Assets/vi.lproj/Vector.strings @@ -290,7 +290,6 @@ "settings_global_settings_info" = "Cài đặt thông báo toàn cầu khả dụng trên %@ trình duyệt khách của bạn"; "settings_pin_rooms_with_missed_notif" = "Neo phòng có thông báo bỏ lỡ"; "settings_pin_rooms_with_unread" = "Neo phòng có tin nhắn chưa đọc"; -"settings_on_denied_notification" = "Thông báo bị từ chối cho %@, vui lòng cho phép trong cài đặt thiết bị của bạn"; "settings_enable_callkit" = "Cuộc gọi tích hợp"; "settings_callkit_info" = "Nhận cuộc gọi tới trên màn hình khóa. Xem lịch sử cuộc gọi trong lịch sử cuộc gọi của hệ thống. Nếu iCloud được kích hoạt, lịch sử cuộc gọi sẽ được chia sẻ với Apple."; "settings_ui_language" = "Ngôn ngữ"; diff --git a/Riot/Assets/zh_Hans.lproj/Vector.strings b/Riot/Assets/zh_Hans.lproj/Vector.strings index da074b7677..519be3cfcb 100644 --- a/Riot/Assets/zh_Hans.lproj/Vector.strings +++ b/Riot/Assets/zh_Hans.lproj/Vector.strings @@ -272,7 +272,6 @@ "settings_global_settings_info" = "全局通知设置可在 %@ 的网页客户端中修改"; "settings_pin_rooms_with_missed_notif" = "置顶含有错过的通知的聊天室"; "settings_pin_rooms_with_unread" = "置顶含有未读消息的聊天室"; -"settings_on_denied_notification" = "%@ 的通知请求被拒绝,请在系统设置中允许"; "settings_unignore_user" = "显示所有来自 %@ 的消息?"; "settings_contacts_discover_matrix_users" = "使用电子邮件和手机号码来发现用户"; "settings_contacts_phonebook_country" = "电话本国家"; diff --git a/Riot/Assets/zh_Hant.lproj/Vector.strings b/Riot/Assets/zh_Hant.lproj/Vector.strings index de6fbf1ab1..bf0c0648c4 100644 --- a/Riot/Assets/zh_Hant.lproj/Vector.strings +++ b/Riot/Assets/zh_Hant.lproj/Vector.strings @@ -344,7 +344,6 @@ "room_ongoing_conference_call_with_close" = "群組通話進行中。 以 %@ 或 %@ 加入。%@ 該通話。"; "settings_pin_rooms_with_missed_notif" = "釘選含有錯過的通知的聊天室"; "settings_pin_rooms_with_unread" = "釘選含有未讀訊息的聊天室"; -"settings_on_denied_notification" = "因 %@ 的通知不被允許,請在裝置設定中允許"; "settings_enable_callkit" = "整合式通話"; "settings_callkit_info" = "在鎖定畫面接聽 Element 來電、在通話紀錄中顯示 Element 通話。 如果您已啟用 iCloud ,則這些通話紀錄會與蘋果公司共享。"; "settings_ui_language" = "語言"; diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 76dfc1fde4..26b216bae9 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -4394,6 +4394,14 @@ internal enum VectorL10n { internal static var settingsNightMode: String { return VectorL10n.tr("Vector", "settings_night_mode") } + /// To enable notifications, go to your device settings. + internal static var settingsNotificationsDisabledAlertMessage: String { + return VectorL10n.tr("Vector", "settings_notifications_disabled_alert_message") + } + /// Notifications disabled + internal static var settingsNotificationsDisabledAlertTitle: String { + return VectorL10n.tr("Vector", "settings_notifications_disabled_alert_title") + } /// NOTIFICATION SETTINGS internal static var settingsNotificationsSettings: String { return VectorL10n.tr("Vector", "settings_notifications_settings") @@ -4406,10 +4414,6 @@ internal enum VectorL10n { internal static func settingsOlmVersion(_ p1: String) -> String { return VectorL10n.tr("Vector", "settings_olm_version", p1) } - /// Notifications are denied for %@, please allow them in your device settings - internal static func settingsOnDeniedNotification(_ p1: String) -> String { - return VectorL10n.tr("Vector", "settings_on_denied_notification", p1) - } /// OTHER internal static var settingsOther: String { return VectorL10n.tr("Vector", "settings_other") diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index eda70d0c82..adfae43445 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -2867,13 +2867,14 @@ - (void)togglePushNotifications:(UISwitch *)sender [currentAlert dismissViewControllerAnimated:NO completion:nil]; __weak typeof(self) weakSelf = self; - - NSString *appDisplayName = [[NSBundle mainBundle] infoDictionary][@"CFBundleDisplayName"]; - currentAlert = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:NSLocalizedStringFromTable(@"settings_on_denied_notification", @"Vector", nil), appDisplayName] message:nil preferredStyle:UIAlertControllerStyleAlert]; + NSString *title = NSLocalizedStringFromTable(@"settings_notifications_disabled_alert_title", @"Vector", nil); + NSString *message = NSLocalizedStringFromTable(@"settings_notifications_disabled_alert_message", @"Vector", nil); - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] - style:UIAlertActionStyleDefault + currentAlert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; + + [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { if (weakSelf) @@ -2884,6 +2885,21 @@ - (void)togglePushNotifications:(UISwitch *)sender }]]; + UIAlertAction *settingsAction = [UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"settings"] + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { + if (weakSelf) + { + typeof(self) self = weakSelf; + self->currentAlert = nil; + + [self openSystemSettingsApp]; + } + }]; + + [currentAlert addAction:settingsAction]; + currentAlert.preferredAction = settingsAction; + [currentAlert mxk_setAccessibilityIdentifier: @"SettingsVCPushNotificationsAlert"]; [self presentViewController:currentAlert animated:YES completion:nil]; From 6c864c9de5d9c494f827670192ffd2ee4dabf03b Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Thu, 29 Jul 2021 09:50:20 +0100 Subject: [PATCH 8/9] Update CHANGES.rst --- CHANGES.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 6efffb50be..6ce23abd7e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,8 @@ Changes to be released in next version * Room: Added support for Voice Messages (#4090, #4091, #4092, #4094, #4095, #4096) * Remove the directory section from the Rooms tab. * Notifications: Show decrypted content is enabled by default (#4519). + * Settings: The notifications toggle no longer detects the system's "Deliver Quietly" configuration as disabled (#2368). + * Settings: Adds a link to open the Settings app to quickly configure app notifications. 🐛 Bugfix * Room: Fixed mentioning users from room info member details (#4583) From fda058002cfd9535c57d24b5484b3796b3d3063f Mon Sep 17 00:00:00 2001 From: Doug Date: Thu, 29 Jul 2021 11:37:19 +0100 Subject: [PATCH 9/9] Use MXWeakify/MXStrongifyAndReturnIfNil. --- Riot/Modules/Settings/SettingsViewController.m | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index adfae43445..7f40c9ded0 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -1245,18 +1245,15 @@ - (void)refreshSettings - (void)refreshSystemNotificationSettings { - __weak typeof(self) weakSelf = self; + MXWeakify(self); // Get the system notification settings to check authorization status and configuration. - [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) { + [UNUserNotificationCenter.currentNotificationCenter getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) { dispatch_async(dispatch_get_main_queue(), ^{ - if (weakSelf) - { - typeof(self) self = weakSelf; - - self.systemNotificationSettings = settings; - [self.tableView reloadData]; - } + MXStrongifyAndReturnIfNil(self); + + self.systemNotificationSettings = settings; + [self.tableView reloadData]; }); }]; }