Add status tooltip with profile name
This commit is contained in:
parent
e1d2370564
commit
e833f64faf
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -215,10 +215,11 @@ class StatusMenu: NSObject {
|
||||||
itemToggleVPN = nil
|
itemToggleVPN = nil
|
||||||
itemReconnectVPN = nil
|
itemReconnectVPN = nil
|
||||||
statusItem.button?.image = imageStatusInactive
|
statusItem.button?.image = imageStatusInactive
|
||||||
|
statusItem.button?.toolTip = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
let profileTitle = service.screenTitle(ProfileKey(profile))
|
||||||
itemProfileName?.title = service.screenTitle(ProfileKey(profile))
|
itemProfileName?.title = profileTitle
|
||||||
// itemProfileName?.image = profile.image
|
// itemProfileName?.image = profile.image
|
||||||
|
|
||||||
let needsCredentials = service.needsCredentials(for: profile)
|
let needsCredentials = service.needsCredentials(for: profile)
|
||||||
|
@ -548,6 +549,12 @@ class StatusMenu: NSObject {
|
||||||
itemToggleVPN?.title = L10n.App.Service.Cells.Vpn.TurnOn.caption
|
itemToggleVPN?.title = L10n.App.Service.Cells.Vpn.TurnOn.caption
|
||||||
itemToggleVPN?.action = #selector(enableVPN)
|
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
|
||||||
|
}
|
||||||
|
|
||||||
switch vpn.status ?? .disconnected {
|
switch vpn.status ?? .disconnected {
|
||||||
case .connected:
|
case .connected:
|
||||||
|
|
Loading…
Reference in New Issue