diff options
author | 2019-01-05 14:16:28 +0530 | |
---|---|---|
committer | 2019-01-14 14:52:32 +0530 | |
commit | 252d940d34484a9f0580d36ea29e44b9c1738561 (patch) | |
tree | d109b799326edf689cc378608c5824b006ce721e /WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift | |
parent | macOS: Manage tunnels: Remove tunnel (diff) | |
download | wireguard-apple-252d940d34484a9f0580d36ea29e44b9c1738561.tar.xz wireguard-apple-252d940d34484a9f0580d36ea29e44b9c1738561.zip |
macOS: Present errors as a sheet when applicable
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift b/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift index c83a339..69ea731 100644 --- a/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift +++ b/WireGuard/WireGuard/UI/macOS/ErrorPresenter.swift @@ -9,7 +9,15 @@ class ErrorPresenter: ErrorPresenterProtocol { alert.messageText = title alert.informativeText = message onPresented?() - alert.runModal() - onDismissal?() + if let sourceVC = sourceVC as? NSViewController { + NSApp.activate(ignoringOtherApps: true) + sourceVC.view.window!.makeKeyAndOrderFront(nil) + alert.beginSheetModal(for: sourceVC.view.window!) { _ in + onDismissal?() + } + } else { + alert.runModal() + onDismissal?() + } } } |