1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 03:25:03 +03:00
vimr/VimR/GeneralPrefReducer.swift

32 lines
671 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
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
}
}