Convert restoreWindow to async await.

This commit is contained in:
Brent Simmons 2024-05-05 16:49:49 -07:00
parent 178cba34ad
commit 4b381daa92

View File

@ -980,14 +980,14 @@ extension AppDelegate : ScriptingAppDelegate {
extension AppDelegate: NSWindowRestoration { extension AppDelegate: NSWindowRestoration {
@objc static func restoreWindow(withIdentifier identifier: NSUserInterfaceItemIdentifier, state: NSCoder, completionHandler: @escaping (NSWindow?, Error?) -> Void) { @objc static func restoreWindow(withIdentifier identifier: NSUserInterfaceItemIdentifier, state: NSCoder) async throws -> NSWindow {
var mainWindow: NSWindow? = nil var mainWindow: NSWindow? = nil
if identifier.rawValue == WindowRestorationIdentifiers.mainWindow { if identifier.rawValue == WindowRestorationIdentifiers.mainWindow {
mainWindow = appDelegate.createAndShowMainWindow().window mainWindow = appDelegate.createAndShowMainWindow().window
} }
completionHandler(mainWindow, nil) return mainWindow
} }
} }
// Handle Notification Actions // Handle Notification Actions