diff --git a/Riot/Modules/Common/Models/Section.swift b/Riot/Modules/Common/Models/Section.swift index 29eb405005..82ab03984e 100644 --- a/Riot/Modules/Common/Models/Section.swift +++ b/Riot/Modules/Common/Models/Section.swift @@ -22,6 +22,7 @@ final class Section: NSObject { let tag: Int var rows: [Row] var headerTitle: String? + var footerTitle: String? init(withTag tag: Int) { self.tag = tag diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index 42e1d64ac4..63a7e4bffc 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -399,20 +399,6 @@ - (MXKTableViewCell*)trustCellWithDevice:(MXDevice*)device forTableView:(UITable return cell; } -- (MXKTableViewCell*)descriptionCellForTableView:(UITableView*)tableView withText:(NSString*)text -{ - MXKTableViewCell *cell = [self getDefaultTableViewCell:tableView]; - cell.textLabel.text = text; - cell.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; - cell.textLabel.textColor = ThemeService.shared.theme.headerTextPrimaryColor; - cell.textLabel.numberOfLines = 0; - cell.contentView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - - return cell; -} - - - (MXKTableViewCellWithTextView*)textViewCellForTableView:(UITableView*)tableView atIndexPath:(NSIndexPath *)indexPath { MXKTableViewCellWithTextView *textViewCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithTextView defaultReuseIdentifier] forIndexPath:indexPath]; @@ -517,7 +503,7 @@ - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view { // Customize label style UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view; - tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.headerTextPrimaryColor; + tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.colors.secondaryContent; } } diff --git a/Riot/Modules/Settings/Security/SecureBackup/SettingsSecureBackupTableViewSection.swift b/Riot/Modules/Settings/Security/SecureBackup/SettingsSecureBackupTableViewSection.swift index cc23c878c7..ffeed21214 100644 --- a/Riot/Modules/Settings/Security/SecureBackup/SettingsSecureBackupTableViewSection.swift +++ b/Riot/Modules/Settings/Security/SecureBackup/SettingsSecureBackupTableViewSection.swift @@ -21,7 +21,6 @@ import UIKit func settingsSecureBackupTableViewSectionDidUpdate(_ settingsSecureBackupTableViewSection: SettingsSecureBackupTableViewSection) func settingsSecureBackupTableViewSection(_ settingsSecureBackupTableViewSection: SettingsSecureBackupTableViewSection, textCellForRow: Int) -> MXKTableViewCellWithTextView - func settingsSecureBackupTableViewSection(_ settingsSecureBackupTableViewSection: SettingsSecureBackupTableViewSection, descriptionCellForRow: Int) -> MXKTableViewCell func settingsSecureBackupTableViewSection(_ settingsSecureBackupTableViewSection: SettingsSecureBackupTableViewSection, buttonCellForRow: Int) -> MXKTableViewCellWithButton // Secure backup @@ -39,7 +38,6 @@ import UIKit private enum BackupRows { case info(text: String) - case description(text: String) case createSecureBackupAction case resetSecureBackupAction case createKeyBackupAction @@ -96,8 +94,6 @@ private enum BackupRows { switch backupRow { case .info(let text): cell = self.textCell(atRow: row, text: text) - case .description(let text): - cell = self.descriptionCell(atRow: row, text: text) case .createSecureBackupAction: cell = self.buttonCellForCreateSecureBackup(atRow: row) case .resetSecureBackupAction: @@ -130,8 +126,7 @@ private enum BackupRows { switch self.viewState { case .loading: backupRows = [ - .info(text: VectorL10n.securitySettingsSecureBackupInfoChecking), - .description(text: VectorL10n.securitySettingsSecureBackupDescription) + .info(text: VectorL10n.securitySettingsSecureBackupInfoChecking) ] case .noSecureBackup(let keyBackupState): @@ -143,16 +138,14 @@ private enum BackupRows { backupRows = [ .info(text: infoText), - .createSecureBackupAction, - .description(text: VectorL10n.securitySettingsSecureBackupDescription) + .createSecureBackupAction ] case .keyBackup(let keyBackupVersion, _, _), .keyBackupNotTrusted(let keyBackupVersion, _): // Manage the key backup in the same way for the moment backupRows = [ .info(text: VectorL10n.securitySettingsSecureBackupInfoValid), .restoreFromKeyBackupAction(keyBackupVersion: keyBackupVersion, title: VectorL10n.securitySettingsSecureBackupRestore), - .deleteKeyBackupAction(keyBackupVersion: keyBackupVersion), - .description(text: VectorL10n.securitySettingsSecureBackupDescription) + .deleteKeyBackupAction(keyBackupVersion: keyBackupVersion) ] } case .secureBackup(let keyBackupState): @@ -165,8 +158,7 @@ private enum BackupRows { backupRows = [ .info(text: infoText), .createKeyBackupAction, - .resetSecureBackupAction, - .description(text: VectorL10n.securitySettingsSecureBackupDescription) + .resetSecureBackupAction ] case .keyBackup(let keyBackupVersion, _, _), .keyBackupNotTrusted(let keyBackupVersion, _): // Manage the key backup in the same way for the moment @@ -174,8 +166,7 @@ private enum BackupRows { .info(text: VectorL10n.securitySettingsSecureBackupInfoValid), .restoreFromKeyBackupAction(keyBackupVersion: keyBackupVersion, title: VectorL10n.securitySettingsSecureBackupRestore), .deleteKeyBackupAction(keyBackupVersion: keyBackupVersion), - .resetSecureBackupAction, - .description(text: VectorL10n.securitySettingsSecureBackupDescription) + .resetSecureBackupAction ] } } @@ -194,16 +185,6 @@ private enum BackupRows { return cell } - private func descriptionCell(atRow row: Int, text: String) -> UITableViewCell { - guard let delegate = self.delegate else { - return UITableViewCell() - } - - let cell = delegate.settingsSecureBackupTableViewSection(self, descriptionCellForRow: row) - cell.textLabel?.text = text - return cell - } - // MARK: - Button cells private func buttonCellForCreateSecureBackup(atRow row: Int) -> UITableViewCell { diff --git a/Riot/Modules/Settings/Security/SecurityViewController.m b/Riot/Modules/Settings/Security/SecurityViewController.m index a5e0822533..a34275df61 100644 --- a/Riot/Modules/Settings/Security/SecurityViewController.m +++ b/Riot/Modules/Settings/Security/SecurityViewController.m @@ -53,7 +53,6 @@ enum { PIN_CODE_SETTING, - PIN_CODE_DESCRIPTION, PIN_CODE_CHANGE, PIN_CODE_BIOMETRICS, PIN_CODE_COUNT @@ -67,7 +66,6 @@ enum { ADVANCED_BLACKLIST_UNVERIFIED_DEVICES, - ADVANCED_BLACKLIST_UNVERIFIED_DEVICES_DESCRIPTION, ADVANCED_COUNT }; @@ -291,17 +289,20 @@ - (void)updateSections Section *pinCodeSection = [Section sectionWithTag:SECTION_PIN_CODE]; - // Header title + // Header and footer if ([PinCodePreferences shared].isBiometricsAvailable) { pinCodeSection.headerTitle = [VectorL10n pinProtectionSettingsSectionHeaderWithBiometrics:[PinCodePreferences shared].localizedBiometricsName]; } else { pinCodeSection.headerTitle = [VectorL10n pinProtectionSettingsSectionHeader]; } + if (PinCodePreferences.shared.isPinSet) + { + pinCodeSection.footerTitle = VectorL10n.pinProtectionSettingsSectionFooter; + } // Rows [pinCodeSection addRowWithTag:PIN_CODE_SETTING]; - [pinCodeSection addRowWithTag:PIN_CODE_DESCRIPTION]; if ([PinCodePreferences shared].isPinSet) { @@ -322,19 +323,16 @@ - (void)updateSections Section *sessionsSection = [Section sectionWithTag:SECTION_CRYPTO_SESSIONS]; sessionsSection.headerTitle = [VectorL10n securitySettingsCryptoSessions]; - - NSUInteger sessionsSectionRowsCount; if (self.showLoadingDevicesInformation) { - sessionsSectionRowsCount = 2; + sessionsSection.footerTitle = VectorL10n.securitySettingsCryptoSessionsLoading; } else { - sessionsSectionRowsCount = devicesArray.count + 1; + sessionsSection.footerTitle = VectorL10n.securitySettingsCryptoSessionsDescription2; + [sessionsSection addRowsWithCount:devicesArray.count]; } - - [sessionsSection addRowsWithCount:sessionsSectionRowsCount]; [sections addObject:sessionsSection]; } @@ -343,6 +341,7 @@ - (void)updateSections Section *secureBackupSection = [Section sectionWithTag:SECTION_SECURE_BACKUP]; secureBackupSection.headerTitle = [VectorL10n securitySettingsSecureBackup]; + secureBackupSection.footerTitle = VectorL10n.securitySettingsSecureBackupDescription; [secureBackupSection addRowsWithCount:self->secureBackupSection.numberOfRows]; @@ -392,17 +391,13 @@ - (void)updateSections // Advanced - Section *advancedSection = [Section sectionWithTag:SECTION_ADVANCED]; - advancedSection.headerTitle = [VectorL10n securitySettingsAdvanced]; - if (RiotSettings.shared.settingsSecurityScreenShowAdvancedUnverifiedDevices) { + Section *advancedSection = [Section sectionWithTag:SECTION_ADVANCED]; + advancedSection.headerTitle = VectorL10n.securitySettingsAdvanced; + advancedSection.footerTitle = VectorL10n.securitySettingsBlacklistUnverifiedDevicesDescription; + [advancedSection addRowWithTag:ADVANCED_BLACKLIST_UNVERIFIED_DEVICES]; - [advancedSection addRowWithTag:ADVANCED_BLACKLIST_UNVERIFIED_DEVICES_DESCRIPTION]; - } - - if (advancedSection.rows.count) - { [sections addObject:advancedSection]; } @@ -1107,21 +1102,6 @@ - (UIImage*)shieldImageForDevice:(NSString*)deviceId return shieldImageForDevice; } - -- (MXKTableViewCell*)descriptionCellForTableView:(UITableView*)tableView withText:(NSString*)text -{ - MXKTableViewCell *cell = [self getDefaultTableViewCell:tableView]; - cell.textLabel.text = text; - cell.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; - cell.textLabel.textColor = ThemeService.shared.theme.headerTextPrimaryColor; - cell.textLabel.numberOfLines = 0; - cell.contentView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - - return cell; -} - - - (MXKTableViewCellWithTextView*)textViewCellForTableView:(UITableView*)tableView atIndexPath:(NSIndexPath *)indexPath { MXKTableViewCellWithTextView *textViewCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithTextView defaultReuseIdentifier] forIndexPath:indexPath]; @@ -1136,17 +1116,6 @@ - (MXKTableViewCellWithTextView*)textViewCellForTableView:(UITableView*)tableVie return textViewCell; } -- (MXKTableViewCell*)descriptionCellForTableView:(UITableView*)tableView atIndexPath:(NSIndexPath *)indexPath -{ - MXKTableViewCell *cell = [self getDefaultTableViewCell:tableView]; - cell.textLabel.textColor = ThemeService.shared.theme.textPrimaryColor; - cell.textLabel.numberOfLines = 0; - cell.contentView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - - return cell; -} - - (MXKTableViewCellWithButton *)buttonCellForTableView:(UITableView*)tableView atIndexPath:(NSIndexPath *)indexPath { MXKTableViewCellWithButton *cell = [self.tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithButton defaultReuseIdentifier] forIndexPath:indexPath]; @@ -1219,18 +1188,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.selectionStyle = UITableViewCellSelectionStyleNone; } - else if (rowTag == PIN_CODE_DESCRIPTION) - { - if ([PinCodePreferences shared].isPinSet) - { - cell = [self descriptionCellForTableView:tableView - withText:[VectorL10n pinProtectionSettingsSectionFooter]]; - } - else - { - cell = [self descriptionCellForTableView:tableView withText:nil]; - } - } else if (rowTag == PIN_CODE_CHANGE) { cell = [self buttonCellWithTitle:[VectorL10n pinProtectionSettingsChangePin] action:@selector(changePinCode:) forTableView:tableView atIndexPath:indexPath]; @@ -1249,32 +1206,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } else if (sectionTag == SECTION_CRYPTO_SESSIONS) { - if (self.showLoadingDevicesInformation) - { - if (rowTag == 0) - { - cell = [self descriptionCellForTableView:tableView - withText:[VectorL10n securitySettingsCryptoSessionsLoading]]; - } - else - { - cell = [self descriptionCellForTableView:tableView - withText:[VectorL10n securitySettingsCryptoSessionsDescription2]]; - } - } - else - { - if (rowTag < devicesArray.count) - { - cell = [self deviceCellWithDevice:devicesArray[rowTag] forTableView:tableView]; - } - else if (rowTag == devicesArray.count) - { - cell = [self descriptionCellForTableView:tableView - withText:[VectorL10n securitySettingsCryptoSessionsDescription2]]; - - } - } + cell = [self deviceCellWithDevice:devicesArray[rowTag] forTableView:tableView]; } else if (sectionTag == SECTION_SECURE_BACKUP) { @@ -1344,13 +1276,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = labelAndSwitchCell; break; } - case ADVANCED_BLACKLIST_UNVERIFIED_DEVICES_DESCRIPTION: - { - cell = [self descriptionCellForTableView:tableView - withText:[VectorL10n securitySettingsBlacklistUnverifiedDevicesDescription]]; - - break; - } } } @@ -1369,7 +1294,23 @@ - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view { // Customize label style UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view; - tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.headerTextPrimaryColor; + tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.colors.secondaryContent; + } +} + +- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section +{ + Section *tableSection = [self.tableViewSections sectionAtIndex:section]; + return tableSection.footerTitle; +} + +- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section +{ + if ([view isKindOfClass:UITableViewHeaderFooterView.class]) + { + // Customize label style + UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view; + tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.colors.secondaryContent; } } @@ -1402,19 +1343,19 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce } } -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section -{ - if (section == SECTION_CRYPTO_SESSIONS) - { - return 44; - } - return 24; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section -{ - return 24; -} +//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +//{ +// if (section == SECTION_CRYPTO_SESSIONS) +// { +// return 44; +// } +// return 24; +//} +// +//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +//{ +// return 24; +//} - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { @@ -1620,20 +1561,6 @@ - (MXKTableViewCellWithTextView *)settingsSecureBackupTableViewSection:(Settings return cell; } -- (MXKTableViewCell *)settingsSecureBackupTableViewSection:(SettingsSecureBackupTableViewSection *)settingsSecureBackupTableViewSection descriptionCellForRow:(NSInteger)textCellForRow -{ - MXKTableViewCell *cell; - - NSIndexPath *indexPath = [self.tableViewSections exactIndexPathForRowTag:textCellForRow sectionTag:SECTION_SECURE_BACKUP]; - - if (indexPath) - { - cell = [self descriptionCellForTableView:self.tableView atIndexPath:indexPath]; - } - - return cell; -} - - (MXKTableViewCellWithButton *)settingsSecureBackupTableViewSection:(SettingsSecureBackupTableViewSection *)settingsSecureBackupTableViewSection buttonCellForRow:(NSInteger)buttonCellForRow { MXKTableViewCellWithButton *cell; diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 2daa7c07cd..578fa0a64c 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -90,8 +90,7 @@ enum { - SENDING_MEDIA_CONFIRM_SIZE = 0, - SENDING_MEDIA_CONFIRM_SIZE_DESCRIPTION, + SENDING_MEDIA_CONFIRM_SIZE = 0 }; enum @@ -105,7 +104,6 @@ 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, NOTIFICATION_SETTINGS_PIN_UNREAD_INDEX, NOTIFICATION_SETTINGS_DEFAULT_SETTINGS_INDEX, @@ -115,20 +113,17 @@ enum { - CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX=0, - CALLS_STUN_SERVER_FALLBACK_DESCRIPTION_INDEX, + CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX = 0 }; enum { - INTEGRATIONS_INDEX, - INTEGRATIONS_DESCRIPTION_INDEX, + INTEGRATIONS_INDEX }; enum { LOCAL_CONTACTS_SYNC_INDEX, - LOCAL_CONTACTS_PHONEBOOK_COUNTRY_INDEX, - LOCAL_CONTACTS_SYNC_DESCRIPTION_INDEX + LOCAL_CONTACTS_PHONEBOOK_COUNTRY_INDEX }; enum @@ -139,8 +134,7 @@ enum { - IDENTITY_SERVER_INDEX, - IDENTITY_SERVER_DESCRIPTION_INDEX, + IDENTITY_SERVER_INDEX }; enum @@ -362,7 +356,11 @@ - (void)updateSections } if (BuildSettings.settingsScreenShowThreepidExplanatory) { - [sectionUserSettings addRowWithTag:USER_SETTINGS_THREEPIDS_INFORMATION_INDEX]; +#warning implement attributed string footers + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart1] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.textPrimaryColor}]; + [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart2] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.tintColor}]]; + [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart3] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.textPrimaryColor}]]; + sectionUserSettings.footerTitle = attributedString.string; } if (RiotSettings.shared.settingsScreenShowInviteFriends) { @@ -376,15 +374,15 @@ - (void)updateSections { Section *sectionMedia = [Section sectionWithTag:SECTION_TAG_SENDING_MEDIA]; [sectionMedia addRowWithTag:SENDING_MEDIA_CONFIRM_SIZE]; - [sectionMedia addRowWithTag:SENDING_MEDIA_CONFIRM_SIZE_DESCRIPTION]; sectionMedia.headerTitle = [VectorL10n settingsSendingMedia]; + sectionMedia.footerTitle = VectorL10n.settingsConfirmMediaSizeDescription; [tmpSections addObject:sectionMedia]; } Section *sectionLinks = [Section sectionWithTag:SECTION_TAG_LINKS]; [sectionLinks addRowWithTag:LINKS_SHOW_URL_PREVIEWS_INDEX]; - [sectionLinks addRowWithTag:LINKS_SHOW_URL_PREVIEWS_DESCRIPTION_INDEX]; sectionLinks.headerTitle = [VectorL10n settingsLinks]; + sectionLinks.footerTitle = VectorL10n.settingsShowUrlPreviewsDescription; [tmpSections addObject:sectionLinks]; Section *sectionSecurity = [Section sectionWithTag:SECTION_TAG_SECURITY]; @@ -401,9 +399,9 @@ - (void)updateSections } if (@available(iOS 14.0, *)) { - // Don't add Global settings message for iOS 14+ + // Don't display Global settings footer for iOS 14+ } else { - [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX]; + sectionNotificationSettings.footerTitle = [VectorL10n settingsGlobalSettingsInfo:AppInfo.current.displayName]; } [sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX]; @@ -420,21 +418,17 @@ - (void)updateSections sectionNotificationSettings.headerTitle = [VectorL10n settingsNotifications]; [tmpSections addObject:sectionNotificationSettings]; - if (BuildSettings.allowVoIPUsage && BuildSettings.stunServerFallbackUrlString) + if (BuildSettings.allowVoIPUsage && BuildSettings.stunServerFallbackUrlString && RiotSettings.shared.settingsScreenShowEnableStunServerFallback) { Section *sectionCalls = [Section sectionWithTag:SECTION_TAG_CALLS]; sectionCalls.headerTitle = [VectorL10n settingsCallsSettings]; - - if (RiotSettings.shared.settingsScreenShowEnableStunServerFallback) - { - [sectionCalls addRowWithTag:CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX]; - [sectionCalls addRowWithTag:CALLS_STUN_SERVER_FALLBACK_DESCRIPTION_INDEX]; - } - if (sectionCalls.rows.count) - { - [tmpSections addObject:sectionCalls]; - } + // Remove "stun:" + NSString* stunFallbackHost = [BuildSettings.stunServerFallbackUrlString componentsSeparatedByString:@":"].lastObject; + sectionCalls.footerTitle = [VectorL10n settingsCallsStunServerFallbackDescription:stunFallbackHost]; + + [sectionCalls addRowWithTag:CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX]; + [tmpSections addObject:sectionCalls]; } if (BuildSettings.settingsScreenShowDiscoverySettings) @@ -453,8 +447,9 @@ - (void)updateSections { Section *sectionIdentityServer = [Section sectionWithTag:SECTION_TAG_IDENTITY_SERVER]; [sectionIdentityServer addRowWithTag:IDENTITY_SERVER_INDEX]; - [sectionIdentityServer addRowWithTag:IDENTITY_SERVER_DESCRIPTION_INDEX]; + sectionIdentityServer.headerTitle = [VectorL10n settingsIdentityServerSettings]; + sectionIdentityServer.footerTitle = account.mxSession.identityService.identityServer ? VectorL10n.settingsIdentityServerDescription : VectorL10n.settingsIdentityServerNoIsDescription; [tmpSections addObject:sectionIdentityServer]; } @@ -466,12 +461,10 @@ - (void)updateSections { [sectionLocalContacts addRowWithTag:LOCAL_CONTACTS_PHONEBOOK_COUNTRY_INDEX]; } - else - { - [sectionLocalContacts addRowWithTag:LOCAL_CONTACTS_SYNC_DESCRIPTION_INDEX]; - } + NSString *headerTitle = UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPhone ? VectorL10n.settingsPhoneContacts : VectorL10n.settingsContacts; sectionLocalContacts.headerTitle = headerTitle; + sectionLocalContacts.footerTitle = VectorL10n.settingsContactsEnableSyncDescription; [tmpSections addObject:sectionLocalContacts]; } @@ -491,8 +484,12 @@ - (void)updateSections { Section *sectionIntegrations = [Section sectionWithTag:SECTION_TAG_INTEGRATIONS]; [sectionIntegrations addRowWithTag:INTEGRATIONS_INDEX]; - [sectionIntegrations addRowWithTag:INTEGRATIONS_DESCRIPTION_INDEX]; sectionIntegrations.headerTitle = [VectorL10n settingsIntegrations]; + + NSString *integrationManager = [WidgetManager.sharedManager configForUser:session.myUser.userId].apiUrl; + NSString *integrationManagerDomain = [NSURL URLWithString:integrationManager].host; + sectionIntegrations.footerTitle = [VectorL10n settingsIntegrationsAllowDescription:integrationManagerDomain]; + [tmpSections addObject:sectionIntegrations]; } @@ -1524,18 +1521,6 @@ - (MXKTableViewCell*)getDefaultTableViewCell:(UITableView*)tableView return cell; } -- (MXKTableViewCell*)descriptionCellForTableView:(UITableView*)tableView -{ - MXKTableViewCell *cell = [self getDefaultTableViewCell:tableView]; - cell.textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; - cell.textLabel.textColor = ThemeService.shared.theme.headerTextPrimaryColor; - cell.textLabel.numberOfLines = 0; - cell.contentView.backgroundColor = ThemeService.shared.theme.headerBackgroundColor; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - - return cell; -} - - (MXKTableViewCellWithTextView*)textViewCellForTableView:(UITableView*)tableView atIndexPath:(NSIndexPath *)indexPath { MXKTableViewCellWithTextView *textViewCell = [tableView dequeueReusableCellWithIdentifier:[MXKTableViewCellWithTextView defaultReuseIdentifier] forIndexPath:indexPath]; @@ -1838,21 +1823,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = newPhoneCell; } } - else if (row == USER_SETTINGS_THREEPIDS_INFORMATION_INDEX) - { - MXKTableViewCell *threePidsInformationCell = [self descriptionCellForTableView:self.tableView]; - - NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart1] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.textPrimaryColor}]; - [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart2] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.tintColor}]]; - [attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[VectorL10n settingsThreePidsManagementInformationPart3] attributes:@{NSForegroundColorAttributeName: ThemeService.shared.theme.textPrimaryColor}]]; - - threePidsInformationCell.textLabel.attributedText = attributedString; - threePidsInformationCell.textLabel.numberOfLines = 0; - - threePidsInformationCell.selectionStyle = UITableViewCellSelectionStyleNone; - - cell = threePidsInformationCell; - } else if (row == USER_SETTINGS_INVITE_FRIENDS_INDEX) { MXKTableViewCell *inviteFriendsCell = [self getDefaultTableViewCell:tableView]; @@ -1891,15 +1861,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = labelAndSwitchCell; } - else if (row == SENDING_MEDIA_CONFIRM_SIZE_DESCRIPTION) - { - MXKTableViewCell *infoCell = [self getDefaultTableViewCell:tableView]; - infoCell.textLabel.text = [VectorL10n settingsConfirmMediaSizeDescription]; - infoCell.textLabel.numberOfLines = 0; - infoCell.selectionStyle = UITableViewCellSelectionStyleNone; - - cell = infoCell; - } } else if (section == SECTION_TAG_LINKS) { @@ -1978,19 +1939,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = labelAndSwitchCell; } - else if (row == NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX) - { - MXKTableViewCell *globalInfoCell = [self descriptionCellForTableView:tableView]; - - NSString *appDisplayName = [[NSBundle mainBundle] infoDictionary][@"CFBundleDisplayName"]; - - globalInfoCell.textLabel.text = [VectorL10n settingsGlobalSettingsInfo:appDisplayName]; - globalInfoCell.textLabel.numberOfLines = 0; - - globalInfoCell.selectionStyle = UITableViewCellSelectionStyleNone; - - cell = globalInfoCell; - } else if (row == NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX) { MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath]; @@ -2046,19 +1994,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = labelAndSwitchCell; } - else if (row == CALLS_STUN_SERVER_FALLBACK_DESCRIPTION_INDEX) - { - NSString *stunFallbackHost = BuildSettings.stunServerFallbackUrlString; - // Remove "stun:" - stunFallbackHost = [stunFallbackHost componentsSeparatedByString:@":"].lastObject; - - MXKTableViewCell *globalInfoCell = [self descriptionCellForTableView:tableView]; - globalInfoCell.textLabel.text = [VectorL10n settingsCallsStunServerFallbackDescription:stunFallbackHost]; - globalInfoCell.textLabel.numberOfLines = 0; - globalInfoCell.selectionStyle = UITableViewCellSelectionStyleNone; - - cell = globalInfoCell; - } } else if (section == SECTION_TAG_DISCOVERY) { @@ -2085,25 +2020,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N break; } - case IDENTITY_SERVER_DESCRIPTION_INDEX: - { - MXKTableViewCell *descriptionCell = [self descriptionCellForTableView:tableView]; - - if (account.mxSession.identityService.identityServer) - { - descriptionCell.textLabel.text = [VectorL10n settingsIdentityServerDescription]; - } - else - { - descriptionCell.textLabel.text = [VectorL10n settingsIdentityServerNoIsDescription]; - } - descriptionCell.textLabel.numberOfLines = 0; - descriptionCell.selectionStyle = UITableViewCellSelectionStyleNone; - - cell = descriptionCell; - break; - } - default: break; } @@ -2126,22 +2042,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N break; } - case INTEGRATIONS_DESCRIPTION_INDEX: - { - MXKTableViewCell *descriptionCell = [self descriptionCellForTableView:tableView]; - - NSString *integrationManager = [WidgetManager.sharedManager configForUser:session.myUser.userId].apiUrl; - NSString *integrationManagerDomain = [NSURL URLWithString:integrationManager].host; - - NSString *description = [VectorL10n settingsIntegrationsAllowDescription:integrationManagerDomain]; - descriptionCell.textLabel.text = description; - descriptionCell.textLabel.numberOfLines = 0; - descriptionCell.selectionStyle = UITableViewCellSelectionStyleNone; - - cell = descriptionCell; - break; - } - default: break; } @@ -2245,15 +2145,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N [cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme]; cell.selectionStyle = UITableViewCellSelectionStyleDefault; } - else if (row == LOCAL_CONTACTS_SYNC_DESCRIPTION_INDEX) - { - MXKTableViewCell *descriptionCell = [self getDefaultTableViewCell:tableView]; - descriptionCell.textLabel.text = VectorL10n.settingsContactsEnableSyncDescription; - descriptionCell.textLabel.numberOfLines = 0; - descriptionCell.selectionStyle = UITableViewCellSelectionStyleNone; - - cell = descriptionCell; - } } else if (section == SECTION_TAG_ADVANCED) { @@ -2536,7 +2427,23 @@ - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view { // Customize label style UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view; - tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.headerTextPrimaryColor; + tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.colors.secondaryContent; + } +} + +- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section +{ + Section *sectionObj = [_tableViewSections sectionAtIndex:section]; + return sectionObj.footerTitle; +} + +- (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section +{ + if ([view isKindOfClass:UITableViewHeaderFooterView.class]) + { + // Customize label style + UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view; + tableViewHeaderFooterView.textLabel.textColor = ThemeService.shared.theme.colors.secondaryContent; } } @@ -2586,15 +2493,15 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce } } -- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section -{ - return 24; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section -{ - return 24; -} +//- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +//{ +// return 24; +//} +// +//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +//{ +// return [_tableViewSections sectionAtIndex:section].footerTitle ? UITableViewAutomaticDimension : 24; +//} - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {