2016-08-30 23:25:34 +03:00
|
|
|
/**
|
|
|
|
* Tae Won Ha - http://taewon.de - @hataewon
|
|
|
|
* See LICENSE
|
|
|
|
*/
|
|
|
|
|
|
|
|
import Cocoa
|
|
|
|
import RxSwift
|
|
|
|
|
2016-09-03 11:17:22 +03:00
|
|
|
class OpenQuicklyWindowManager: StandardFlow {
|
2016-08-30 23:25:34 +03:00
|
|
|
|
2016-09-25 18:50:33 +03:00
|
|
|
fileprivate let openQuicklyWindow: OpenQuicklyWindowComponent
|
|
|
|
fileprivate let fileItemService: FileItemService
|
2016-08-30 23:25:34 +03:00
|
|
|
|
2016-09-03 11:17:22 +03:00
|
|
|
init(source: Observable<Any>, fileItemService: FileItemService) {
|
|
|
|
self.fileItemService = fileItemService
|
|
|
|
self.openQuicklyWindow = OpenQuicklyWindowComponent(source: source, fileItemService: fileItemService)
|
2016-09-01 21:10:40 +03:00
|
|
|
|
|
|
|
super.init(source: source)
|
|
|
|
}
|
|
|
|
|
|
|
|
func open(forMainWindow mainWindow: MainWindowComponent) {
|
2016-09-03 00:35:18 +03:00
|
|
|
self.openQuicklyWindow.show(forMainWindow: mainWindow)
|
2016-09-01 21:10:40 +03:00
|
|
|
}
|
|
|
|
|
2016-09-25 18:50:33 +03:00
|
|
|
override func subscription(source: Observable<Any>) -> Disposable {
|
2016-10-03 15:58:49 +03:00
|
|
|
return source
|
|
|
|
.filter { $0 is MainWindowAction }
|
|
|
|
.map { $0 as! MainWindowAction }
|
|
|
|
.subscribe(onNext: { [unowned self] event in
|
|
|
|
switch event {
|
|
|
|
case let .openQuickly(mainWindow: mainWindow):
|
|
|
|
self.open(forMainWindow: mainWindow)
|
|
|
|
default:
|
|
|
|
return
|
|
|
|
}
|
|
|
|
})
|
2016-09-01 21:10:40 +03:00
|
|
|
}
|
2016-08-30 23:25:34 +03:00
|
|
|
}
|