macOS: If a sheet is being shown, ignore quit and bring window to front

Otherwise, the 'exiting with an active tunnel' alert could get queued up
to be shown after the current sheet is dismissed.
This commit is contained in:
Roopesh Chander 2019-03-29 00:02:54 +05:30
parent c714e424dc
commit b5025b51cd
1 changed files with 5 additions and 0 deletions

View File

@ -44,6 +44,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
@objc func quit() {
if let manageWindow = manageTunnelsWindowObject, manageWindow.attachedSheet != nil {
NSApp.activate(ignoringOtherApps: true)
manageWindow.orderFront(self)
return
}
registerLoginItem(shouldLaunchAtLogin: false)
guard let currentTunnel = tunnelsTracker?.currentTunnel, currentTunnel.status == .active || currentTunnel.status == .activating else {
NSApp.terminate(nil)