Use .current instead of Theme.current

Class name is redundant for static members.
This commit is contained in:
Davide De Rosa 2019-10-25 19:30:21 +02:00
parent 03649b56f3
commit b5710cd84b
20 changed files with 62 additions and 62 deletions

View File

@ -39,7 +39,7 @@ extension ActivityTableViewCell {
func dequeue(from tableView: UITableView, for indexPath: IndexPath) -> ActivityTableViewCell {
let cell = tableView.dequeue(T.self, identifier: Provider.identifier, for: indexPath)
cell.apply(Theme.current)
cell.apply(.current)
cell.activityIndicator.startAnimating()
cell.accessoryView = cell.activityIndicator
cell.selectionStyle = .none

View File

@ -68,7 +68,7 @@ extension DestructiveTableViewCell {
func dequeue(from tableView: UITableView, for indexPath: IndexPath) -> DestructiveTableViewCell {
let cell = tableView.dequeue(T.self, identifier: Provider.identifier, for: indexPath)
cell.apply(Theme.current)
cell.apply(.current)
return cell
}
}

View File

@ -130,7 +130,7 @@ extension FieldTableViewCell {
func dequeue(from tableView: UITableView, for indexPath: IndexPath) -> FieldTableViewCell {
let cell = tableView.dequeue(T.self, identifier: Provider.identifier, for: indexPath)
cell.apply(Theme.current)
cell.apply(.current)
return cell
}
}

View File

@ -79,7 +79,7 @@ extension SettingTableViewCell {
func dequeue(from tableView: UITableView, for indexPath: IndexPath) -> SettingTableViewCell {
let cell = tableView.dequeue(T.self, identifier: Provider.identifier, for: indexPath)
cell.apply(Theme.current)
cell.apply(.current)
cell.imageView?.image = nil
cell.rightText = nil
cell.isTappable = true

View File

@ -97,13 +97,13 @@ extension ToggleTableViewCell {
func dequeue(from tableView: UITableView, for indexPath: IndexPath) -> ToggleTableViewCell {
let cell = tableView.dequeue(T.self, identifier: Provider.identifier, for: indexPath)
cell.apply(Theme.current)
cell.apply(.current)
return cell
}
func dequeue(from tableView: UITableView, for indexPath: IndexPath, tag: Int, delegate: ToggleTableViewCellDelegate) -> ToggleTableViewCell {
let cell = tableView.dequeue(T.self, identifier: Provider.identifier, for: indexPath)
cell.apply(Theme.current)
cell.apply(.current)
cell.tag = tag
cell.delegate = delegate
return cell

View File

@ -56,7 +56,7 @@ class AboutViewController: UITableViewController, StrongTableHost {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {

View File

@ -40,16 +40,16 @@ class LabelViewController: UIViewController {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {
super.viewDidLoad()
activity?.hidesWhenStopped = true
activity?.applyAccent(Theme.current)
scrollView?.applyPrimaryBackground(Theme.current)
label?.applyLight(Theme.current)
activity?.applyAccent(.current)
scrollView?.applyPrimaryBackground(.current)
label?.applyLight(.current)
if let license = license {

View File

@ -39,7 +39,7 @@ class VersionViewController: UIViewController {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {
@ -50,9 +50,9 @@ class VersionViewController: UIViewController {
labelVersion?.text = ApplicationInfo.appVersion
labelIntro?.text = L10n.Core.Version.Labels.intro
scrollView?.applyPrimaryBackground(Theme.current)
scrollView?.applyPrimaryBackground(.current)
for label in [labelTitle, labelVersion, labelIntro] {
label?.applyLight(Theme.current)
label?.applyLight(.current)
}
}
}

View File

@ -137,7 +137,7 @@ class AccountViewController: UIViewController, StrongTableHost {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {
@ -264,7 +264,7 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie
case .openGuide:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Core.Account.Cells.OpenGuide.caption
cell.applyAction(Theme.current)
cell.applyAction(.current)
return cell
case .signUp:
@ -273,7 +273,7 @@ extension AccountViewController: UITableViewDataSource, UITableViewDelegate, Fie
}
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.leftText = L10n.Core.Account.Cells.Signup.caption(name.rawValue)
cell.applyAction(Theme.current)
cell.applyAction(.current)
return cell
}
}

View File

@ -93,7 +93,7 @@ class ConfigurationViewController: UIViewController, StrongTableHost {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {
@ -246,7 +246,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case .resetOriginal:
cell.leftText = V.ResetOriginal.caption
cell.applyAction(Theme.current)
cell.applyAction(.current)
case .client:
cell.leftText = V.Client.caption
@ -315,7 +315,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
switch model.row(at: indexPath) {
case .cipher:
let vc = SingleOptionViewController<OpenVPN.Cipher>()
vc.applyTint(Theme.current)
vc.applyTint(.current)
vc.title = settingCell?.leftText
vc.options = OpenVPN.Cipher.available
vc.selectedOption = configuration.cipher
@ -328,7 +328,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case .digest:
let vc = SingleOptionViewController<OpenVPN.Digest>()
vc.applyTint(Theme.current)
vc.applyTint(.current)
vc.title = settingCell?.leftText
vc.options = OpenVPN.Digest.available
vc.selectedOption = configuration.digest
@ -341,7 +341,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
case .compressionFraming:
let vc = SingleOptionViewController<OpenVPN.CompressionFraming>()
vc.applyTint(Theme.current)
vc.applyTint(.current)
vc.title = settingCell?.leftText
vc.options = OpenVPN.CompressionFraming.available
vc.selectedOption = configuration.compressionFraming ?? .disabled
@ -361,7 +361,7 @@ extension ConfigurationViewController: UITableViewDataSource, UITableViewDelegat
}
let vc = SingleOptionViewController<OpenVPN.CompressionAlgorithm>()
vc.applyTint(Theme.current)
vc.applyTint(.current)
vc.title = settingCell?.leftText
vc.options = OpenVPN.CompressionAlgorithm.available
vc.selectedOption = configuration.compressionAlgorithm ?? .disabled

View File

@ -41,7 +41,7 @@ class DebugLogViewController: UIViewController {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
// MARK: UIViewController

View File

@ -94,7 +94,7 @@ class EndpointViewController: UIViewController, StrongTableHost {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {
@ -213,9 +213,9 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate {
cell.accessoryType = .none
cell.isTappable = true
if let _ = currentAddress {
cell.applyChecked(false, Theme.current)
cell.applyChecked(false, .current)
} else {
cell.applyChecked(true, Theme.current)
cell.applyChecked(true, .current)
currentAddressIndexPath = indexPath
}
return cell
@ -227,10 +227,10 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate {
cell.accessoryType = .none
cell.isTappable = true
if address == currentAddress {
cell.applyChecked(true, Theme.current)
cell.applyChecked(true, .current)
currentAddressIndexPath = indexPath
} else {
cell.applyChecked(false, Theme.current)
cell.applyChecked(false, .current)
}
return cell
@ -240,9 +240,9 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate {
cell.accessoryType = .none
cell.isTappable = true
if let _ = currentProtocol {
cell.applyChecked(false, Theme.current)
cell.applyChecked(false, .current)
} else {
cell.applyChecked(true, Theme.current)
cell.applyChecked(true, .current)
currentProtocolIndexPath = indexPath
}
return cell
@ -254,10 +254,10 @@ extension EndpointViewController: UITableViewDataSource, UITableViewDelegate {
cell.accessoryType = .none
cell.isTappable = true
if proto == currentProtocol {
cell.applyChecked(true, Theme.current)
cell.applyChecked(true, .current)
currentProtocolIndexPath = indexPath
} else {
cell.applyChecked(false, Theme.current)
cell.applyChecked(false, .current)
}
return cell
}

View File

@ -387,7 +387,7 @@ extension NetworkSettingsViewController {
case .dnsAddAddress:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.NetworkSettings.Cells.AddDnsServer.caption
return cell
@ -408,7 +408,7 @@ extension NetworkSettingsViewController {
case .dnsAddDomain:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.NetworkSettings.Cells.AddDnsDomain.caption
return cell
@ -468,7 +468,7 @@ extension NetworkSettingsViewController {
case .proxyAddBypass:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.NetworkSettings.Cells.AddProxyBypass.caption
return cell
}
@ -480,7 +480,7 @@ extension NetworkSettingsViewController {
switch model.row(at: indexPath) {
case .gateway:
let vc = SingleOptionViewController<NetworkChoice>()
vc.applyTint(Theme.current)
vc.applyTint(.current)
vc.title = (cell as? SettingTableViewCell)?.leftText
vc.options = NetworkChoice.choices(for: profile)
vc.descriptionBlock = { $0.description }
@ -494,7 +494,7 @@ extension NetworkSettingsViewController {
case .dns:
let vc = SingleOptionViewController<NetworkChoice>()
vc.applyTint(Theme.current)
vc.applyTint(.current)
vc.title = (cell as? SettingTableViewCell)?.leftText
vc.options = NetworkChoice.choices(for: profile)
vc.descriptionBlock = { $0.description }
@ -508,7 +508,7 @@ extension NetworkSettingsViewController {
case .proxy:
let vc = SingleOptionViewController<NetworkChoice>()
vc.applyTint(Theme.current)
vc.applyTint(.current)
vc.title = (cell as? SettingTableViewCell)?.leftText
vc.options = NetworkChoice.choices(for: profile)
vc.descriptionBlock = { $0.description }

View File

@ -103,7 +103,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
override func awakeFromNib() {
super.awakeFromNib()
applyMasterTitle(Theme.current)
applyMasterTitle(.current)
}
override func viewDidLoad() {
@ -251,7 +251,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
vc.setSubject(subject)
vc.setMessageBody(body, isHTML: false)
vc.mailComposeDelegate = self
vc.apply(Theme.current)
vc.apply(.current)
present(vc, animated: true, completion: nil)
}
@ -426,7 +426,7 @@ extension OrganizerViewController {
switch model.row(at: indexPath) {
case .connectionStatus:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyVPN(Theme.current, with: VPN.shared.isEnabled ? VPN.shared.status : nil, error: nil)
cell.applyVPN(.current, with: VPN.shared.isEnabled ? VPN.shared.status : nil, error: nil)
cell.leftText = L10n.Core.Service.Cells.ConnectionStatus.caption
return cell
@ -444,19 +444,19 @@ extension OrganizerViewController {
case .addProvider:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.Organizer.Cells.AddProvider.caption
return cell
case .addHost:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.Organizer.Cells.AddHost.caption
return cell
case .siriShortcuts:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.Core.Organizer.Cells.SiriShortcuts.caption
return cell

View File

@ -207,7 +207,7 @@ extension WizardHostViewController {
cell.caption = L10n.App.Wizards.Host.Cells.TitleInput.caption
cell.captionWidth = 100.0
cell.allowedCharset = .filename
cell.field.applyProfileId(Theme.current)
cell.field.applyProfileId(.current)
cell.delegate = self
return cell

View File

@ -67,7 +67,7 @@ class ProviderPoolViewController: UIViewController {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {
@ -151,7 +151,7 @@ extension ProviderPoolViewController: UITableViewDataSource, UITableViewDelegate
return
}
let vc = SingleOptionViewController<Pool>()
vc.applyTint(Theme.current)
vc.applyTint(.current)
vc.title = group.localizedCountry
vc.options = group.pools.sorted {
guard let lnum = $0.num else {

View File

@ -48,7 +48,7 @@ class ProviderPresetViewController: UIViewController {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {
@ -109,10 +109,10 @@ extension ProviderPresetViewController: UITableViewDataSource, UITableViewDelega
switch rows[indexPath.row] {
case .presetDescription:
cell.leftText = preset.comment
cell.applyChecked(preset.id == currentPresetId, Theme.current)
cell.applyChecked(preset.id == currentPresetId, .current)
case .techDetails:
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.Provider.Preset.Cells.TechDetails.caption
cell.accessoryType = .none
}

View File

@ -116,7 +116,7 @@ class ServerNetworkViewController: UITableViewController, StrongTableHost {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {

View File

@ -90,7 +90,7 @@ class ServiceViewController: UIViewController, StrongTableHost {
override func awakeFromNib() {
super.awakeFromNib()
applyDetailTitle(Theme.current)
applyDetailTitle(.current)
}
override func viewDidLoad() {
@ -109,7 +109,7 @@ class ServiceViewController: UIViewController, StrongTableHost {
navigationItem.leftItemsSupplementBackButton = true
labelWelcome.text = L10n.Core.Service.Welcome.message
labelWelcome.apply(Theme.current)
labelWelcome.apply(.current)
let nc = NotificationCenter.default
nc.addObserver(self, selector: #selector(applicationDidBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil)
@ -234,7 +234,7 @@ class ServiceViewController: UIViewController, StrongTableHost {
let alert = UIAlertController.asAlert(L10n.Core.Service.Alerts.Rename.title, L10n.Core.Global.Host.TitleInput.message)
alert.addTextField { (field) in
field.text = self.profile?.id
field.applyProfileId(Theme.current)
field.applyProfileId(.current)
field.delegate = self
}
pendingRenameAction = alert.addPreferredAction(L10n.Core.Global.ok) {
@ -775,7 +775,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
switch row {
case .useProfile:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.Service.Cells.UseProfile.caption
return cell
@ -795,7 +795,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
}
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyVPN(Theme.current, with: vpn.isEnabled ? vpn.status : nil, error: service.vpnLastError)
cell.applyVPN(.current, with: vpn.isEnabled ? vpn.status : nil, error: service.vpnLastError)
cell.leftText = L10n.Core.Service.Cells.ConnectionStatus.caption
cell.accessoryType = .none
cell.isTappable = false
@ -803,7 +803,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
case .reconnect:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.Core.Service.Cells.Reconnect.caption
cell.accessoryType = .none
cell.isTappable = !service.needsCredentials(for: uncheckedProfile) && vpn.isEnabled
@ -850,7 +850,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
case .providerRefresh:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.Service.Cells.Provider.Refresh.caption
return cell
@ -896,7 +896,7 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
case .trustedAddCurrentWiFi:
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.Service.Cells.TrustedAddWifi.caption
return cell

View File

@ -186,12 +186,12 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
guard let wrapper = wrappers?[indexPath.row] else {
break
}
cell.apply(Theme.current)
cell.apply(.current)
cell.leftText = wrapper.phrase
cell.rightText = wrapper.intentDescription
case .addShortcut:
cell.applyAction(Theme.current)
cell.applyAction(.current)
cell.leftText = L10n.App.Shortcuts.Edit.Cells.AddShortcut.caption
cell.accessoryType = .none
cell.isTappable = true