Skip to content

Commit

Permalink
Use actual footer titles rather than cells that mimic them.
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Oct 15, 2021
1 parent 62bbe88 commit 5204154
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 305 deletions.
1 change: 1 addition & 0 deletions Riot/Modules/Common/Models/Section.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -39,7 +38,6 @@ import UIKit

private enum BackupRows {
case info(text: String)
case description(text: String)
case createSecureBackupAction
case resetSecureBackupAction
case createKeyBackupAction
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -165,17 +158,15 @@ 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
backupRows = [
.info(text: VectorL10n.securitySettingsSecureBackupInfoValid),
.restoreFromKeyBackupAction(keyBackupVersion: keyBackupVersion, title: VectorL10n.securitySettingsSecureBackupRestore),
.deleteKeyBackupAction(keyBackupVersion: keyBackupVersion),
.resetSecureBackupAction,
.description(text: VectorL10n.securitySettingsSecureBackupDescription)
.resetSecureBackupAction
]
}
}
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit 5204154

Please sign in to comment.