On-Demand: TunnelViewModel: Make activate-on-demand methods static
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
465c22f769
commit
06a783f50a
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue