]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
On-Demand: TunnelViewModel: Make activate-on-demand methods static
authorRoopesh Chander <roop@roopc.net>
Fri, 7 Dec 2018 19:24:58 +0000 (00:54 +0530)
committerRoopesh Chander <roop@roopc.net>
Fri, 7 Dec 2018 20:47:23 +0000 (02:17 +0530)
Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/WireGuard/UI/TunnelViewModel.swift
WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift

index 2a3f36b0f0553a99c52731e06c68ff504562b261..de14ad5adbe4d215b33b258e7b365ccf622318d4 100644 (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
     }
 
index c110d7383abb460690180f0dca61e436ab146f85..6b737fe1dc9ecc2a02cfe8586a08aac38315c55a 100644 (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
             }