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

35 lines
672 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 UpdateMPDLibraryDir:
state.mpdLibraryDir = action.mpdLibraryDir
case is SavePreferences:
state.save()
default:
break
}
return state
}