UI: Keep on-demand rules even if on-demand is disabled
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
1e9e21bacf
commit
abaf1f1454
|
@ -46,7 +46,7 @@ extension ActivateOnDemandOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
init(from tunnelProviderManager: NETunnelProviderManager) {
|
init(from tunnelProviderManager: NETunnelProviderManager) {
|
||||||
if tunnelProviderManager.isOnDemandEnabled, let onDemandRules = tunnelProviderManager.onDemandRules {
|
if let onDemandRules = tunnelProviderManager.onDemandRules {
|
||||||
self = ActivateOnDemandOption.create(from: onDemandRules)
|
self = ActivateOnDemandOption.create(from: onDemandRules)
|
||||||
} else {
|
} else {
|
||||||
self = .off
|
self = .off
|
||||||
|
|
|
@ -51,7 +51,6 @@ class ActivateOnDemandViewModel {
|
||||||
extension ActivateOnDemandViewModel {
|
extension ActivateOnDemandViewModel {
|
||||||
convenience init(tunnel: TunnelContainer) {
|
convenience init(tunnel: TunnelContainer) {
|
||||||
self.init()
|
self.init()
|
||||||
if tunnel.isActivateOnDemandEnabled {
|
|
||||||
switch tunnel.onDemandOption {
|
switch tunnel.onDemandOption {
|
||||||
case .off:
|
case .off:
|
||||||
break
|
break
|
||||||
|
@ -66,7 +65,6 @@ extension ActivateOnDemandViewModel {
|
||||||
(ssidOption, selectedSSIDs) = ssidViewModel(from: onDemandSSIDOption)
|
(ssidOption, selectedSSIDs) = ssidViewModel(from: onDemandSSIDOption)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func toOnDemandOption() -> ActivateOnDemandOption {
|
func toOnDemandOption() -> ActivateOnDemandOption {
|
||||||
switch (isWiFiInterfaceEnabled, isNonWiFiInterfaceEnabled) {
|
switch (isWiFiInterfaceEnabled, isNonWiFiInterfaceEnabled) {
|
||||||
|
|
Loading…
Reference in New Issue