@@ -29,38 +29,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
2929 button. image = NSImage ( named: " statusIcon " )
3030 button. image? . template = true // sets the icon to inverted color for dark mode
3131 button. action = Selector ( " quitClicked: " )
32-
3332 statusItem. menu = statusMenu
3433 }
3534
36- // Set up Spotify listeners
37- NSUserNotificationCenter . defaultUserNotificationCenter ( ) . delegate = spotifyHelper
3835 // Set observer to when Spotify state changes
39- NSDistributedNotificationCenter . defaultCenter ( ) . addObserver ( spotifyHelper. self,
40- selector: " spotifyStateChanged: " ,
41- name: Client . Spotify. rawValue + " . " + PlaybackChanged. Spotify. rawValue,
42- object: nil ,
43- suspensionBehavior: NSNotificationSuspensionBehavior . DeliverImmediately)
44- NSDistributedNotificationCenter . defaultCenter ( ) . addObserver ( self ,
45- selector: " togglePlayPauseText: " ,
46- name: Client . Spotify. rawValue + " . " + PlaybackChanged. Spotify. rawValue,
47- object: nil ,
48- suspensionBehavior: NSNotificationSuspensionBehavior . DeliverImmediately)
49-
50- // Set up iTunes listeners
51- NSUserNotificationCenter . defaultUserNotificationCenter ( ) . delegate = itunesHelper
52- // Set observer to when Spotify state changes
53- NSDistributedNotificationCenter . defaultCenter ( ) . addObserver ( itunesHelper. self,
54- selector: " iTunesStateChanged: " ,
55- name: Client . iTunes. rawValue + " . " + PlaybackChanged. iTunes. rawValue,
56- object: nil ,
57- suspensionBehavior: NSNotificationSuspensionBehavior . DeliverImmediately)
58- NSDistributedNotificationCenter . defaultCenter ( ) . addObserver ( self ,
59- selector: " togglePlayPauseText: " ,
60- name: Client . iTunes. rawValue + " . " + PlaybackChanged. iTunes. rawValue,
61- object: nil ,
62- suspensionBehavior: NSNotificationSuspensionBehavior . DeliverImmediately)
36+ SystemHelper . addObserver ( spotifyHelper, selector: " spotifyStateChanged: " , client: . Spotify, event: . Spotify)
37+ SystemHelper . addObserver ( self , selector: " togglePlayPauseText: " , client: . Spotify, event: . Spotify)
6338
39+ // Set observer to when iTunes state changes
40+ SystemHelper . addObserver ( itunesHelper, selector: " iTunesStateChanged: " , client: . iTunes, event: . iTunes)
41+ SystemHelper . addObserver ( self , selector: " togglePlayPauseText: " , client: . iTunes, event: . iTunes)
6442 }
6543
6644 func applicationWillTerminate( aNotification: NSNotification ) {
0 commit comments