Report .inactiveProfile on nil GracefulVPN.vpn
Methods: - reconnect - reinstall - disconnect
This commit is contained in:
parent
f50cf44bab
commit
29f34cd206
|
@ -31,4 +31,6 @@ enum ApplicationError: String, Error {
|
||||||
case missingCredentials
|
case missingCredentials
|
||||||
|
|
||||||
case migration
|
case migration
|
||||||
|
|
||||||
|
case inactiveProfile
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@ import SwiftyBeaver
|
||||||
|
|
||||||
private let log = SwiftyBeaver.self
|
private let log = SwiftyBeaver.self
|
||||||
|
|
||||||
// FIXME: replace completionHandler?(nil) with completionHandler?(some_error)
|
|
||||||
|
|
||||||
class GracefulVPN {
|
class GracefulVPN {
|
||||||
private let service: ConnectionService
|
private let service: ConnectionService
|
||||||
|
|
||||||
|
@ -70,7 +68,7 @@ class GracefulVPN {
|
||||||
func reconnect(completionHandler: ((Error?) -> Void)?) {
|
func reconnect(completionHandler: ((Error?) -> Void)?) {
|
||||||
service.clearVpnLastError()
|
service.clearVpnLastError()
|
||||||
guard let vpn = vpn else {
|
guard let vpn = vpn else {
|
||||||
completionHandler?(nil)
|
completionHandler?(ApplicationError.inactiveProfile)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
@ -84,7 +82,7 @@ class GracefulVPN {
|
||||||
func reinstall(completionHandler: ((Error?) -> Void)?) {
|
func reinstall(completionHandler: ((Error?) -> Void)?) {
|
||||||
service.clearVpnLastError()
|
service.clearVpnLastError()
|
||||||
guard let vpn = vpn else {
|
guard let vpn = vpn else {
|
||||||
completionHandler?(nil)
|
completionHandler?(ApplicationError.inactiveProfile)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
|
@ -109,7 +107,7 @@ class GracefulVPN {
|
||||||
|
|
||||||
func disconnect(completionHandler: ((Error?) -> Void)?) {
|
func disconnect(completionHandler: ((Error?) -> Void)?) {
|
||||||
guard let vpn = vpn else {
|
guard let vpn = vpn else {
|
||||||
completionHandler?(nil)
|
completionHandler?(ApplicationError.inactiveProfile)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
vpn.disconnect(completionHandler: completionHandler)
|
vpn.disconnect(completionHandler: completionHandler)
|
||||||
|
|
Loading…
Reference in New Issue