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.

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2019-03-29 00:02:54 +05:30
parent 0c2eb003a0
commit dd9506ecee
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)