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 opt = options[indexPath.row]
|
||||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
cell.leftText = descriptionBlock?(opt) ?? delegate?.optionController(self, descriptionFor: opt)
|
cell.leftText = descriptionBlock?(opt) ?? delegate?.optionController(self, descriptionFor: opt)
|
||||||
cell.accessoryType = (opt == selectedOption) ? .checkmark : .none
|
cell.applyChecked(opt == selectedOption, Theme.current)
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,13 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
extension UITableViewCell {
|
||||||
|
func applyChecked(_ checked: Bool, _ theme: Theme) {
|
||||||
|
accessoryType = checked ? .checkmark : .none
|
||||||
|
tintColor = Theme.current.palette.colorAction.withAlphaComponent(0.7)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension DestructiveTableViewCell {
|
extension DestructiveTableViewCell {
|
||||||
func apply(_ theme: Theme) {
|
func apply(_ theme: Theme) {
|
||||||
accessoryType = .none
|
accessoryType = .none
|
||||||
|
|
|
@ -211,9 +211,9 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate {
|
||||||
cell.accessoryType = .none
|
cell.accessoryType = .none
|
||||||
cell.isTappable = true
|
cell.isTappable = true
|
||||||
if let _ = currentAddress {
|
if let _ = currentAddress {
|
||||||
cell.accessoryType = .none
|
cell.applyChecked(false, Theme.current)
|
||||||
} else {
|
} else {
|
||||||
cell.accessoryType = .checkmark
|
cell.applyChecked(true, Theme.current)
|
||||||
currentAddressIndexPath = indexPath
|
currentAddressIndexPath = indexPath
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
|
@ -225,10 +225,10 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate {
|
||||||
cell.accessoryType = .none
|
cell.accessoryType = .none
|
||||||
cell.isTappable = true
|
cell.isTappable = true
|
||||||
if address == currentAddress {
|
if address == currentAddress {
|
||||||
cell.accessoryType = .checkmark
|
cell.applyChecked(true, Theme.current)
|
||||||
currentAddressIndexPath = indexPath
|
currentAddressIndexPath = indexPath
|
||||||
} else {
|
} else {
|
||||||
cell.accessoryType = .none
|
cell.applyChecked(false, Theme.current)
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
|
@ -238,9 +238,9 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate {
|
||||||
cell.accessoryType = .none
|
cell.accessoryType = .none
|
||||||
cell.isTappable = true
|
cell.isTappable = true
|
||||||
if let _ = currentProtocol {
|
if let _ = currentProtocol {
|
||||||
cell.accessoryType = .none
|
cell.applyChecked(false, Theme.current)
|
||||||
} else {
|
} else {
|
||||||
cell.accessoryType = .checkmark
|
cell.applyChecked(true, Theme.current)
|
||||||
currentProtocolIndexPath = indexPath
|
currentProtocolIndexPath = indexPath
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
|
@ -252,10 +252,10 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate {
|
||||||
cell.accessoryType = .none
|
cell.accessoryType = .none
|
||||||
cell.isTappable = true
|
cell.isTappable = true
|
||||||
if proto == currentProtocol {
|
if proto == currentProtocol {
|
||||||
cell.accessoryType = .checkmark
|
cell.applyChecked(true, Theme.current)
|
||||||
currentProtocolIndexPath = indexPath
|
currentProtocolIndexPath = indexPath
|
||||||
} else {
|
} else {
|
||||||
cell.accessoryType = .none
|
cell.applyChecked(false, Theme.current)
|
||||||
}
|
}
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,7 @@ extension OrganizerViewController {
|
||||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
let rowProfile = profile(at: indexPath)
|
let rowProfile = profile(at: indexPath)
|
||||||
cell.leftText = rowProfile.title
|
cell.leftText = rowProfile.title
|
||||||
cell.accessoryType = service.isActiveProfile(rowProfile) ? .checkmark : .none
|
cell.applyChecked(service.isActiveProfile(rowProfile), Theme.current)
|
||||||
return cell
|
return cell
|
||||||
|
|
||||||
case .addProvider:
|
case .addProvider:
|
||||||
|
|
|
@ -77,7 +77,7 @@ extension ProviderPoolViewController: UITableViewDataSource, UITableViewDelegate
|
||||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
cell.leftText = pool.name
|
cell.leftText = pool.name
|
||||||
// cell.rightText = pool.country
|
// cell.rightText = pool.country
|
||||||
cell.accessoryType = (pool.id == currentPoolId) ? .checkmark : .none
|
cell.applyChecked(pool.id == currentPoolId, Theme.current)
|
||||||
cell.isTappable = true
|
cell.isTappable = true
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ extension ProviderPresetViewController: UITableViewDataSource, UITableViewDelega
|
||||||
switch rows[indexPath.row] {
|
switch rows[indexPath.row] {
|
||||||
case .presetDescription:
|
case .presetDescription:
|
||||||
cell.leftText = preset.comment
|
cell.leftText = preset.comment
|
||||||
cell.accessoryType = (preset.id == currentPresetId) ? .checkmark : .none
|
cell.applyChecked(preset.id == currentPresetId, Theme.current)
|
||||||
|
|
||||||
case .techDetails:
|
case .techDetails:
|
||||||
cell.applyAction(Theme.current)
|
cell.applyAction(Theme.current)
|
||||||
|
|
Loading…
Reference in New Issue