mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
Completely rejigger preferences system to use ReSwift
This commit is contained in:
parent
8882c4246c
commit
22bb7efef2
@ -17,7 +17,6 @@
|
|||||||
E408D3BE220E03EE0006D9BE /* RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E408D3BD220E03EE0006D9BE /* RawRepresentable.swift */; };
|
E408D3BE220E03EE0006D9BE /* RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E408D3BD220E03EE0006D9BE /* RawRepresentable.swift */; };
|
||||||
E408D3C2220E134F0006D9BE /* AlbumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E408D3C1220E134F0006D9BE /* AlbumViewController.swift */; };
|
E408D3C2220E134F0006D9BE /* AlbumViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E408D3C1220E134F0006D9BE /* AlbumViewController.swift */; };
|
||||||
E408D3CB220E341D0006D9BE /* AlbumViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = E408D3C9220E341D0006D9BE /* AlbumViewItem.xib */; };
|
E408D3CB220E341D0006D9BE /* AlbumViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = E408D3C9220E341D0006D9BE /* AlbumViewItem.xib */; };
|
||||||
E40F41F3221EDE27004B6CB8 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = E40F41F2221EDE27004B6CB8 /* Preferences.swift */; };
|
|
||||||
E40FE71B221B904300A4223F /* NSEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = E40FE71A221B904300A4223F /* NSEvent.swift */; };
|
E40FE71B221B904300A4223F /* NSEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = E40FE71A221B904300A4223F /* NSEvent.swift */; };
|
||||||
E419E2872249B96600216A8C /* Song.swift in Sources */ = {isa = PBXBuildFile; fileRef = E419E2862249B96600216A8C /* Song.swift */; };
|
E419E2872249B96600216A8C /* Song.swift in Sources */ = {isa = PBXBuildFile; fileRef = E419E2862249B96600216A8C /* Song.swift */; };
|
||||||
E41B22C621FB932700D544F6 /* MPDClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = E41B22C521FB932700D544F6 /* MPDClient.swift */; };
|
E41B22C621FB932700D544F6 /* MPDClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = E41B22C521FB932700D544F6 /* MPDClient.swift */; };
|
||||||
@ -39,6 +38,7 @@
|
|||||||
E435E3E2221CD4E200184CFC /* NSFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = E435E3E1221CD4E200184CFC /* NSFont.swift */; };
|
E435E3E2221CD4E200184CFC /* NSFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = E435E3E1221CD4E200184CFC /* NSFont.swift */; };
|
||||||
E435E3E4221CD75D00184CFC /* NSImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = E435E3E3221CD75D00184CFC /* NSImage.swift */; };
|
E435E3E4221CD75D00184CFC /* NSImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = E435E3E3221CD75D00184CFC /* NSImage.swift */; };
|
||||||
E439109822640213002982E9 /* SongNotifierService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E439109722640213002982E9 /* SongNotifierService.swift */; };
|
E439109822640213002982E9 /* SongNotifierService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E439109722640213002982E9 /* SongNotifierService.swift */; };
|
||||||
|
E4405192227644340090CD6F /* MPDServerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4405191227644340090CD6F /* MPDServerController.swift */; };
|
||||||
E450AD7E222620A10091BED3 /* Album.swift in Sources */ = {isa = PBXBuildFile; fileRef = E450AD7D222620A10091BED3 /* Album.swift */; };
|
E450AD7E222620A10091BED3 /* Album.swift in Sources */ = {isa = PBXBuildFile; fileRef = E450AD7D222620A10091BED3 /* Album.swift */; };
|
||||||
E450AD8F22262C620091BED3 /* PromiseKit.framework.dSYM in Resources */ = {isa = PBXBuildFile; fileRef = E450AD8E22262C620091BED3 /* PromiseKit.framework.dSYM */; };
|
E450AD8F22262C620091BED3 /* PromiseKit.framework.dSYM in Resources */ = {isa = PBXBuildFile; fileRef = E450AD8E22262C620091BED3 /* PromiseKit.framework.dSYM */; };
|
||||||
E450AD9122262C780091BED3 /* SwiftyJSON.framework.dSYM in Resources */ = {isa = PBXBuildFile; fileRef = E450AD9022262C780091BED3 /* SwiftyJSON.framework.dSYM */; };
|
E450AD9122262C780091BED3 /* SwiftyJSON.framework.dSYM in Resources */ = {isa = PBXBuildFile; fileRef = E450AD9022262C780091BED3 /* SwiftyJSON.framework.dSYM */; };
|
||||||
@ -108,6 +108,10 @@
|
|||||||
E4F6B460221E119B00ACF42A /* QueueDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4F6B45F221E119B00ACF42A /* QueueDataSource.swift */; };
|
E4F6B460221E119B00ACF42A /* QueueDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4F6B45F221E119B00ACF42A /* QueueDataSource.swift */; };
|
||||||
E4F6B463221E125900ACF42A /* QueueItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4F6B462221E125900ACF42A /* QueueItem.swift */; };
|
E4F6B463221E125900ACF42A /* QueueItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4F6B462221E125900ACF42A /* QueueItem.swift */; };
|
||||||
E4F6B467221E233200ACF42A /* AlbumDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4F6B466221E233200ACF42A /* AlbumDataSource.swift */; };
|
E4F6B467221E233200ACF42A /* AlbumDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4F6B466221E233200ACF42A /* AlbumDataSource.swift */; };
|
||||||
|
E4FF718E2276010E00D4C412 /* PreferencesState.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FF718D2276010E00D4C412 /* PreferencesState.swift */; };
|
||||||
|
E4FF7190227601B400D4C412 /* PreferencesReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FF718F227601B400D4C412 /* PreferencesReducer.swift */; };
|
||||||
|
E4FF71922276029000D4C412 /* PreferencesActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FF71912276029000D4C412 /* PreferencesActions.swift */; };
|
||||||
|
E4FF71942276043A00D4C412 /* MPDServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FF71932276043A00D4C412 /* MPDServer.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@ -175,7 +179,6 @@
|
|||||||
E408D3BD220E03EE0006D9BE /* RawRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RawRepresentable.swift; sourceTree = "<group>"; };
|
E408D3BD220E03EE0006D9BE /* RawRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RawRepresentable.swift; sourceTree = "<group>"; };
|
||||||
E408D3C1220E134F0006D9BE /* AlbumViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumViewController.swift; sourceTree = "<group>"; };
|
E408D3C1220E134F0006D9BE /* AlbumViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumViewController.swift; sourceTree = "<group>"; };
|
||||||
E408D3C9220E341D0006D9BE /* AlbumViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AlbumViewItem.xib; sourceTree = "<group>"; };
|
E408D3C9220E341D0006D9BE /* AlbumViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AlbumViewItem.xib; sourceTree = "<group>"; };
|
||||||
E40F41F2221EDE27004B6CB8 /* Preferences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
|
|
||||||
E40FE71A221B904300A4223F /* NSEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSEvent.swift; sourceTree = "<group>"; };
|
E40FE71A221B904300A4223F /* NSEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSEvent.swift; sourceTree = "<group>"; };
|
||||||
E419E2862249B96600216A8C /* Song.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Song.swift; sourceTree = "<group>"; };
|
E419E2862249B96600216A8C /* Song.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Song.swift; sourceTree = "<group>"; };
|
||||||
E41B22BF21FB6BBA00D544F6 /* libmpdclient.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libmpdclient.2.dylib; path = libmpdclient/output/libmpdclient.2.dylib; sourceTree = "<group>"; };
|
E41B22BF21FB6BBA00D544F6 /* libmpdclient.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libmpdclient.2.dylib; path = libmpdclient/output/libmpdclient.2.dylib; sourceTree = "<group>"; };
|
||||||
@ -235,6 +238,7 @@
|
|||||||
E435E3E1221CD4E200184CFC /* NSFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSFont.swift; sourceTree = "<group>"; };
|
E435E3E1221CD4E200184CFC /* NSFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSFont.swift; sourceTree = "<group>"; };
|
||||||
E435E3E3221CD75D00184CFC /* NSImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSImage.swift; sourceTree = "<group>"; };
|
E435E3E3221CD75D00184CFC /* NSImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSImage.swift; sourceTree = "<group>"; };
|
||||||
E439109722640213002982E9 /* SongNotifierService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SongNotifierService.swift; sourceTree = "<group>"; };
|
E439109722640213002982E9 /* SongNotifierService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SongNotifierService.swift; sourceTree = "<group>"; };
|
||||||
|
E4405191227644340090CD6F /* MPDServerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDServerController.swift; sourceTree = "<group>"; };
|
||||||
E450AD7D222620A10091BED3 /* Album.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Album.swift; sourceTree = "<group>"; };
|
E450AD7D222620A10091BED3 /* Album.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Album.swift; sourceTree = "<group>"; };
|
||||||
E450AD8522262AE60091BED3 /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = Carthage/Build/Mac/SwiftyJSON.framework; sourceTree = "<group>"; };
|
E450AD8522262AE60091BED3 /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = Carthage/Build/Mac/SwiftyJSON.framework; sourceTree = "<group>"; };
|
||||||
E450AD8C22262C590091BED3 /* PromiseKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PromiseKit.framework; path = Carthage/Build/Mac/PromiseKit.framework; sourceTree = "<group>"; };
|
E450AD8C22262C590091BED3 /* PromiseKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PromiseKit.framework; path = Carthage/Build/Mac/PromiseKit.framework; sourceTree = "<group>"; };
|
||||||
@ -296,6 +300,10 @@
|
|||||||
E4F6B45F221E119B00ACF42A /* QueueDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueDataSource.swift; sourceTree = "<group>"; };
|
E4F6B45F221E119B00ACF42A /* QueueDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueDataSource.swift; sourceTree = "<group>"; };
|
||||||
E4F6B462221E125900ACF42A /* QueueItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueItem.swift; sourceTree = "<group>"; };
|
E4F6B462221E125900ACF42A /* QueueItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueueItem.swift; sourceTree = "<group>"; };
|
||||||
E4F6B466221E233200ACF42A /* AlbumDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumDataSource.swift; sourceTree = "<group>"; };
|
E4F6B466221E233200ACF42A /* AlbumDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlbumDataSource.swift; sourceTree = "<group>"; };
|
||||||
|
E4FF718D2276010E00D4C412 /* PreferencesState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesState.swift; sourceTree = "<group>"; };
|
||||||
|
E4FF718F227601B400D4C412 /* PreferencesReducer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesReducer.swift; sourceTree = "<group>"; };
|
||||||
|
E4FF71912276029000D4C412 /* PreferencesActions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesActions.swift; sourceTree = "<group>"; };
|
||||||
|
E4FF71932276043A00D4C412 /* MPDServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPDServer.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -361,7 +369,6 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
E4B11BAE2274F7030075461B /* Protocols */,
|
E4B11BAE2274F7030075461B /* Protocols */,
|
||||||
E4B11B6B226A5AF50075461B /* Actions */,
|
|
||||||
E407861B2110CE6E006887B1 /* AppDelegate.swift */,
|
E407861B2110CE6E006887B1 /* AppDelegate.swift */,
|
||||||
E407861F2110CE70006887B1 /* Assets.xcassets */,
|
E407861F2110CE70006887B1 /* Assets.xcassets */,
|
||||||
E4D1B597220BA3A20026F233 /* Controllers */,
|
E4D1B597220BA3A20026F233 /* Controllers */,
|
||||||
@ -376,7 +383,6 @@
|
|||||||
E40786252110CE70006887B1 /* Persephone.entitlements */,
|
E40786252110CE70006887B1 /* Persephone.entitlements */,
|
||||||
E450AD9E2229B9BC0091BED3 /* PersephoneBridgingHeader.h */,
|
E450AD9E2229B9BC0091BED3 /* PersephoneBridgingHeader.h */,
|
||||||
E4A83BEC2221F5DD0098FED6 /* Preferences */,
|
E4A83BEC2221F5DD0098FED6 /* Preferences */,
|
||||||
E4B11B5F226A4BED0075461B /* Reducers */,
|
|
||||||
E4D1B598220BA3C90026F233 /* Resources */,
|
E4D1B598220BA3C90026F233 /* Resources */,
|
||||||
E4A83BF2222207BE0098FED6 /* Services */,
|
E4A83BF2222207BE0098FED6 /* Services */,
|
||||||
E4B11B64226A4F460075461B /* State */,
|
E4B11B64226A4F460075461B /* State */,
|
||||||
@ -591,6 +597,7 @@
|
|||||||
E4B11B62226A4C510075461B /* AppReducer.swift */,
|
E4B11B62226A4C510075461B /* AppReducer.swift */,
|
||||||
E4B11B74226CC4D30075461B /* QueueReducer.swift */,
|
E4B11B74226CC4D30075461B /* QueueReducer.swift */,
|
||||||
E4B11B78226D346B0075461B /* AlbumListReducer.swift */,
|
E4B11B78226D346B0075461B /* AlbumListReducer.swift */,
|
||||||
|
E4FF718F227601B400D4C412 /* PreferencesReducer.swift */,
|
||||||
);
|
);
|
||||||
path = Reducers;
|
path = Reducers;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -598,10 +605,13 @@
|
|||||||
E4B11B64226A4F460075461B /* State */ = {
|
E4B11B64226A4F460075461B /* State */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
E4B11B6B226A5AF50075461B /* Actions */,
|
||||||
|
E4B11B5F226A4BED0075461B /* Reducers */,
|
||||||
E4B11B52226928F20075461B /* AppState.swift */,
|
E4B11B52226928F20075461B /* AppState.swift */,
|
||||||
E4B11B65226A4F830075461B /* PlayerState.swift */,
|
E4B11B65226A4F830075461B /* PlayerState.swift */,
|
||||||
E4B11B67226A4FA00075461B /* QueueState.swift */,
|
E4B11B67226A4FA00075461B /* QueueState.swift */,
|
||||||
E4B11B69226A4FBC0075461B /* AlbumListState.swift */,
|
E4B11B69226A4FBC0075461B /* AlbumListState.swift */,
|
||||||
|
E4FF718D2276010E00D4C412 /* PreferencesState.swift */,
|
||||||
);
|
);
|
||||||
path = State;
|
path = State;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -612,6 +622,7 @@
|
|||||||
E4B11BC12275EE410075461B /* AlbumListActions.swift */,
|
E4B11BC12275EE410075461B /* AlbumListActions.swift */,
|
||||||
E4B11BBD2275EDAA0075461B /* PlayerActions.swift */,
|
E4B11BBD2275EDAA0075461B /* PlayerActions.swift */,
|
||||||
E4B11BBF2275EE150075461B /* QueueActions.swift */,
|
E4B11BBF2275EE150075461B /* QueueActions.swift */,
|
||||||
|
E4FF71912276029000D4C412 /* PreferencesActions.swift */,
|
||||||
);
|
);
|
||||||
path = Actions;
|
path = Actions;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -655,6 +666,7 @@
|
|||||||
E4E8CC912204F4B80024217A /* QueueViewController.swift */,
|
E4E8CC912204F4B80024217A /* QueueViewController.swift */,
|
||||||
E465049921E94DF500A70F4C /* WindowController.swift */,
|
E465049921E94DF500A70F4C /* WindowController.swift */,
|
||||||
E4B11BB52275374B0075461B /* UserNotificationsController.swift */,
|
E4B11BB52275374B0075461B /* UserNotificationsController.swift */,
|
||||||
|
E4405191227644340090CD6F /* MPDServerController.swift */,
|
||||||
);
|
);
|
||||||
path = Controllers;
|
path = Controllers;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -682,7 +694,7 @@
|
|||||||
children = (
|
children = (
|
||||||
E450AD7D222620A10091BED3 /* Album.swift */,
|
E450AD7D222620A10091BED3 /* Album.swift */,
|
||||||
E4B11BA82274EDE30075461B /* Loading.swift */,
|
E4B11BA82274EDE30075461B /* Loading.swift */,
|
||||||
E40F41F2221EDE27004B6CB8 /* Preferences.swift */,
|
E4FF71932276043A00D4C412 /* MPDServer.swift */,
|
||||||
E4F6B462221E125900ACF42A /* QueueItem.swift */,
|
E4F6B462221E125900ACF42A /* QueueItem.swift */,
|
||||||
E419E2862249B96600216A8C /* Song.swift */,
|
E419E2862249B96600216A8C /* Song.swift */,
|
||||||
E47E2FDC2220A6D100F747E6 /* Time.swift */,
|
E47E2FDC2220A6D100F747E6 /* Time.swift */,
|
||||||
@ -877,6 +889,7 @@
|
|||||||
E4B11BB62275374B0075461B /* UserNotificationsController.swift in Sources */,
|
E4B11BB62275374B0075461B /* UserNotificationsController.swift in Sources */,
|
||||||
E4B11B68226A4FA00075461B /* QueueState.swift in Sources */,
|
E4B11B68226A4FA00075461B /* QueueState.swift in Sources */,
|
||||||
E4928E0B2218D62A001D4BEA /* CGColor.swift in Sources */,
|
E4928E0B2218D62A001D4BEA /* CGColor.swift in Sources */,
|
||||||
|
E4405192227644340090CD6F /* MPDServerController.swift in Sources */,
|
||||||
E4C8B53E22349002009A20F3 /* MPDIdle.swift in Sources */,
|
E4C8B53E22349002009A20F3 /* MPDIdle.swift in Sources */,
|
||||||
E4F6B460221E119B00ACF42A /* QueueDataSource.swift in Sources */,
|
E4F6B460221E119B00ACF42A /* QueueDataSource.swift in Sources */,
|
||||||
E4C8B53C22342005009A20F3 /* PreferencesWindowController.swift in Sources */,
|
E4C8B53C22342005009A20F3 /* PreferencesWindowController.swift in Sources */,
|
||||||
@ -896,15 +909,17 @@
|
|||||||
E45962C62241A78500FC1A1E /* MPDCommand.swift in Sources */,
|
E45962C62241A78500FC1A1E /* MPDCommand.swift in Sources */,
|
||||||
E408D3B9220DE98F0006D9BE /* NSUserInterfaceItemIdentifier.swift in Sources */,
|
E408D3B9220DE98F0006D9BE /* NSUserInterfaceItemIdentifier.swift in Sources */,
|
||||||
E4EB2379220F10B8008C70C0 /* MPDPair.swift in Sources */,
|
E4EB2379220F10B8008C70C0 /* MPDPair.swift in Sources */,
|
||||||
|
E4FF7190227601B400D4C412 /* PreferencesReducer.swift in Sources */,
|
||||||
E4F6B463221E125900ACF42A /* QueueItem.swift in Sources */,
|
E4F6B463221E125900ACF42A /* QueueItem.swift in Sources */,
|
||||||
E4A83BF12221FAA00098FED6 /* PreferencesViewController.swift in Sources */,
|
E4A83BF12221FAA00098FED6 /* PreferencesViewController.swift in Sources */,
|
||||||
E4B11BC22275EE410075461B /* AlbumListActions.swift in Sources */,
|
E4B11BC22275EE410075461B /* AlbumListActions.swift in Sources */,
|
||||||
E4B11B61226A4C000075461B /* PlayerReducer.swift in Sources */,
|
E4B11B61226A4C000075461B /* PlayerReducer.swift in Sources */,
|
||||||
|
E4FF71922276029000D4C412 /* PreferencesActions.swift in Sources */,
|
||||||
E465049A21E94DF500A70F4C /* WindowController.swift in Sources */,
|
E465049A21E94DF500A70F4C /* WindowController.swift in Sources */,
|
||||||
E41B22C621FB932700D544F6 /* MPDClient.swift in Sources */,
|
E41B22C621FB932700D544F6 /* MPDClient.swift in Sources */,
|
||||||
E40F41F3221EDE27004B6CB8 /* Preferences.swift in Sources */,
|
|
||||||
E47E2FDD2220A6D100F747E6 /* Time.swift in Sources */,
|
E47E2FDD2220A6D100F747E6 /* Time.swift in Sources */,
|
||||||
E419E2872249B96600216A8C /* Song.swift in Sources */,
|
E419E2872249B96600216A8C /* Song.swift in Sources */,
|
||||||
|
E4FF718E2276010E00D4C412 /* PreferencesState.swift in Sources */,
|
||||||
E439109822640213002982E9 /* SongNotifierService.swift in Sources */,
|
E439109822640213002982E9 /* SongNotifierService.swift in Sources */,
|
||||||
E407861C2110CE6E006887B1 /* AppDelegate.swift in Sources */,
|
E407861C2110CE6E006887B1 /* AppDelegate.swift in Sources */,
|
||||||
E4B11B75226CC4D30075461B /* QueueReducer.swift in Sources */,
|
E4B11B75226CC4D30075461B /* QueueReducer.swift in Sources */,
|
||||||
@ -925,6 +940,7 @@
|
|||||||
E408D3BE220E03EE0006D9BE /* RawRepresentable.swift in Sources */,
|
E408D3BE220E03EE0006D9BE /* RawRepresentable.swift in Sources */,
|
||||||
E4B11B66226A4F830075461B /* PlayerState.swift in Sources */,
|
E4B11B66226A4F830075461B /* PlayerState.swift in Sources */,
|
||||||
E4B11BBE2275EDAA0075461B /* PlayerActions.swift in Sources */,
|
E4B11BBE2275EDAA0075461B /* PlayerActions.swift in Sources */,
|
||||||
|
E4FF71942276043A00D4C412 /* MPDServer.swift in Sources */,
|
||||||
E41E530E223EF4CF00173814 /* CoverArtService+Caching.swift in Sources */,
|
E41E530E223EF4CF00173814 /* CoverArtService+Caching.swift in Sources */,
|
||||||
E4E8CC922204F4B80024217A /* QueueViewController.swift in Sources */,
|
E4E8CC922204F4B80024217A /* QueueViewController.swift in Sources */,
|
||||||
E41E5312223EF74A00173814 /* CoverArtService+Filesystem.swift in Sources */,
|
E41E5312223EF74A00173814 /* CoverArtService+Filesystem.swift in Sources */,
|
||||||
|
|||||||
@ -14,9 +14,9 @@ import MediaKeyTap
|
|||||||
class AppDelegate: NSObject,
|
class AppDelegate: NSObject,
|
||||||
NSApplicationDelegate,
|
NSApplicationDelegate,
|
||||||
MediaKeyTapDelegate {
|
MediaKeyTapDelegate {
|
||||||
var preferences = Preferences()
|
|
||||||
var mediaKeyTap: MediaKeyTap?
|
var mediaKeyTap: MediaKeyTap?
|
||||||
var userNotificationsController: UserNotificationsController?
|
var userNotificationsController = UserNotificationsController()
|
||||||
|
var mpdServerController = MPDServerController()
|
||||||
|
|
||||||
static let mpdClient = MPDClient(
|
static let mpdClient = MPDClient(
|
||||||
withDelegate: NotificationsController()
|
withDelegate: NotificationsController()
|
||||||
@ -27,38 +27,18 @@ class AppDelegate: NSObject,
|
|||||||
static let store = Store<AppState>(reducer: appReducer, state: nil)
|
static let store = Store<AppState>(reducer: appReducer, state: nil)
|
||||||
|
|
||||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||||
connect()
|
mpdServerController.connect()
|
||||||
|
|
||||||
preferences.addObserver(self, forKeyPath: "mpdHost")
|
|
||||||
preferences.addObserver(self, forKeyPath: "mpdPort")
|
|
||||||
|
|
||||||
mediaKeyTap = MediaKeyTap(delegate: self)
|
mediaKeyTap = MediaKeyTap(delegate: self)
|
||||||
mediaKeyTap?.start()
|
mediaKeyTap?.start()
|
||||||
|
|
||||||
AppDelegate.store.subscribe(self) {
|
AppDelegate.store.subscribe(self) {
|
||||||
$0.select { $0.playerState }
|
$0.select { $0.playerState.databaseUpdating }
|
||||||
}
|
}
|
||||||
|
|
||||||
userNotificationsController = UserNotificationsController()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ aNotification: Notification) {
|
func applicationWillTerminate(_ aNotification: Notification) {
|
||||||
disconnect()
|
mpdServerController.disconnect()
|
||||||
}
|
|
||||||
|
|
||||||
override func observeValue(
|
|
||||||
forKeyPath keyPath: String?,
|
|
||||||
of object: Any?,
|
|
||||||
change: [NSKeyValueChangeKey : Any]?,
|
|
||||||
context: UnsafeMutableRawPointer?
|
|
||||||
) {
|
|
||||||
switch keyPath {
|
|
||||||
case "mpdHost", "mpdPort":
|
|
||||||
disconnect()
|
|
||||||
connect()
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handle(mediaKey: MediaKey, event: KeyEvent) {
|
func handle(mediaKey: MediaKey, event: KeyEvent) {
|
||||||
@ -72,17 +52,6 @@ class AppDelegate: NSObject,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func connect() {
|
|
||||||
AppDelegate.mpdClient.connect(
|
|
||||||
host: preferences.mpdHostOrDefault,
|
|
||||||
port: preferences.mpdPortOrDefault
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func disconnect() {
|
|
||||||
AppDelegate.mpdClient.disconnect()
|
|
||||||
}
|
|
||||||
|
|
||||||
@IBAction func updateDatabase(_ sender: NSMenuItem) {
|
@IBAction func updateDatabase(_ sender: NSMenuItem) {
|
||||||
AppDelegate.mpdClient.updateDatabase()
|
AppDelegate.mpdClient.updateDatabase()
|
||||||
}
|
}
|
||||||
@ -91,9 +60,9 @@ class AppDelegate: NSObject,
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension AppDelegate: StoreSubscriber {
|
extension AppDelegate: StoreSubscriber {
|
||||||
typealias StoreSubscriberStateType = PlayerState
|
typealias StoreSubscriberStateType = Bool
|
||||||
|
|
||||||
func newState(state: PlayerState) {
|
func newState(state: Bool) {
|
||||||
updateDatabaseMenuItem.isEnabled = !state.databaseUpdating
|
updateDatabaseMenuItem.isEnabled = !state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,8 +13,6 @@ import Differ
|
|||||||
class AlbumViewController: NSViewController,
|
class AlbumViewController: NSViewController,
|
||||||
NSCollectionViewDelegate,
|
NSCollectionViewDelegate,
|
||||||
NSCollectionViewDelegateFlowLayout {
|
NSCollectionViewDelegateFlowLayout {
|
||||||
var preferences = Preferences()
|
|
||||||
|
|
||||||
let paddingWidth: CGFloat = 40
|
let paddingWidth: CGFloat = 40
|
||||||
let gutterWidth: CGFloat = 20
|
let gutterWidth: CGFloat = 20
|
||||||
|
|
||||||
@ -31,8 +29,8 @@ class AlbumViewController: NSViewController,
|
|||||||
|
|
||||||
albumCollectionView.dataSource = dataSource
|
albumCollectionView.dataSource = dataSource
|
||||||
|
|
||||||
preferences.addObserver(self, forKeyPath: "mpdLibraryDir")
|
// preferences.addObserver(self, forKeyPath: "mpdLibraryDir")
|
||||||
preferences.addObserver(self, forKeyPath: "fetchMissingArtworkFromInternet")
|
// preferences.addObserver(self, forKeyPath: "fetchMissingArtworkFromInternet")
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillDisappear() {
|
override func viewWillDisappear() {
|
||||||
|
|||||||
38
Persephone/Controllers/MPDServerController.swift
Normal file
38
Persephone/Controllers/MPDServerController.swift
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// MPDServerController.swift
|
||||||
|
// Persephone
|
||||||
|
//
|
||||||
|
// Created by Daniel Barber on 2019/4/28.
|
||||||
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import ReSwift
|
||||||
|
|
||||||
|
class MPDServerController {
|
||||||
|
init() {
|
||||||
|
AppDelegate.store.subscribe(self) {
|
||||||
|
$0.select { $0.preferencesState.mpdServer }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func connect() {
|
||||||
|
AppDelegate.mpdClient.connect(
|
||||||
|
host: AppDelegate.store.state.preferencesState.mpdServer.hostOrDefault,
|
||||||
|
port: AppDelegate.store.state.preferencesState.mpdServer.portOrDefault
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func disconnect() {
|
||||||
|
AppDelegate.mpdClient.disconnect()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension MPDServerController: StoreSubscriber {
|
||||||
|
typealias StoreSubscriberStateType = MPDServer
|
||||||
|
|
||||||
|
func newState(state: MPDServer) {
|
||||||
|
disconnect()
|
||||||
|
connect()
|
||||||
|
}
|
||||||
|
}
|
||||||
33
Persephone/Models/MPDServer.swift
Normal file
33
Persephone/Models/MPDServer.swift
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// MPDServer.swift
|
||||||
|
// Persephone
|
||||||
|
//
|
||||||
|
// Created by Daniel Barber on 2019/4/28.
|
||||||
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct MPDServer {
|
||||||
|
let hostDefault = "127.0.0.1"
|
||||||
|
let portDefault = 6600
|
||||||
|
|
||||||
|
var host: String?
|
||||||
|
|
||||||
|
var hostOrDefault: String {
|
||||||
|
return host ?? hostDefault
|
||||||
|
}
|
||||||
|
|
||||||
|
var port: Int?
|
||||||
|
|
||||||
|
var portOrDefault: Int {
|
||||||
|
return port ?? portDefault
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension MPDServer: Equatable {
|
||||||
|
static func == (lhs: MPDServer, rhs: MPDServer) -> Bool {
|
||||||
|
return (lhs.host == rhs.host) &&
|
||||||
|
(lhs.port == rhs.port)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,77 +0,0 @@
|
|||||||
//
|
|
||||||
// Preferences.swift
|
|
||||||
// Persephone
|
|
||||||
//
|
|
||||||
// Created by Daniel Barber on 2019/2/15.
|
|
||||||
// Copyright © 2019 Dan Barber. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
struct Preferences {
|
|
||||||
let mpdHostDefault = "127.0.0.1"
|
|
||||||
let mpdPortDefault = 6600
|
|
||||||
let mpdLibraryDirDefault = "~/Music"
|
|
||||||
|
|
||||||
let preferences = UserDefaults.standard
|
|
||||||
|
|
||||||
var mpdHost: String? {
|
|
||||||
get {
|
|
||||||
return preferences.string(forKey: "mpdHost")
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
preferences.set(newValue, forKey: "mpdHost")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var mpdHostOrDefault: String {
|
|
||||||
return mpdHost ?? mpdHostDefault
|
|
||||||
}
|
|
||||||
|
|
||||||
var mpdPort: Int? {
|
|
||||||
get {
|
|
||||||
return preferences.value(forKey: "mpdPort") as? Int
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
if (newValue.map { $0 > 0 } ?? false) {
|
|
||||||
preferences.set(newValue, forKey: "mpdPort")
|
|
||||||
} else {
|
|
||||||
preferences.removeObject(forKey: "mpdPort")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var mpdPortOrDefault: Int {
|
|
||||||
return mpdPort ?? mpdPortDefault
|
|
||||||
}
|
|
||||||
|
|
||||||
var mpdLibraryDir: String? {
|
|
||||||
get {
|
|
||||||
return preferences.string(forKey: "mpdLibraryDir")
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
preferences.set(newValue, forKey: "mpdLibraryDir")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var mpdLibraryDirOrDefault: String {
|
|
||||||
return mpdLibraryDir ?? mpdLibraryDirDefault
|
|
||||||
}
|
|
||||||
|
|
||||||
var expandedMpdLibraryDir: String {
|
|
||||||
return NSString(string: mpdLibraryDirOrDefault).expandingTildeInPath
|
|
||||||
}
|
|
||||||
|
|
||||||
var fetchMissingArtworkFromInternet: Bool {
|
|
||||||
get {
|
|
||||||
return preferences.bool(forKey: "fetchMissingArtworkFromInternet")
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
preferences.set(newValue, forKey: "fetchMissingArtworkFromInternet")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func addObserver(_ observer: NSObject, forKeyPath keyPath: String) {
|
|
||||||
preferences.addObserver(observer, forKeyPath: keyPath, options: .new, context: nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -9,16 +9,14 @@
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class CoverArtPrefsController: NSViewController {
|
class CoverArtPrefsController: NSViewController {
|
||||||
var preferences = Preferences()
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
if let mpdLibraryDir = preferences.mpdLibraryDir {
|
if let mpdLibraryDir = AppDelegate.store.state.preferencesState.mpdLibraryDir {
|
||||||
mpdLibraryDirField.stringValue = mpdLibraryDir
|
mpdLibraryDirField.stringValue = mpdLibraryDir
|
||||||
}
|
}
|
||||||
|
|
||||||
if preferences.fetchMissingArtworkFromInternet {
|
if AppDelegate.store.state.preferencesState.fetchMissingArtworkFromInternet {
|
||||||
fetchMissingArtworkFromInternet.state = .on
|
fetchMissingArtworkFromInternet.state = .on
|
||||||
} else {
|
} else {
|
||||||
fetchMissingArtworkFromInternet.state = .off
|
fetchMissingArtworkFromInternet.state = .off
|
||||||
@ -36,17 +34,17 @@ class CoverArtPrefsController: NSViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func updateMpdLibraryDir(_ sender: NSTextField) {
|
@IBAction func updateMpdLibraryDir(_ sender: NSTextField) {
|
||||||
preferences.mpdLibraryDir = sender.stringValue
|
AppDelegate.store.dispatch(UpdateMPDLibraryDir(mpdLibraryDir: sender.stringValue))
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBOutlet var mpdLibraryDirField: NSTextField!
|
@IBOutlet var mpdLibraryDirField: NSTextField!
|
||||||
|
|
||||||
@IBAction func updateFetchMissingArtworkFromInternet(_ sender: NSButton) {
|
@IBAction func updateFetchMissingArtworkFromInternet(_ sender: NSButton) {
|
||||||
if sender.state == .on {
|
AppDelegate.store.dispatch(
|
||||||
preferences.fetchMissingArtworkFromInternet = true
|
UpdateFetchMissingArtworkFromInternet(
|
||||||
} else {
|
fetchMissingArtworkFromInternet: sender.state == .on
|
||||||
preferences.fetchMissingArtworkFromInternet = false
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBOutlet var fetchMissingArtworkFromInternet: NSButton!
|
@IBOutlet var fetchMissingArtworkFromInternet: NSButton!
|
||||||
|
|||||||
@ -7,18 +7,18 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
import ReSwift
|
||||||
|
|
||||||
class GeneralPrefsViewController: NSViewController {
|
class GeneralPrefsViewController: NSViewController {
|
||||||
var preferences = Preferences()
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
if let mpdHost = preferences.mpdHost {
|
if let mpdHost = AppDelegate.store.state.preferencesState.mpdServer.host {
|
||||||
mpdHostField.stringValue = mpdHost
|
mpdHostField.stringValue = mpdHost
|
||||||
}
|
}
|
||||||
|
|
||||||
if let mpdPort = preferences.mpdPort {
|
if let mpdPort = AppDelegate.store.state.preferencesState.mpdServer.port {
|
||||||
|
print(mpdPort)
|
||||||
mpdPortField.stringValue = "\(mpdPort)"
|
mpdPortField.stringValue = "\(mpdPort)"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,11 +34,11 @@ class GeneralPrefsViewController: NSViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func updateMpdHost(_ sender: NSTextField) {
|
@IBAction func updateMpdHost(_ sender: NSTextField) {
|
||||||
preferences.mpdHost = sender.stringValue
|
AppDelegate.store.dispatch(UpdateServerHost(host: sender.stringValue))
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func updateMpdPort(_ sender: NSTextField) {
|
@IBAction func updateMpdPort(_ sender: NSTextField) {
|
||||||
preferences.mpdPort = sender.integerValue
|
AppDelegate.store.dispatch(UpdateServerPort(port: sender.integerValue))
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBOutlet var mpdHostField: NSTextField!
|
@IBOutlet var mpdHostField: NSTextField!
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class PreferencesWindowController: NSWindowController, NSWindowDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func windowShouldClose(_ sender: NSWindow) -> Bool {
|
func windowShouldClose(_ sender: NSWindow) -> Bool {
|
||||||
|
AppDelegate.store.dispatch(SavePreferences())
|
||||||
self.window?.orderOut(sender)
|
self.window?.orderOut(sender)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
</textField>
|
</textField>
|
||||||
<imageView identifier="albumArtwork" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Kfb-8f-ean">
|
<imageView identifier="albumArtwork" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Kfb-8f-ean">
|
||||||
<rect key="frame" x="0.0" y="39" width="128" height="128"/>
|
<rect key="frame" x="0.0" y="39" width="128" height="128"/>
|
||||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="blankAlbum" id="FsA-JX-BFh"/>
|
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="defaultCoverArt" id="FsA-JX-BFh"/>
|
||||||
</imageView>
|
</imageView>
|
||||||
<button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="n8W-do-HyG">
|
<button hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="n8W-do-HyG">
|
||||||
<rect key="frame" x="43" y="81" width="42" height="43"/>
|
<rect key="frame" x="43" y="81" width="42" height="43"/>
|
||||||
@ -79,7 +79,7 @@
|
|||||||
<collectionViewItem id="Qgu-aI-55A" customClass="AlbumViewItem" customModule="Persephone" customModuleProvider="target"/>
|
<collectionViewItem id="Qgu-aI-55A" customClass="AlbumViewItem" customModule="Persephone" customModuleProvider="target"/>
|
||||||
</objects>
|
</objects>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="blankAlbum" width="128" height="128"/>
|
<image name="defaultCoverArt" width="128" height="128"/>
|
||||||
<image name="playButtonLarge" width="22" height="22"/>
|
<image name="playButtonLarge" width="22" height="22"/>
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import Cocoa
|
|||||||
import PromiseKit
|
import PromiseKit
|
||||||
|
|
||||||
class CoverArtService {
|
class CoverArtService {
|
||||||
var preferences = Preferences()
|
|
||||||
let song: Song
|
let song: Song
|
||||||
let album: Album
|
let album: Album
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ extension CoverArtService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var musicDir: String {
|
var musicDir: String {
|
||||||
return self.preferences.expandedMpdLibraryDir
|
return AppDelegate.store.state.preferencesState.expandedMpdLibraryDir
|
||||||
}
|
}
|
||||||
|
|
||||||
func getArtworkFromFilesystem() -> Promise<NSImage?> {
|
func getArtworkFromFilesystem() -> Promise<NSImage?> {
|
||||||
@ -48,7 +48,7 @@ extension CoverArtService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fileSystemArtworkFilePath() -> String? {
|
func fileSystemArtworkFilePath() -> String? {
|
||||||
let musicDir = self.preferences.expandedMpdLibraryDir
|
let musicDir = AppDelegate.store.state.preferencesState.expandedMpdLibraryDir
|
||||||
|
|
||||||
return self.coverArtFilenames
|
return self.coverArtFilenames
|
||||||
.lazy
|
.lazy
|
||||||
|
|||||||
@ -19,7 +19,7 @@ extension CoverArtService {
|
|||||||
|
|
||||||
func getRemoteArtwork() -> Promise<NSImage?> {
|
func getRemoteArtwork() -> Promise<NSImage?> {
|
||||||
return Promise { seal in
|
return Promise { seal in
|
||||||
if preferences.fetchMissingArtworkFromInternet {
|
if AppDelegate.store.state.preferencesState .fetchMissingArtworkFromInternet {
|
||||||
coverArtQueue.async {
|
coverArtQueue.async {
|
||||||
let coverArtWorkItem = DispatchWorkItem {
|
let coverArtWorkItem = DispatchWorkItem {
|
||||||
self.getArtworkFromMusicBrainz().map(Optional.some).pipe(to: seal.resolve)
|
self.getArtworkFromMusicBrainz().map(Optional.some).pipe(to: seal.resolve)
|
||||||
|
|||||||
27
Persephone/State/Actions/PreferencesActions.swift
Normal file
27
Persephone/State/Actions/PreferencesActions.swift
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
//
|
||||||
|
// PreferencesActions.swift
|
||||||
|
// Persephone
|
||||||
|
//
|
||||||
|
// Created by Daniel Barber on 2019/4/28.
|
||||||
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import ReSwift
|
||||||
|
|
||||||
|
struct UpdateServerHost: Action {
|
||||||
|
var host: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UpdateServerPort: Action {
|
||||||
|
var port: Int?
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UpdateMPDLibraryDir: Action {
|
||||||
|
var mpdLibraryDir: String?
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UpdateFetchMissingArtworkFromInternet: Action {
|
||||||
|
var fetchMissingArtworkFromInternet: Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SavePreferences: Action {}
|
||||||
@ -12,4 +12,5 @@ struct AppState: StateType {
|
|||||||
var playerState = PlayerState()
|
var playerState = PlayerState()
|
||||||
var queueState = QueueState()
|
var queueState = QueueState()
|
||||||
var albumListState = AlbumListState()
|
var albumListState = AlbumListState()
|
||||||
|
var preferencesState = PreferencesState()
|
||||||
}
|
}
|
||||||
|
|||||||
51
Persephone/State/PreferencesState.swift
Normal file
51
Persephone/State/PreferencesState.swift
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
//
|
||||||
|
// PreferencesState.swift
|
||||||
|
// Persephone
|
||||||
|
//
|
||||||
|
// Created by Daniel Barber on 2019/4/28.
|
||||||
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import ReSwift
|
||||||
|
|
||||||
|
struct PreferencesState: StateType {
|
||||||
|
let preferences = UserDefaults.standard
|
||||||
|
|
||||||
|
var mpdServer: MPDServer
|
||||||
|
let mpdLibraryDirDefault = "~/Music"
|
||||||
|
|
||||||
|
var mpdLibraryDir: String?
|
||||||
|
|
||||||
|
var mpdLibraryDirOrDefault: String {
|
||||||
|
return mpdLibraryDir ?? mpdLibraryDirDefault
|
||||||
|
}
|
||||||
|
|
||||||
|
var expandedMpdLibraryDir: String {
|
||||||
|
return NSString(string: mpdLibraryDirOrDefault).expandingTildeInPath
|
||||||
|
}
|
||||||
|
|
||||||
|
var fetchMissingArtworkFromInternet: Bool
|
||||||
|
|
||||||
|
init() {
|
||||||
|
self.mpdServer = MPDServer(
|
||||||
|
host: preferences.string(forKey: "mpdHost"),
|
||||||
|
port: preferences.value(forKey: "mpdPort") as? Int
|
||||||
|
)
|
||||||
|
self.mpdLibraryDir = preferences.string(forKey: "mpdLibraryDir")
|
||||||
|
self.fetchMissingArtworkFromInternet = preferences.bool(
|
||||||
|
forKey: "fetchMissingArtworkFromInternet"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func save() {
|
||||||
|
preferences.set(mpdServer.host, forKey: "mpdHost")
|
||||||
|
if (mpdServer.port.map { $0 > 0 } ?? false) {
|
||||||
|
preferences.set(mpdServer.port, forKey: "mpdPort")
|
||||||
|
} else {
|
||||||
|
preferences.removeObject(forKey: "mpdPort")
|
||||||
|
}
|
||||||
|
preferences.set(mpdLibraryDir, forKey: "mpdLibraryDir")
|
||||||
|
preferences.set(fetchMissingArtworkFromInternet, forKey: "fetchMissingArtworkFromInternet")
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,6 +12,7 @@ func appReducer(action: Action, state: AppState?) -> AppState {
|
|||||||
return AppState(
|
return AppState(
|
||||||
playerState: playerReducer(action: action, state: state?.playerState),
|
playerState: playerReducer(action: action, state: state?.playerState),
|
||||||
queueState: queueReducer(action: action, state: state?.queueState),
|
queueState: queueReducer(action: action, state: state?.queueState),
|
||||||
albumListState: albumListReducer(action: action, state: state?.albumListState)
|
albumListState: albumListReducer(action: action, state: state?.albumListState),
|
||||||
|
preferencesState: preferencesReducer(action: action, state: state?.preferencesState)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
34
Persephone/State/Reducers/PreferencesReducer.swift
Normal file
34
Persephone/State/Reducers/PreferencesReducer.swift
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// PreferencesReducer.swift
|
||||||
|
// Persephone
|
||||||
|
//
|
||||||
|
// Created by Daniel Barber on 2019/4/28.
|
||||||
|
// Copyright © 2019 Dan Barber. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import ReSwift
|
||||||
|
|
||||||
|
func preferencesReducer(action: Action, state: PreferencesState?) -> PreferencesState {
|
||||||
|
|
||||||
|
var state = state ?? PreferencesState()
|
||||||
|
|
||||||
|
switch action {
|
||||||
|
case let action as UpdateServerHost:
|
||||||
|
state.mpdServer.host = action.host
|
||||||
|
|
||||||
|
case let action as UpdateServerPort:
|
||||||
|
state.mpdServer.port = action.port
|
||||||
|
|
||||||
|
case let action as UpdateMPDLibraryDir:
|
||||||
|
state.mpdLibraryDir = action.mpdLibraryDir
|
||||||
|
|
||||||
|
case is SavePreferences:
|
||||||
|
state.save()
|
||||||
|
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return state
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user