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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## 1.15.1 (2021-02-14) ## 1.15.1 (2021-02-14)
### Fixed ### Fixed

View File

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

View File

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

View File

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