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,9 +200,13 @@ public class IntentDispatcher {
public static func handleDisableVPN(_ intent: DisableVPNIntent, interaction: INInteraction?, completionHandler: ((Error?) -> Void)?) {
log.info("Disabling VPN...")
VPN.shared.disconnect { (error) in
notifyServiceUpdate()
completionHandler?(error)
let vpn = VPN.shared
vpn.prepare {
vpn.disconnect { (error) in
notifyServiceUpdate()
completionHandler?(error)
}
}
}