Reload VPN status after building menu

This commit is contained in:
Davide De Rosa 2021-02-02 20:50:54 +01:00
parent 445249f670
commit dedbfe9d6d
1 changed files with 2 additions and 8 deletions

View File

@ -102,6 +102,7 @@ class StatusMenu: NSObject {
self.rebuild()
self.statusItem.menu = self.menu
self.service.delegate = self
self.reloadVpnStatus()
}
}
@ -234,7 +235,7 @@ class StatusMenu: NSObject {
itemsProfile.append(itemMissingCredentials)
}
updateUIWithVPNStatus()
reloadVpnStatus()
if !needsCredentials, let providerProfile = profile as? ProviderConnectionProfile {
@ -525,13 +526,6 @@ class StatusMenu: NSObject {
// MARK: Helpers
private func reloadVpnStatus() {
guard service.hasActiveProfile() else {
return
}
updateUIWithVPNStatus()
}
private func updateUIWithVPNStatus() {
if vpn.isEnabled {
itemToggleVPN.title = L10n.App.Service.Cells.Vpn.TurnOff.caption
itemToggleVPN.action = #selector(disableVPN)