diff --git a/core/BookmarksCore/Common/BookmarksManager.swift b/core/BookmarksCore/Common/BookmarksManager.swift index e935045f..e760612a 100644 --- a/core/BookmarksCore/Common/BookmarksManager.swift +++ b/core/BookmarksCore/Common/BookmarksManager.swift @@ -50,13 +50,12 @@ public class BookmarksManager { thumbnailManager = ThumbnailManager(imageCache: imageCache, downloadManager: downloadManager) updater = Updater(store: store, token: settings.pinboardApiKey) - #if targetEnvironment(macCatalyst) + #if os(macOS) let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(nsApplicationDidBecomeActive), name: NSNotification.Name("NSApplicationDidBecomeActiveNotification"), object: nil) #endif - } @objc diff --git a/macos/Bookmarks/BookmarksApp.swift b/macos/Bookmarks/BookmarksApp.swift index 7a3c1ede..4ed4479d 100644 --- a/macos/Bookmarks/BookmarksApp.swift +++ b/macos/Bookmarks/BookmarksApp.swift @@ -23,29 +23,17 @@ import SwiftUI import BookmarksCore -class AppDelegate: NSObject, NSApplicationDelegate { - - var manager = BookmarksManager() - - func applicationDidBecomeActive(_ notification: Notification) { - manager.updater.start() - } -} - @main struct BookmarksApp: App { - @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate @Environment(\.manager) var manager: BookmarksManager var body: some Scene { WindowGroup { ContentView(store: manager.store) - .environment(\.manager, appDelegate.manager) } SwiftUI.Settings { SettingsView() - .environment(\.manager, appDelegate.manager) } } }