Apply accent color to accessory checkmarks
This commit is contained in:
parent
92f6c68ec0
commit
5c0738b136
|
@ -64,7 +64,7 @@ class OptionViewController<T: Hashable>: 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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue