UI: Keep on-demand rules even if on-demand is disabled

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2021-07-28 02:10:45 +05:30
parent 1e9e21bacf
commit abaf1f1454
2 changed files with 13 additions and 15 deletions

View File

@ -46,7 +46,7 @@ extension ActivateOnDemandOption {
}
init(from tunnelProviderManager: NETunnelProviderManager) {
if tunnelProviderManager.isOnDemandEnabled, let onDemandRules = tunnelProviderManager.onDemandRules {
if let onDemandRules = tunnelProviderManager.onDemandRules {
self = ActivateOnDemandOption.create(from: onDemandRules)
} else {
self = .off

View File

@ -51,7 +51,6 @@ class ActivateOnDemandViewModel {
extension ActivateOnDemandViewModel {
convenience init(tunnel: TunnelContainer) {
self.init()
if tunnel.isActivateOnDemandEnabled {
switch tunnel.onDemandOption {
case .off:
break
@ -66,7 +65,6 @@ extension ActivateOnDemandViewModel {
(ssidOption, selectedSSIDs) = ssidViewModel(from: onDemandSSIDOption)
}
}
}
func toOnDemandOption() -> ActivateOnDemandOption {
switch (isWiFiInterfaceEnabled, isNonWiFiInterfaceEnabled) {