Fix logic to activate first created profile
Broken in dec7fb9030
VPN was lost when app was sent to background. Current (and active)
profile was persisted with nil isActive and instead of ignoring
profile activation, isActive was falling back to
allHeaders.isEmpty (false), erroneously deactivating the profile
and disconnecting the VPN.
This commit is contained in:
parent
9195d426e4
commit
b183dece8c
|
@ -175,18 +175,21 @@ extension DefaultProfileManager {
|
|||
assertionFailure("Placeholder")
|
||||
return
|
||||
}
|
||||
|
||||
let isActive = isActive ?? allHeaders.isEmpty
|
||||
|
||||
pp_log.info("Writing profile \(profile.logDescription) to persistent store")
|
||||
strategy.saveProfile(profile)
|
||||
|
||||
if isActive {
|
||||
pp_log.info("\tActivating profile...")
|
||||
if let isActive = isActive {
|
||||
if isActive {
|
||||
pp_log.info("\tActivating profile...")
|
||||
activeProfileId = profile.id
|
||||
} else if activeProfileId == profile.id {
|
||||
pp_log.info("\tDeactivating profile...")
|
||||
activeProfileId = nil
|
||||
}
|
||||
} else if allHeaders.isEmpty {
|
||||
pp_log.info("\tActivating first profile...")
|
||||
activeProfileId = profile.id
|
||||
} else if activeProfileId == profile.id {
|
||||
pp_log.info("\tDeactivating profile...")
|
||||
activeProfileId = nil
|
||||
}
|
||||
|
||||
// IMPORTANT: refresh live copy if just saved (e.g. via intents)
|
||||
|
|
Loading…
Reference in New Issue