mirror of
https://github.com/danbee/persephone
synced 2025-03-04 08:39:11 +00:00
make it work
This commit is contained in:
parent
663451c2b5
commit
5cd67c5007
@ -18,6 +18,16 @@ class CoverArtPrefsController: NSViewController {
|
||||
} else {
|
||||
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)
|
||||
}
|
||||
@ -43,6 +53,12 @@ class CoverArtPrefsController: NSViewController {
|
||||
UpdateCustomArtworkURLToggle(useCustomArtworkURL: sender.state == .on)
|
||||
)
|
||||
}
|
||||
|
||||
@IBAction func updateCustomArtworkURL(_ sender: NSTextField) {
|
||||
App.store.dispatch(
|
||||
UpdateCustomArtworkURL(customArtworkURL: sender.stringValue)
|
||||
)
|
||||
}
|
||||
|
||||
@IBAction func clearAlbumArtCache(_ sender: NSButton) {
|
||||
KingfisherManager.shared.cache.clearDiskCache()
|
||||
|
||||
@ -580,6 +580,9 @@
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<action selector="updateCustomArtworkURL:" target="3C9-vU-zjZ" id="I5e-oc-cN6"/>
|
||||
</connections>
|
||||
</textField>
|
||||
</gridCell>
|
||||
<gridCell row="g4x-Bc-qT7" column="y6E-R8-zfP" id="LTx-vQ-fTR">
|
||||
|
||||
@ -24,4 +24,8 @@ struct UpdateCustomArtworkURLToggle: Action {
|
||||
var useCustomArtworkURL: Bool
|
||||
}
|
||||
|
||||
struct UpdateCustomArtworkURL: Action {
|
||||
var customArtworkURL: String
|
||||
}
|
||||
|
||||
struct SavePreferences: Action {}
|
||||
|
||||
@ -22,6 +22,9 @@ func preferencesReducer(action: Action, state: PreferencesState?) -> Preferences
|
||||
|
||||
case let action as UpdateCustomArtworkURLToggle:
|
||||
state.fetchArtworkFromCustomURL = action.useCustomArtworkURL
|
||||
|
||||
case let action as UpdateCustomArtworkURL:
|
||||
state.customArtworkURL = URL(string: action.customArtworkURL)
|
||||
|
||||
case is SavePreferences:
|
||||
state.save()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user