mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-25 06:43:24 +03:00
Adapt to RxSwift 6.2
This commit is contained in:
parent
6254fa99e4
commit
507e2d6973
@ -62,7 +62,7 @@ extension NvimView: NSTouchBarDelegate, NSScrubberDataSource, NSScrubberDelegate
|
||||
func updateTouchBarCurrentBuffer() {
|
||||
self
|
||||
.allTabs()
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onSuccess: { [weak self] in
|
||||
self?.tabsCache = $0
|
||||
|
||||
@ -83,7 +83,7 @@ extension NvimView: NSTouchBarDelegate, NSScrubberDataSource, NSScrubberDelegate
|
||||
func updateTouchBarTab() {
|
||||
self
|
||||
.allTabs()
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onSuccess: { [weak self] in
|
||||
self?.tabsCache = $0
|
||||
|
||||
|
@ -186,7 +186,7 @@ extension NvimView {
|
||||
if event == .vimenter {
|
||||
Completable
|
||||
.empty()
|
||||
.observeOn(SerialDispatchQueueScheduler(qos: .userInitiated))
|
||||
.observe(on: SerialDispatchQueueScheduler(qos: .userInitiated))
|
||||
.andThen(
|
||||
Completable.create { completable in
|
||||
self.rpcEventSubscriptionCondition.wait(for: 5)
|
||||
@ -245,7 +245,7 @@ extension NvimView {
|
||||
try? self.api
|
||||
.stop()
|
||||
.andThen(self.bridge.forceQuit())
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.wait(onCompleted: { [weak self] in
|
||||
self?.bridgeLogger.fault("Successfully force-closed the bridge.")
|
||||
}, onError: { [weak self] in
|
||||
|
@ -78,12 +78,12 @@ public extension PrimitiveSequence where Trait == SingleTrait {
|
||||
|
||||
let disposable = self.subscribe(onSuccess: { result in
|
||||
value = result
|
||||
|
||||
|
||||
condition.lock()
|
||||
defer { condition.unlock() }
|
||||
trigger = true
|
||||
condition.broadcast()
|
||||
}, onError: { _ in
|
||||
}, onFailure: { _ in
|
||||
condition.lock()
|
||||
defer { condition.unlock() }
|
||||
trigger = true
|
||||
|
@ -41,7 +41,7 @@ class AdvancedPref: PrefPane, UiComponent, NSTextFieldDelegate {
|
||||
self.updateViews()
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if self.useInteractiveZsh != state.mainWindowTemplate.useInteractiveZsh
|
||||
|| self.useSnapshotUpdate != state.useSnapshotUpdate
|
||||
|
@ -77,7 +77,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
)
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { appState in
|
||||
self.hasMainWindows = !appState.mainWindows.isEmpty
|
||||
self.hasDirtyWindows = appState.mainWindows.values.reduce(false) { $1.isDirty ? true : $0 }
|
||||
|
@ -53,7 +53,7 @@ class AppearancePref: PrefPane, NSComboBoxDelegate, NSControlTextEditingDelegate
|
||||
sharedFontManager.target = self
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
let appearance = state.mainWindowTemplate.appearance
|
||||
|
||||
|
@ -46,7 +46,7 @@ class BuffersList: NSView,
|
||||
self.addViews()
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if state.viewToBeFocused != nil,
|
||||
case .bufferList = state.viewToBeFocused!
|
||||
|
@ -50,7 +50,7 @@ class FileBrowser: NSView,
|
||||
self.innerCustomToolbar.fileBrowser = self
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if self.cwd != state.cwd {
|
||||
self.cwd = state.cwd
|
||||
|
@ -51,7 +51,7 @@ class FileOutlineView: NSOutlineView,
|
||||
self.delegate = self
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if state.viewToBeFocused != nil, case .fileBrowser = state.viewToBeFocused! {
|
||||
self.beFirstResponder()
|
||||
|
@ -41,7 +41,7 @@ class GeneralPref: PrefPane, UiComponent, NSTextFieldDelegate {
|
||||
.selectItem(at: indexToAfterLastWindowAction.firstIndex(of: state.afterLastWindowAction) ?? 0)
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if self.openWhenLaunchingCheckbox.boolState != state.openNewMainWindowOnLaunch {
|
||||
self.openWhenLaunchingCheckbox.boolState = state.openNewMainWindowOnLaunch
|
||||
|
@ -50,7 +50,7 @@ class HtmlPreviewTool: NSView, UiComponent, WKNavigationDelegate {
|
||||
}
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if state.viewToBeFocused != nil,
|
||||
case .htmlPreview = state.viewToBeFocused! { self.beFirstResponder() }
|
||||
|
@ -35,7 +35,7 @@ class KeysPref: PrefPane, UiComponent, NSTextFieldDelegate {
|
||||
self.updateViews()
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if self.isLeftOptionMeta != state.mainWindowTemplate.isLeftOptionMeta
|
||||
|| self.isRightOptionMeta != state.mainWindowTemplate.isRightOptionMeta
|
||||
|
@ -166,7 +166,7 @@ extension MainWindow {
|
||||
@IBAction func saveDocument(_: Any?) {
|
||||
self.neoVimView
|
||||
.currentBuffer()
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.flatMapCompletable { curBuf -> Completable in
|
||||
if curBuf.url == nil {
|
||||
self.savePanelSheet {
|
||||
@ -187,7 +187,7 @@ extension MainWindow {
|
||||
@IBAction func saveDocumentAs(_: Any?) {
|
||||
self.neoVimView
|
||||
.currentBuffer()
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onSuccess: { curBuf in
|
||||
self.savePanelSheet { url in
|
||||
self.neoVimView
|
||||
|
@ -275,7 +275,7 @@ class MainWindow: NSObject,
|
||||
|
||||
private func subscribeToNvimViewEvents() {
|
||||
self.neoVimView.events
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { [weak self] event in
|
||||
switch event {
|
||||
case .neoVimStopped: self?.neoVimStopped()
|
||||
@ -325,7 +325,7 @@ class MainWindow: NSObject,
|
||||
|
||||
private func subscribeToStateChange(source: Observable<StateType>) {
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if self.isClosing {
|
||||
return
|
||||
|
@ -79,7 +79,7 @@ class MarkdownTool: NSView, UiComponent, WKNavigationDelegate {
|
||||
if let url = state.preview.server { self.webview.load(URLRequest(url: url)) }
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if state.viewToBeFocused != nil,
|
||||
case .markdownPreview = state.viewToBeFocused!
|
||||
|
@ -55,7 +55,7 @@ class OpenQuicklyWindow: NSObject,
|
||||
self.addViews()
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { [weak self] state in self?.subscription(state) })
|
||||
.disposed(by: self.disposeBag)
|
||||
}
|
||||
@ -145,7 +145,7 @@ class OpenQuicklyWindow: NSObject,
|
||||
self.cwdControl.url = cwd
|
||||
|
||||
self.searchStream
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { [weak self] pattern in
|
||||
self?.scanAndScore(pattern)
|
||||
})
|
||||
|
@ -40,7 +40,7 @@ class PrefWindow: NSObject,
|
||||
self.addViews()
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
if state.preferencesOpen.payload == false {
|
||||
self.openStatusMark = state.preferencesOpen.mark
|
||||
|
@ -112,7 +112,7 @@ protocol UiComponent {
|
||||
|
||||
class ActionEmitter {
|
||||
var observable: Observable<ReduxTypes.ActionType> {
|
||||
self.subject.asObservable().observeOn(self.scheduler)
|
||||
self.subject.asObservable().observe(on: self.scheduler)
|
||||
}
|
||||
|
||||
func typedEmit<T>() -> (T) -> Void {{ (action: T) in self.subject.onNext(action) } }
|
||||
@ -149,7 +149,7 @@ class ReduxContext {
|
||||
|
||||
init(initialState: ReduxTypes.StateType) {
|
||||
self.state = initialState
|
||||
self.stateSource = self.stateSubject.asObservable().observeOn(self.stateScheduler)
|
||||
self.stateSource = self.stateSubject.asObservable().observe(on: self.stateScheduler)
|
||||
}
|
||||
|
||||
func terminate() {
|
||||
|
@ -33,7 +33,7 @@ class ToolsPref: PrefPane, UiComponent {
|
||||
self.updateViews()
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { _ in
|
||||
|
||||
self.updateViews()
|
||||
|
@ -104,7 +104,7 @@ class UiComponentTemplate: UiComponent {
|
||||
|
||||
// react to the new state
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(
|
||||
onNext: { _ in
|
||||
Swift.print("Hello, \(self.someField)")
|
||||
|
@ -26,7 +26,7 @@ class UiRoot: UiComponent {
|
||||
self.prefWindow = PrefWindow(source: source, emitter: emitter, state: state)
|
||||
|
||||
source
|
||||
.observeOn(MainScheduler.instance)
|
||||
.observe(on: MainScheduler.instance)
|
||||
.subscribe(onNext: { state in
|
||||
let uuidsInState = Set(state.mainWindows.keys)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user