UI: When saving on-demand rules on a config, enable on-demand if active
When a user saves on-demand rules on the configuration, set onDemandEnabled to true if the tunnel is active, and false if it isn't. Then deactivate the tunnel. Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
@@ -42,7 +42,9 @@ extension ActivateOnDemandOption {
|
||||
}
|
||||
}
|
||||
tunnelProviderManager.onDemandRules = rules
|
||||
tunnelProviderManager.isOnDemandEnabled = false
|
||||
let status = tunnelProviderManager.connection.status
|
||||
let isActive = status == .connected || status == .connecting
|
||||
tunnelProviderManager.isOnDemandEnabled = (rules != nil) && (tunnelProviderManager.isOnDemandEnabled || isActive)
|
||||
}
|
||||
|
||||
init(from tunnelProviderManager: NETunnelProviderManager) {
|
||||
|
||||
Reference in New Issue
Block a user