From 2294e998fd713835e5f71c12d93a9ead0a50f7d6 Mon Sep 17 00:00:00 2001 From: Calvin Buckley Date: Mon, 8 Apr 2024 22:02:08 -0300 Subject: [PATCH] Remove unneeded singleton since SBApplication is supposed to own it --- Submariner/SBAppDelegate.swift | 9 --------- Submariner/SBPlayer.swift | 6 ++++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Submariner/SBAppDelegate.swift b/Submariner/SBAppDelegate.swift index 98a02c4..d6f17f5 100644 --- a/Submariner/SBAppDelegate.swift +++ b/Submariner/SBAppDelegate.swift @@ -14,15 +14,6 @@ fileprivate let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, catego @main @objc(SBAppDelegate) class SBAppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSUserInterfaceValidations { - // #MARK: - Singleton - - private static var _sharedInstance = SBAppDelegate() - - // FIXME: Make var - @objc static func sharedInstance() -> SBAppDelegate { - return _sharedInstance - } - // #MARK: - Initialization let databaseController: SBDatabaseController diff --git a/Submariner/SBPlayer.swift b/Submariner/SBPlayer.swift index a95cb56..f0fbf6a 100644 --- a/Submariner/SBPlayer.swift +++ b/Submariner/SBPlayer.swift @@ -411,8 +411,10 @@ extension NSNotification.Name { // Default, so not one of the buttons (if we have them or not) if response.actionIdentifier == UNNotificationDefaultActionIdentifier { DispatchQueue.main.async { - SBAppDelegate.sharedInstance().zoomDatabaseWindow(self) - SBAppDelegate.sharedInstance().goToCurrentTrack(self) + if let appDelegate = NSApp.delegate as? SBAppDelegate { + appDelegate.zoomDatabaseWindow(self) + appDelegate.goToCurrentTrack(self) + } } } else if response.actionIdentifier == "SubmarinerSkipAction" { self.next()