diff --git a/Mac/Components/Preferences/CoverArtPrefsController.swift b/Mac/Components/Preferences/CoverArtPrefsController.swift
index 3e46b47..3445b1e 100644
--- a/Mac/Components/Preferences/CoverArtPrefsController.swift
+++ b/Mac/Components/Preferences/CoverArtPrefsController.swift
@@ -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()
diff --git a/Mac/Components/Window/Base.lproj/Main.storyboard b/Mac/Components/Window/Base.lproj/Main.storyboard
index 28f6f12..93b8b70 100644
--- a/Mac/Components/Window/Base.lproj/Main.storyboard
+++ b/Mac/Components/Window/Base.lproj/Main.storyboard
@@ -580,6 +580,9 @@
+
+
+
diff --git a/Shared/State/Actions/PreferencesActions.swift b/Shared/State/Actions/PreferencesActions.swift
index 16e2289..d25ca4b 100644
--- a/Shared/State/Actions/PreferencesActions.swift
+++ b/Shared/State/Actions/PreferencesActions.swift
@@ -24,4 +24,8 @@ struct UpdateCustomArtworkURLToggle: Action {
var useCustomArtworkURL: Bool
}
+struct UpdateCustomArtworkURL: Action {
+ var customArtworkURL: String
+}
+
struct SavePreferences: Action {}
diff --git a/Shared/State/Reducers/PreferencesReducer.swift b/Shared/State/Reducers/PreferencesReducer.swift
index 99502cb..883f64b 100644
--- a/Shared/State/Reducers/PreferencesReducer.swift
+++ b/Shared/State/Reducers/PreferencesReducer.swift
@@ -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()