1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00

make it work

This commit is contained in:
Diego Torres 2020-11-07 23:33:36 +01:00
parent 663451c2b5
commit 5cd67c5007
4 changed files with 26 additions and 0 deletions

View File

@ -19,6 +19,16 @@ class CoverArtPrefsController: NSViewController {
fetchMissingArtworkFromInternet.state = .off fetchMissingArtworkFromInternet.state = .off
} }
if App.store.state.preferencesState.fetchArtworkFromCustomURL {
customArtworkURLButton.state = .on
} else {
customArtworkURLButton.state = .off
}
if let urlString = App.store.state.preferencesState.customArtworkURL?.absoluteString {
customArtworkURLTextField.stringValue = urlString
}
preferredContentSize = NSMakeSize(view.frame.size.width, view.frame.size.height) preferredContentSize = NSMakeSize(view.frame.size.width, view.frame.size.height)
} }
@ -44,6 +54,12 @@ class CoverArtPrefsController: NSViewController {
) )
} }
@IBAction func updateCustomArtworkURL(_ sender: NSTextField) {
App.store.dispatch(
UpdateCustomArtworkURL(customArtworkURL: sender.stringValue)
)
}
@IBAction func clearAlbumArtCache(_ sender: NSButton) { @IBAction func clearAlbumArtCache(_ sender: NSButton) {
KingfisherManager.shared.cache.clearDiskCache() KingfisherManager.shared.cache.clearDiskCache()
KingfisherManager.shared.cache.clearMemoryCache() KingfisherManager.shared.cache.clearMemoryCache()

View File

@ -580,6 +580,9 @@
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell> </textFieldCell>
<connections>
<action selector="updateCustomArtworkURL:" target="3C9-vU-zjZ" id="I5e-oc-cN6"/>
</connections>
</textField> </textField>
</gridCell> </gridCell>
<gridCell row="g4x-Bc-qT7" column="y6E-R8-zfP" id="LTx-vQ-fTR"> <gridCell row="g4x-Bc-qT7" column="y6E-R8-zfP" id="LTx-vQ-fTR">

View File

@ -24,4 +24,8 @@ struct UpdateCustomArtworkURLToggle: Action {
var useCustomArtworkURL: Bool var useCustomArtworkURL: Bool
} }
struct UpdateCustomArtworkURL: Action {
var customArtworkURL: String
}
struct SavePreferences: Action {} struct SavePreferences: Action {}

View File

@ -23,6 +23,9 @@ func preferencesReducer(action: Action, state: PreferencesState?) -> Preferences
case let action as UpdateCustomArtworkURLToggle: case let action as UpdateCustomArtworkURLToggle:
state.fetchArtworkFromCustomURL = action.useCustomArtworkURL state.fetchArtworkFromCustomURL = action.useCustomArtworkURL
case let action as UpdateCustomArtworkURL:
state.customArtworkURL = URL(string: action.customArtworkURL)
case is SavePreferences: case is SavePreferences:
state.save() state.save()