1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-08 04:20:07 +02:00

🏗 Preparing for additional refactoring

This commit is contained in:
2022-02-17 19:23:23 +01:00
parent 9468a2e9f8
commit 634ffb4c57
2 changed files with 5 additions and 1 deletions

View File

@ -7,7 +7,9 @@
import Cocoa import Cocoa
@available(*, deprecated, message: "Use BetterAlert API instead for 5.1 and above") #warning("This deprecated class should be removed at the earliest convenience once no code relies on it.")
@available(*, deprecated, message: "Use the BetterAlert API instead")
class Alert { class Alert {
public static func present( public static func present(
@ -17,6 +19,7 @@ class Alert {
secondButtonTitle: String = "", secondButtonTitle: String = "",
style: NSAlert.Style = .informational style: NSAlert.Style = .informational
) -> Bool { ) -> Bool {
if !Thread.isMainThread { if !Thread.isMainThread {
fatalError("You should always present alerts on the main thread!") fatalError("You should always present alerts on the main thread!")
} }

View File

@ -82,6 +82,7 @@ class BetterAlert {
If you wish to simply show the alert and disregard the outcome, use `show`. If you wish to simply show the alert and disregard the outcome, use `show`.
*/ */
public func runModal() -> NSApplication.ModalResponse { public func runModal() -> NSApplication.ModalResponse {
#warning("You should be alerted if this is not being called on the main thread.")
NSApp.activate(ignoringOtherApps: true) NSApp.activate(ignoringOtherApps: true)
windowController.window?.makeKeyAndOrderFront(nil) windowController.window?.makeKeyAndOrderFront(nil)
return NSApplication.shared.runModal(for: windowController.window!) return NSApplication.shared.runModal(for: windowController.window!)