On-Demand: TunnelViewModel: Make activate-on-demand methods static

This commit is contained in:
Roopesh Chander 2018-12-08 00:54:58 +05:30
parent 4f98330bc0
commit 3af543a352
2 changed files with 4 additions and 4 deletions

View File

@ -451,7 +451,7 @@ class TunnelViewModel {
// MARK: Activate on demand
extension TunnelViewModel {
func activateOnDemandOptionText(for activateOnDemandOption: ActivateOnDemandOption) -> String {
static func activateOnDemandOptionText(for activateOnDemandOption: ActivateOnDemandOption) -> String {
switch (activateOnDemandOption) {
case .none:
return "Off"
@ -476,7 +476,7 @@ extension TunnelViewModel {
}
}
func defaultActivateOnDemandOption() -> ActivateOnDemandOption {
static func defaultActivateOnDemandOption() -> ActivateOnDemandOption {
return .useOnDemandOverWiFiOrCellular
}

View File

@ -389,7 +389,7 @@ extension TunnelEditTableViewController {
if (isOn) {
s.activateOnDemandSetting.isActivateOnDemandEnabled = true
if (s.activateOnDemandSetting.activateOnDemandOption == .none) {
s.activateOnDemandSetting.activateOnDemandOption = s.tunnelViewModel.defaultActivateOnDemandOption()
s.activateOnDemandSetting.activateOnDemandOption = TunnelViewModel.defaultActivateOnDemandOption()
}
s.tableView.insertRows(at: indexPaths, with: .automatic)
} else {
@ -404,7 +404,7 @@ extension TunnelEditTableViewController {
let rowOption = activateOnDemandOptions[row - 1]
let selectedOption = activateOnDemandSetting.activateOnDemandOption
assert(selectedOption != .none)
cell.message = tunnelViewModel.activateOnDemandOptionText(for: rowOption)
cell.message = TunnelViewModel.activateOnDemandOptionText(for: rowOption)
cell.isChecked = (selectedOption == rowOption)
return cell
}