Commit e64d4866 authored by Jose Blaya's avatar Jose Blaya
Browse files

Merge branch 'feature/Manually_Connecting_to_Trusted_network_requires_2_taps' into 'release/2.8.2'

Feature/manually connecting to trusted network requires 2 taps

See merge request ios/client-library-apple!255
parents e7baece0 7f952bb1
......@@ -30,6 +30,7 @@ class VPNDaemon: Daemon, DatabaseAccess, ProvidersAccess {
static let shared = VPNDaemon()
private(set) var hasEnabledUpdates: Bool
private var timer: Timer!
private init() {
hasEnabledUpdates = false
......@@ -61,10 +62,24 @@ class VPNDaemon: Daemon, DatabaseAccess, ProvidersAccess {
switch connection.status {
case .connected:
nextStatus = .connected
timer.invalidate()
case .connecting, .reasserting:
nextStatus = .connecting
let previousStatus = accessedDatabase.transient.vpnStatus
if nextStatus != previousStatus {
timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: true) { timer in
let status = NEVPNManager.shared().connection.status
if status == .invalid {
log.debug("NEVPNManager connection is invalid. Reconnecting...")
Client.providers.vpnProvider.reconnect(after: nil, forceDisconnect: true, { error in
timer.invalidate()
})
}
}
}
case .disconnecting:
nextStatus = .disconnecting
......
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