Use theme accent for cell checkmarks

Probably a regression after Convenience integration.
This commit is contained in:
Davide De Rosa 2019-10-25 19:28:49 +02:00
parent a82ee1939b
commit 03649b56f3
5 changed files with 22 additions and 5 deletions

View File

@ -89,7 +89,7 @@ class IssueReporter: NSObject {
}
}
vc.mailComposeDelegate = self
vc.apply(Theme.current)
vc.apply(.current)
viewController?.present(vc, animated: true, completion: nil)
}
}

View File

@ -26,11 +26,20 @@
import UIKit
import TunnelKit
import PassepartoutCore
import Convenience
extension UITableViewCell {
func applyChecked(_ checked: Bool, _ theme: Theme) {
accessoryType = checked ? .checkmark : .none
tintColor = Theme.current.palette.accessory
tintColor = theme.palette.accessory
}
}
extension SingleOptionViewController {
func applyTint(_ theme: Theme) {
configurationBlock = { (cell, _) in
cell.tintColor = theme.palette.accessory
}
}
}

View File

@ -315,6 +315,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
switch model.row(at: indexPath) {
case .cipher:
let vc = SingleOptionViewController<OpenVPN.Cipher>()
vc.applyTint(Theme.current)
vc.title = settingCell?.leftText
vc.options = OpenVPN.Cipher.available
vc.selectedOption = configuration.cipher
@ -327,6 +328,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case .digest:
let vc = SingleOptionViewController<OpenVPN.Digest>()
vc.applyTint(Theme.current)
vc.title = settingCell?.leftText
vc.options = OpenVPN.Digest.available
vc.selectedOption = configuration.digest
@ -339,6 +341,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case .compressionFraming:
let vc = SingleOptionViewController<OpenVPN.CompressionFraming>()
vc.applyTint(Theme.current)
vc.title = settingCell?.leftText
vc.options = OpenVPN.CompressionFraming.available
vc.selectedOption = configuration.compressionFraming ?? .disabled
@ -358,6 +361,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
}
let vc = SingleOptionViewController<OpenVPN.CompressionAlgorithm>()
vc.applyTint(Theme.current)
vc.title = settingCell?.leftText
vc.options = OpenVPN.CompressionAlgorithm.available
vc.selectedOption = configuration.compressionAlgorithm ?? .disabled

View File

@ -480,10 +480,11 @@ extension NetworkSettingsViewController {
switch model.row(at: indexPath) {
case .gateway:
let vc = SingleOptionViewController<NetworkChoice>()
vc.applyTint(Theme.current)
vc.title = (cell as? SettingTableViewCell)?.leftText
vc.options = NetworkChoice.choices(for: profile)
vc.descriptionBlock = { $0.description }
vc.selectedOption = networkChoices.gateway
vc.selectionBlock = { [weak self] in
self?.updateGateway($0)
@ -493,10 +494,11 @@ extension NetworkSettingsViewController {
case .dns:
let vc = SingleOptionViewController<NetworkChoice>()
vc.applyTint(Theme.current)
vc.title = (cell as? SettingTableViewCell)?.leftText
vc.options = NetworkChoice.choices(for: profile)
vc.descriptionBlock = { $0.description }
vc.selectedOption = networkChoices.dns
vc.selectionBlock = { [weak self] in
self?.updateDNS($0)
@ -506,10 +508,11 @@ extension NetworkSettingsViewController {
case .proxy:
let vc = SingleOptionViewController<NetworkChoice>()
vc.applyTint(Theme.current)
vc.title = (cell as? SettingTableViewCell)?.leftText
vc.options = NetworkChoice.choices(for: profile)
vc.descriptionBlock = { $0.description }
vc.selectedOption = networkChoices.proxy
vc.selectionBlock = { [weak self] in
self?.updateProxy($0)

View File

@ -151,6 +151,7 @@ extension ProviderPoolViewController: UITableViewDataSource, UITableViewDelegate
return
}
let vc = SingleOptionViewController<Pool>()
vc.applyTint(Theme.current)
vc.title = group.localizedCountry
vc.options = group.pools.sorted {
guard let lnum = $0.num else {