mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-17 22:19:08 +00:00
Fix similar completionHandler bugs
See previous commit
This commit is contained in:
parent
9a67918dc0
commit
877dd4d990
@ -91,19 +91,23 @@ public class StandardVPNProvider: VPNProvider {
|
||||
fatalError("Not a NetworkExtensionVPNConfiguration")
|
||||
}
|
||||
find(with: bundleIdentifier) {
|
||||
self.manager = $0
|
||||
self.manager?.protocolConfiguration = configuration.protocolConfiguration
|
||||
self.manager?.onDemandRules = configuration.onDemandRules
|
||||
self.manager?.isOnDemandEnabled = true
|
||||
self.manager?.isEnabled = true
|
||||
self.manager?.saveToPreferences { (error) in
|
||||
guard let manager = $0 else {
|
||||
completionHandler?(nil)
|
||||
return
|
||||
}
|
||||
self.manager = manager
|
||||
manager.protocolConfiguration = configuration.protocolConfiguration
|
||||
manager.onDemandRules = configuration.onDemandRules
|
||||
manager.isOnDemandEnabled = true
|
||||
manager.isEnabled = true
|
||||
manager.saveToPreferences { (error) in
|
||||
guard error == nil else {
|
||||
self.manager?.isOnDemandEnabled = false
|
||||
self.manager?.isEnabled = false
|
||||
manager.isOnDemandEnabled = false
|
||||
manager.isEnabled = false
|
||||
completionHandler?(error)
|
||||
return
|
||||
}
|
||||
self.manager?.loadFromPreferences { (error) in
|
||||
manager.loadFromPreferences { (error) in
|
||||
completionHandler?(error)
|
||||
}
|
||||
}
|
||||
@ -153,8 +157,12 @@ public class StandardVPNProvider: VPNProvider {
|
||||
|
||||
public func uninstall(completionHandler: (() -> Void)?) {
|
||||
find(with: bundleIdentifier) { (manager) in
|
||||
manager?.connection.stopVPNTunnel()
|
||||
manager?.removeFromPreferences { (error) in
|
||||
guard let manager = manager else {
|
||||
completionHandler?()
|
||||
return
|
||||
}
|
||||
manager.connection.stopVPNTunnel()
|
||||
manager.removeFromPreferences { (error) in
|
||||
self.manager = nil
|
||||
completionHandler?()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user