Commit 51b5410c authored by Jose Blaya's avatar Jose Blaya
Browse files

wait until remove the vpn profile

parent 0d21680d
......@@ -155,14 +155,17 @@ class DefaultVPNProvider: VPNProvider, ConfigurationAccess, DatabaseAccess, Pref
!((profile.vpnType == IPSecProfile.vpnType || profile.vpnType == IKEv2Profile.vpnType) &&
(previousProfile.vpnType == IPSecProfile.vpnType || previousProfile.vpnType == IKEv2Profile.vpnType)) {
//only remove the profile if is not Ipsec or IKEv2, if are one of them, override instead
previousProfile.remove(nil)
previousProfile.remove({ _ in
Macros.postNotification(.PIAVPNDidInstall)
callback?(nil)
})
} else {
if let previousProfile = previousProfile { // dont connect after install
self.connect(nil)
Macros.postNotification(.PIAVPNDidInstall)
callback?(nil)
}
}
Macros.postNotification(.PIAVPNDidInstall)
callback?(nil)
}
}
......
......@@ -148,6 +148,7 @@ public class PIATunnelProfile: NetworkExtensionProfile {
public func remove(_ callback: SuccessLibraryCallback?) {
find { (vpn, error) in
guard let vpn = vpn else {
callback?(nil)
return
}
vpn.removeFromPreferences(completionHandler: callback)
......
......@@ -222,6 +222,7 @@ public class PIAWGTunnelProfile: NetworkExtensionProfile {
public func remove(_ callback: SuccessLibraryCallback?) {
find { (vpn, error) in
guard let vpn = vpn else {
callback?(nil)
return
}
vpn.removeFromPreferences(completionHandler: callback)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment