Merge branch 'improve-status-item'

This commit is contained in:
Davide De Rosa 2021-01-26 11:28:54 +01:00
commit e66d344491
3 changed files with 31 additions and 2 deletions

View File

@ -154,3 +154,21 @@ extension DNSProtocol: CustomStringConvertible {
}
}
}
extension VPNStatus: UIDescriptible {
public var uiDescription: String {
switch self {
case .connecting:
return L10n.Core.Vpn.connecting
case .connected:
return L10n.Core.Vpn.active
case .disconnecting:
return L10n.Core.Vpn.disconnecting
case .disconnected:
return L10n.Core.Vpn.inactive
}
}
}

View File

@ -11,11 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Country flags in provider infrastructure menu.
- Support DNS over HTTPS/TLS in "Network settings". [#91](https://github.com/passepartoutvpn/passepartout-apple/issues/91)
- Menu tooltip describing active profile and status.
### Changed
- Rendering of provider infrastructures.
- Rendering of profile configuration.
- Color-blind friendly menu icon.
### Fixed

View File

@ -215,10 +215,11 @@ class StatusMenu: NSObject {
itemToggleVPN = nil
itemReconnectVPN = nil
statusItem.button?.image = imageStatusInactive
statusItem.button?.toolTip = nil
return
}
itemProfileName?.title = service.screenTitle(ProfileKey(profile))
let profileTitle = service.screenTitle(ProfileKey(profile))
itemProfileName?.title = profileTitle
// itemProfileName?.image = profile.image
let needsCredentials = service.needsCredentials(for: profile)
@ -548,6 +549,13 @@ class StatusMenu: NSObject {
itemToggleVPN?.title = L10n.App.Service.Cells.Vpn.TurnOn.caption
itemToggleVPN?.action = #selector(enableVPN)
}
if let profile = service.activeProfile {
let profileTitle = service.screenTitle(ProfileKey(profile))
statusItem.button?.toolTip = "\(GroupConstants.App.name)\n\(profileTitle)\n\((vpn.status ?? .disconnected).uiDescription)"
} else {
statusItem.button?.toolTip = nil
}
statusItem.button?.alphaValue = 1.0
switch vpn.status ?? .disconnected {
case .connected:
@ -560,6 +568,7 @@ class StatusMenu: NSObject {
case .disconnected:
statusItem.button?.image = imageStatusInactive
statusItem.button?.alphaValue = 0.5
case .disconnecting:
statusItem.button?.image = imageStatusInProgress