mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-11 07:22:23 +03:00
28 lines
589 B
Swift
28 lines
589 B
Swift
/**
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
* See LICENSE
|
|
*/
|
|
|
|
import Foundation
|
|
import Swifter
|
|
import RxSwift
|
|
|
|
fileprivate let defaults = UserDefaults.standard
|
|
|
|
class PrefService: Service {
|
|
|
|
typealias Element = StateActionPair<AppState, UuidAction<MainWindow.Action>>
|
|
|
|
static let compatibleVersion = "168" // yet dummy
|
|
static let lastCompatibleVersion = "128"
|
|
|
|
func apply(_ pair: Element) {
|
|
guard case .close = pair.action.payload else {
|
|
return
|
|
}
|
|
|
|
NSLog("Saving pref!")
|
|
defaults.setValue(pair.state.dict(), forKey: PrefService.compatibleVersion)
|
|
}
|
|
}
|