VPN: Fix deletion of tunnels
This commit is contained in:
parent
1e7fa2390d
commit
4e36ed43c0
|
@ -9,6 +9,7 @@ protocol TunnelsManagerDelegate: class {
|
||||||
func tunnelAdded(at: Int)
|
func tunnelAdded(at: Int)
|
||||||
func tunnelModified(at: Int)
|
func tunnelModified(at: Int)
|
||||||
func tunnelsChanged()
|
func tunnelsChanged()
|
||||||
|
func tunnelRemoved(at: Int)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TunnelsManagerError: Error {
|
enum TunnelsManagerError: Error {
|
||||||
|
@ -145,7 +146,7 @@ class TunnelsManager {
|
||||||
|
|
||||||
tunnelProviderManager.removeFromPreferences { [weak self] (error) in
|
tunnelProviderManager.removeFromPreferences { [weak self] (error) in
|
||||||
defer { self?.isDeletingTunnel = false }
|
defer { self?.isDeletingTunnel = false }
|
||||||
guard (error != nil) else {
|
guard (error == nil) else {
|
||||||
completionHandler(error)
|
completionHandler(error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -154,6 +155,7 @@ class TunnelsManager {
|
||||||
s.tunnels[i].index = s.tunnels[i].index + 1
|
s.tunnels[i].index = s.tunnels[i].index + 1
|
||||||
}
|
}
|
||||||
s.tunnels.remove(at: tunnelIndex)
|
s.tunnels.remove(at: tunnelIndex)
|
||||||
|
s.delegate?.tunnelRemoved(at: tunnelIndex)
|
||||||
}
|
}
|
||||||
completionHandler(nil)
|
completionHandler(nil)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue