1
1
mirror of https://github.com/danbee/persephone synced 2025-03-04 08:39:11 +00:00
persephone/Shared/State/Reducers/PreferencesReducer.swift
Diego Torres 663451c2b5 WIP
2020-11-07 19:26:09 +01:00

35 lines
701 B
Swift

//
// 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 UpdateCustomArtworkURLToggle:
state.fetchArtworkFromCustomURL = action.useCustomArtworkURL
case is SavePreferences:
state.save()
default:
break
}
return state
}