diff --git a/Mac/Scripting/AppDelegate+Scriptability.swift b/Mac/Scripting/AppDelegate+Scriptability.swift index d48d78c93..3769b819d 100644 --- a/Mac/Scripting/AppDelegate+Scriptability.swift +++ b/Mac/Scripting/AppDelegate+Scriptability.swift @@ -65,16 +65,17 @@ extension AppDelegate: AppDelegateAppleEvents { return } - do { - try ArticleThemeDownloader.shared.handleFile(at: location) - } catch { - NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) + Task { @MainActor in + do { + try ArticleThemeDownloader.shared.handleFile(at: location) + } catch { + NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) + } } } task.resume() } return - } // Special case URL with specific scheme handler x-netnewswire-feed: intended to ensure we open diff --git a/iOS/SceneDelegate.swift b/iOS/SceneDelegate.swift index 7f27b2d82..b03aed97b 100644 --- a/iOS/SceneDelegate.swift +++ b/iOS/SceneDelegate.swift @@ -206,10 +206,12 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let location = location else { return } - do { - try ArticleThemeDownloader.shared.handleFile(at: location) - } catch { - NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) + Task { @MainActor in + do { + try ArticleThemeDownloader.shared.handleFile(at: location) + } catch { + NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error]) + } } } task.resume()