diff --git a/Passepartout-iOS/Global/OptionViewController.swift b/Passepartout-iOS/Global/OptionViewController.swift index 56a32f7b..94c64501 100644 --- a/Passepartout-iOS/Global/OptionViewController.swift +++ b/Passepartout-iOS/Global/OptionViewController.swift @@ -64,7 +64,7 @@ class OptionViewController: UIViewController, UITableViewDataSource let opt = options[indexPath.row] let cell = Cells.setting.dequeue(from: tableView, for: indexPath) cell.leftText = descriptionBlock?(opt) ?? delegate?.optionController(self, descriptionFor: opt) - cell.accessoryType = (opt == selectedOption) ? .checkmark : .none + cell.applyChecked(opt == selectedOption, Theme.current) return cell } diff --git a/Passepartout-iOS/Global/Theme+Cells.swift b/Passepartout-iOS/Global/Theme+Cells.swift index dd951a13..3afaa488 100644 --- a/Passepartout-iOS/Global/Theme+Cells.swift +++ b/Passepartout-iOS/Global/Theme+Cells.swift @@ -25,6 +25,13 @@ import UIKit +extension UITableViewCell { + func applyChecked(_ checked: Bool, _ theme: Theme) { + accessoryType = checked ? .checkmark : .none + tintColor = Theme.current.palette.colorAction.withAlphaComponent(0.7) + } +} + extension DestructiveTableViewCell { func apply(_ theme: Theme) { accessoryType = .none diff --git a/Passepartout-iOS/Scenes/EndpointViewController.swift b/Passepartout-iOS/Scenes/EndpointViewController.swift index 31a2f41e..6488aed3 100644 --- a/Passepartout-iOS/Scenes/EndpointViewController.swift +++ b/Passepartout-iOS/Scenes/EndpointViewController.swift @@ -211,9 +211,9 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate { cell.accessoryType = .none cell.isTappable = true if let _ = currentAddress { - cell.accessoryType = .none + cell.applyChecked(false, Theme.current) } else { - cell.accessoryType = .checkmark + cell.applyChecked(true, Theme.current) currentAddressIndexPath = indexPath } return cell @@ -225,10 +225,10 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate { cell.accessoryType = .none cell.isTappable = true if address == currentAddress { - cell.accessoryType = .checkmark + cell.applyChecked(true, Theme.current) currentAddressIndexPath = indexPath } else { - cell.accessoryType = .none + cell.applyChecked(false, Theme.current) } return cell @@ -238,9 +238,9 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate { cell.accessoryType = .none cell.isTappable = true if let _ = currentProtocol { - cell.accessoryType = .none + cell.applyChecked(false, Theme.current) } else { - cell.accessoryType = .checkmark + cell.applyChecked(true, Theme.current) currentProtocolIndexPath = indexPath } return cell @@ -252,10 +252,10 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate { cell.accessoryType = .none cell.isTappable = true if proto == currentProtocol { - cell.accessoryType = .checkmark + cell.applyChecked(true, Theme.current) currentProtocolIndexPath = indexPath } else { - cell.accessoryType = .none + cell.applyChecked(false, Theme.current) } return cell } diff --git a/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift b/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift index 580a6f6b..70116780 100644 --- a/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift @@ -289,7 +289,7 @@ extension OrganizerViewController { let cell = Cells.setting.dequeue(from: tableView, for: indexPath) let rowProfile = profile(at: indexPath) cell.leftText = rowProfile.title - cell.accessoryType = service.isActiveProfile(rowProfile) ? .checkmark : .none + cell.applyChecked(service.isActiveProfile(rowProfile), Theme.current) return cell case .addProvider: diff --git a/Passepartout-iOS/Scenes/ProviderPoolViewController.swift b/Passepartout-iOS/Scenes/ProviderPoolViewController.swift index fb3346a7..81c1f6be 100644 --- a/Passepartout-iOS/Scenes/ProviderPoolViewController.swift +++ b/Passepartout-iOS/Scenes/ProviderPoolViewController.swift @@ -77,7 +77,7 @@ extension ProviderPoolViewController: UITableViewDataSource, UITableViewDelegate let cell = Cells.setting.dequeue(from: tableView, for: indexPath) cell.leftText = pool.name // cell.rightText = pool.country - cell.accessoryType = (pool.id == currentPoolId) ? .checkmark : .none + cell.applyChecked(pool.id == currentPoolId, Theme.current) cell.isTappable = true return cell } diff --git a/Passepartout-iOS/Scenes/ProviderPresetViewController.swift b/Passepartout-iOS/Scenes/ProviderPresetViewController.swift index 4f534590..f50bc8da 100644 --- a/Passepartout-iOS/Scenes/ProviderPresetViewController.swift +++ b/Passepartout-iOS/Scenes/ProviderPresetViewController.swift @@ -108,7 +108,7 @@ extension ProviderPresetViewController: UITableViewDataSource, UITableViewDelega switch rows[indexPath.row] { case .presetDescription: cell.leftText = preset.comment - cell.accessoryType = (preset.id == currentPresetId) ? .checkmark : .none + cell.applyChecked(preset.id == currentPresetId, Theme.current) case .techDetails: cell.applyAction(Theme.current)