mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-29 00:34:26 +03:00
35 lines
781 B
Swift
35 lines
781 B
Swift
/**
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
* See LICENSE
|
|
*/
|
|
|
|
import Foundation
|
|
import RxSwift
|
|
|
|
class GeneralPrefReducer: Reducer {
|
|
|
|
typealias Pair = StateActionPair<AppState, GeneralPref.Action>
|
|
|
|
func reduce(_ source: Observable<Pair>) -> Observable<Pair> {
|
|
return source.map { pair in
|
|
var state = pair.state
|
|
|
|
switch pair.action {
|
|
|
|
case let .setOpenOnLaunch(value):
|
|
state.openNewMainWindowOnLaunch = value
|
|
|
|
case let .setOpenOnReactivation(value):
|
|
state.openNewMainWindowOnReactivation = value
|
|
|
|
case let .setIgnorePatterns(patterns):
|
|
state.openQuickly.ignorePatterns = patterns
|
|
state.openQuickly.ignoreToken = Token()
|
|
|
|
}
|
|
|
|
return StateActionPair(state: state, action: pair.action)
|
|
}
|
|
}
|
|
}
|