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

39 lines
771 B
Swift

//
// UIReducer.swift
// Persephone
//
// Created by Daniel Barber on 2019/5/02.
// Copyright © 2019 Dan Barber. All rights reserved.
//
import ReSwift
func uiReducer(action: Action, state: UIState?) -> UIState {
var state = state ?? UIState()
switch action {
case is MainWindowDidOpenAction:
state.mainWindowState = .open
case is MainWindowDidCloseAction:
state.mainWindowState = .closed
case is MainWindowDidMinimizeAction:
state.mainWindowState = .minimised
case is DatabaseUpdateStartedAction:
state.databaseUpdating = true
case is DatabaseUpdateFinishedAction:
state.databaseUpdating = false
case let action as SetSelectedSong:
state.selectedSong = action.selectedSong
default:
break
}
return state
}