From d097980fc723748f2589f266553dc3bbfe27b0e5 Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Fri, 8 Sep 2023 15:21:43 +0100 Subject: [PATCH 1/2] Hide phone number and explanation if homeserver doesn't have 3pid capability enabled --- .../Modules/Settings/SettingsViewController.m | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 4bc45f8271..32871e0084 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -371,23 +371,24 @@ - (void)updateSections { [sectionUserSettings addRowWithTag: USER_SETTINGS_PHONENUMBERS_OFFSET + index]; } - if (BuildSettings.settingsScreenAllowAddingEmailThreepids && - // If the threePidChanges is nil we assume the capability to be true - (!self.mainSession.homeserverCapabilities.threePidChanges || - self.mainSession.homeserverCapabilities.threePidChanges.enabled)) - { - [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_EMAIL_INDEX]; - } - if (BuildSettings.settingsScreenAllowAddingPhoneThreepids) - { - [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_PHONENUMBER_INDEX]; - } - if (BuildSettings.settingsScreenShowThreepidExplanatory) - { - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart1] attributes:@{}]; - [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart2] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.tintColor}]]; - [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart3] attributes:@{}]]; - sectionUserSettings.attributedFooterTitle = attributedString; + // If the threePidChanges is nil we assume the capability to be true + if (!self.mainSession.homeserverCapabilities.threePidChanges || + self.mainSession.homeserverCapabilities.threePidChanges.enabled) { + if (BuildSettings.settingsScreenAllowAddingEmailThreepids) + { + [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_EMAIL_INDEX]; + } + if (BuildSettings.settingsScreenAllowAddingPhoneThreepids) + { + [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_PHONENUMBER_INDEX]; + } + if (BuildSettings.settingsScreenShowThreepidExplanatory) + { + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart1] attributes:@{}]; + [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart2] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.tintColor}]]; + [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart3] attributes:@{}]]; + sectionUserSettings.attributedFooterTitle = attributedString; + } } sectionUserSettings.headerTitle = [VectorL10n settingsUserSettings]; From 2b7fcfd163039e21fe04df4a78444881f90852af Mon Sep 17 00:00:00 2001 From: Hugh Nimmo-Smith Date: Fri, 8 Sep 2023 15:27:25 +0100 Subject: [PATCH 2/2] Changelog --- changelog.d/7670.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/7670.bugfix diff --git a/changelog.d/7670.bugfix b/changelog.d/7670.bugfix new file mode 100644 index 0000000000..7f975ec95a --- /dev/null +++ b/changelog.d/7670.bugfix @@ -0,0 +1 @@ +Add phone number UI and explanatory text is hidden if the 3 pid changes capability is disabled.