Update VPN toggle if disabling while "Inactive"

Due to trusted network.
This commit is contained in:
Davide De Rosa 2021-04-09 10:03:04 +02:00
parent 7b546ed930
commit ecc4c6f87e
4 changed files with 17 additions and 9 deletions

View File

@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 1.15.1 (2021-02-14)
### Fixed

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Prevent ineffective editing of trusted network SSID.
- VPN not being disabled when "Inactive" due to trusted network.
## 1.15.1 (2021-02-14)

View File

@ -421,11 +421,15 @@ class StatusMenu: NSObject {
}
@objc private func enableVPN() {
vpn.reconnect(completionHandler: nil)
vpn.reconnect { _ in
self.reloadVpnStatus()
}
}
@objc private func disableVPN() {
vpn.disconnect(completionHandler: nil)
vpn.disconnect { _ in
self.reloadVpnStatus()
}
}
@objc private func reconnectVPN() {

View File

@ -189,19 +189,20 @@ class ServiceViewController: NSViewController {
status = .disconnected
}
service.activateProfile(profile)
reloadVpnStatus()
switch status {
case .disconnected:
if !vpn.isEnabled {
guard !service.needsCredentials(for: uncheckedProfile) else {
isPendingConnection = true
perform(segue: StoryboardSegue.Service.accountSegueIdentifier)
return
}
vpn.reconnect(completionHandler: nil)
default:
vpn.disconnect(completionHandler: nil)
vpn.reconnect { _ in
self.reloadVpnStatus()
}
} else {
vpn.disconnect { _ in
self.reloadVpnStatus()
}
}
}