macOS: Present errors as a sheet when applicable

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander
2019-01-05 14:16:28 +05:30
parent efb64b1959
commit 252d940d34
@@ -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?()
}
}
}