Prepare before disconnection intent

manager is nil otherwise in connect/disconnect.

Doesn't apply to reinstall/reconnect.
This commit is contained in:
Davide De Rosa 2019-03-19 17:57:51 +01:00
parent af51911536
commit 3bf340c74c
1 changed files with 7 additions and 3 deletions

View File

@ -200,11 +200,15 @@ public class IntentDispatcher {
public static func handleDisableVPN(_ intent: DisableVPNIntent, interaction: INInteraction?, completionHandler: ((Error?) -> Void)?) {
log.info("Disabling VPN...")
VPN.shared.disconnect { (error) in
let vpn = VPN.shared
vpn.prepare {
vpn.disconnect { (error) in
notifyServiceUpdate()
completionHandler?(error)
}
}
}
public static func handleCurrentNetwork(trust: Bool, interaction: INInteraction?, completionHandler: ((Error?) -> Void)?) {
guard let currentWifi = Utils.currentWifiNetworkName() else {