mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-01-18 22:39:08 +00:00
On-Demand: Move detail text to TunnelViewModel
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
b7e5638681
commit
465c22f769
@ -464,6 +464,18 @@ extension TunnelViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
static func activateOnDemandDetailText(for activateOnDemandSetting: ActivateOnDemandSetting?) -> String {
|
||||
if let activateOnDemandSetting = activateOnDemandSetting {
|
||||
if (activateOnDemandSetting.isActivateOnDemandEnabled) {
|
||||
return TunnelViewModel.activateOnDemandOptionText(for: activateOnDemandSetting.activateOnDemandOption)
|
||||
} else {
|
||||
return TunnelViewModel.activateOnDemandOptionText(for: .none)
|
||||
}
|
||||
} else {
|
||||
return TunnelViewModel.activateOnDemandOptionText(for: .none)
|
||||
}
|
||||
}
|
||||
|
||||
func defaultActivateOnDemandOption() -> ActivateOnDemandOption {
|
||||
return .useOnDemandOverWiFiOrCellular
|
||||
}
|
||||
|
@ -426,26 +426,7 @@ class TunnelDetailTableViewActivateOnDemandCell: UITableViewCell {
|
||||
}
|
||||
|
||||
func update(from activateOnDemandSetting: ActivateOnDemandSetting?) {
|
||||
let detailText: String
|
||||
if let activateOnDemandSetting = activateOnDemandSetting {
|
||||
if (activateOnDemandSetting.isActivateOnDemandEnabled) {
|
||||
switch (activateOnDemandSetting.activateOnDemandOption) {
|
||||
case .none:
|
||||
detailText = "Off"
|
||||
case .useOnDemandOverWiFiOrCellular:
|
||||
detailText = "Wi-Fi or cellular"
|
||||
case .useOnDemandOverWiFiOnly:
|
||||
detailText = "Wi-Fi only"
|
||||
case .useOnDemandOverCellularOnly:
|
||||
detailText = "Cellular only"
|
||||
}
|
||||
} else {
|
||||
detailText = "Off"
|
||||
}
|
||||
} else {
|
||||
detailText = "Off"
|
||||
}
|
||||
detailTextLabel?.text = detailText
|
||||
detailTextLabel?.text = TunnelViewModel.activateOnDemandDetailText(for: activateOnDemandSetting)
|
||||
}
|
||||
|
||||
override func prepareForReuse() {
|
||||
|
Loading…
Reference in New Issue
Block a user