mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-28 08:13:17 +03:00
GH-322 Observe subscriptions via MainScheduler
This commit is contained in:
parent
26009e1073
commit
d6053e5c05
@ -60,6 +60,7 @@ class FileBrowserComponent: ViewComponent {
|
|||||||
self.fileItemService.sink
|
self.fileItemService.sink
|
||||||
.filter { $0 is FileItemServiceChange }
|
.filter { $0 is FileItemServiceChange }
|
||||||
.map { $0 as! FileItemServiceChange }
|
.map { $0 as! FileItemServiceChange }
|
||||||
|
.observeOn(MainScheduler.instance)
|
||||||
.subscribe(onNext: { [unowned self] action in
|
.subscribe(onNext: { [unowned self] action in
|
||||||
switch action {
|
switch action {
|
||||||
case let .childrenChanged(root, fileItem):
|
case let .childrenChanged(root, fileItem):
|
||||||
@ -69,9 +70,7 @@ class FileBrowserComponent: ViewComponent {
|
|||||||
|
|
||||||
// FIXME: restore expanded states
|
// FIXME: restore expanded states
|
||||||
if fileItem?.url == self.cwd {
|
if fileItem?.url == self.cwd {
|
||||||
DispatchUtils.gui {
|
self.fileView.reloadItem(nil, reloadChildren: true)
|
||||||
self.fileView.reloadItem(nil, reloadChildren: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guard self.fileView.row(forItem: fileItem) > -1 else {
|
guard self.fileView.row(forItem: fileItem) > -1 else {
|
||||||
@ -79,9 +78,7 @@ class FileBrowserComponent: ViewComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: restore expanded states
|
// FIXME: restore expanded states
|
||||||
DispatchUtils.gui {
|
self.fileView.reloadItem(fileItem, reloadChildren: true)
|
||||||
self.fileView.reloadItem(fileItem, reloadChildren: true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.addDisposableTo(self.disposeBag)
|
.addDisposableTo(self.disposeBag)
|
||||||
@ -104,6 +101,7 @@ class FileBrowserComponent: ViewComponent {
|
|||||||
return source
|
return source
|
||||||
.filter { $0 is MainWindowAction }
|
.filter { $0 is MainWindowAction }
|
||||||
.map { $0 as! MainWindowAction }
|
.map { $0 as! MainWindowAction }
|
||||||
|
.observeOn(MainScheduler.instance)
|
||||||
.subscribe(onNext: { [unowned self] action in
|
.subscribe(onNext: { [unowned self] action in
|
||||||
switch action {
|
switch action {
|
||||||
case let .changeCwd(mainWindow: mainWindow):
|
case let .changeCwd(mainWindow: mainWindow):
|
||||||
|
@ -34,9 +34,9 @@ extension URL {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
try (self as NSURL).getResourceValue(&rsrc, forKey: URLResourceKey(rawValue: key))
|
try (self as NSURL).getResourceValue(&rsrc, forKey: URLResourceKey(rawValue: key))
|
||||||
} catch {
|
} catch let error as NSError {
|
||||||
// FIXME error handling
|
// FIXME error handling
|
||||||
print("\(#function): \(self) -> ERROR while getting \(key)")
|
print("\(#function): \(self) -> ERROR while getting \(key): \(error)")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,6 +178,7 @@ class MainWindowComponent: WindowComponent, NSWindowDelegate, NSUserInterfaceVal
|
|||||||
!appearanceData.editorFont.isEqual(to: self.neoVimView.font)
|
!appearanceData.editorFont.isEqual(to: self.neoVimView.font)
|
||||||
|| appearanceData.editorUsesLigatures != self.neoVimView.usesLigatures
|
|| appearanceData.editorUsesLigatures != self.neoVimView.usesLigatures
|
||||||
}
|
}
|
||||||
|
.observeOn(MainScheduler.instance)
|
||||||
.subscribe(onNext: { [unowned self] appearance in
|
.subscribe(onNext: { [unowned self] appearance in
|
||||||
self.neoVimView.usesLigatures = appearance.editorUsesLigatures
|
self.neoVimView.usesLigatures = appearance.editorUsesLigatures
|
||||||
self.neoVimView.font = appearance.editorFont
|
self.neoVimView.font = appearance.editorFont
|
||||||
|
@ -142,6 +142,7 @@ class OpenQuicklyWindowComponent: WindowComponent,
|
|||||||
self.mainWindow?.sink
|
self.mainWindow?.sink
|
||||||
.filter { $0 is MainWindowAction }
|
.filter { $0 is MainWindowAction }
|
||||||
.map { $0 as! MainWindowAction }
|
.map { $0 as! MainWindowAction }
|
||||||
|
.observeOn(MainScheduler.instance)
|
||||||
.subscribe(onNext: { [unowned self] action in
|
.subscribe(onNext: { [unowned self] action in
|
||||||
switch action {
|
switch action {
|
||||||
case .close:
|
case .close:
|
||||||
|
Loading…
Reference in New Issue
Block a user