From 19c0072d4cc4db256e117c7cc33e5e6f8d655f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20A=2E=20A=CC=81lvarez?= Date: Mon, 4 Mar 2024 21:12:40 +0100 Subject: [PATCH] fix quick actions --- Mini vMac/AppDelegate.m | 2 +- Mini vMac/DefaultSceneDelegate.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Mini vMac/AppDelegate.m b/Mini vMac/AppDelegate.m index 34a9000..3e63dc0 100644 --- a/Mini vMac/AppDelegate.m +++ b/Mini vMac/AppDelegate.m @@ -189,7 +189,7 @@ NSString *DocumentsChangedNotification = @"documentsChanged"; - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL))completionHandler { BOOL success = NO; - if ([shortcutItem.type isEqualToString:@"disk"] && sharedEmulator.isRunning) { + if ([shortcutItem.type isEqualToString:@"disk"]) { NSString *fileName = (NSString*)shortcutItem.userInfo[@"disk"]; NSString *filePath = [self.documentsPath stringByAppendingPathComponent:fileName]; if ([[NSFileManager defaultManager] fileExistsAtPath:filePath] && ![sharedEmulator isDiskInserted:filePath]) { diff --git a/Mini vMac/DefaultSceneDelegate.swift b/Mini vMac/DefaultSceneDelegate.swift index 83d54a7..d556abe 100644 --- a/Mini vMac/DefaultSceneDelegate.swift +++ b/Mini vMac/DefaultSceneDelegate.swift @@ -42,4 +42,8 @@ class DefaultSceneDelegate: UIResponder, UIWindowSceneDelegate { func sceneDidBecomeActive(_ scene: UIScene) { AppDelegate.emulator.isRunning = true } + + func windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) { + AppDelegate.shared.application(UIApplication.shared, performActionFor: shortcutItem, completionHandler: completionHandler) + } }