1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-03 00:54:42 +03:00
vimr/VimR/GeneralPrefReducer.swift

35 lines
763 B
Swift
Raw Normal View History

2017-02-28 00:45:26 +03:00
/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Foundation
2017-04-30 10:25:15 +03:00
class GeneralPrefReducer {
2017-02-28 00:45:26 +03:00
typealias Pair = StateActionPair<AppState, GeneralPref.Action>
2017-04-30 10:25:15 +03:00
func reduce(_ pair: Pair) -> Pair {
var state = pair.state
2017-02-28 00:45:26 +03:00
2017-04-30 10:25:15 +03:00
switch pair.action {
2017-02-28 00:45:26 +03:00
2017-04-30 10:25:15 +03:00
case let .setOpenOnLaunch(value):
state.openNewMainWindowOnLaunch = value
2017-02-28 00:45:26 +03:00
case let .setAfterLastWindowAction(action):
state.afterLastWindowAction = action
2017-04-30 10:25:15 +03:00
case let .setOpenOnReactivation(value):
state.openNewMainWindowOnReactivation = value
2017-02-28 00:45:26 +03:00
2017-04-30 10:25:15 +03:00
case let .setIgnorePatterns(patterns):
state.openQuickly.ignorePatterns = patterns
state.openQuickly.ignoreToken = Token()
2017-02-28 00:45:26 +03:00
}
2017-04-30 10:25:15 +03:00
return StateActionPair(state: state, action: pair.action)
2017-02-28 00:45:26 +03:00
}
}