mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-03-04 04:32:02 +00:00
On-Demand: Move detail text to TunnelViewModel
This commit is contained in:
parent
8227e77111
commit
4f98330bc0
@ -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