From 28df96524d3ac4363a6a4d7c7ed2ff9c4980d856 Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Sat, 16 Jan 2016 11:54:06 +0000 Subject: [PATCH] RAC updated to 4.RC1 --- BuildaKit/Availability.swift | 18 +++++------ BuildaKit/RACUtils.swift | 12 ++++---- Buildasaur/BranchWatchingViewController.swift | 17 ++++++----- Buildasaur/BuildTemplateViewController.swift | 22 +++++++------- Buildasaur/DashboardViewController.swift | 4 +-- Buildasaur/EditableViewController.swift | 4 +-- .../EmptyBuildTemplateViewController.swift | 2 +- Buildasaur/EmptyProjectViewController.swift | 2 +- .../EmptyXcodeServerViewController.swift | 2 +- Buildasaur/RACUIExtensions.swift | 2 +- Buildasaur/SyncerViewController.swift | 2 +- Buildasaur/TriggerViewController.swift | 4 +-- Podfile | 2 +- Podfile.lock | 30 +++++++++---------- 14 files changed, 62 insertions(+), 61 deletions(-) diff --git a/BuildaKit/Availability.swift b/BuildaKit/Availability.swift index a4adc5a..2156fd3 100644 --- a/BuildaKit/Availability.swift +++ b/BuildaKit/Availability.swift @@ -20,16 +20,16 @@ public class AvailabilityChecker { return SignalProducer { sink, _ in - sendNext(sink, .Checking) + sink.sendNext(.Checking) NetworkUtils.checkAvailabilityOfXcodeServerWithCurrentSettings(input, completion: { (success, error) -> () in NSOperationQueue.mainQueue().addOperationWithBlock({ () -> Void in if success { - sendNext(sink, .Succeeded) + sink.sendNext(.Succeeded) } else { - sendNext(sink, .Failed(error)) + sink.sendNext(.Failed(error)) } - sendCompleted(sink) + sink.sendCompleted() }) }) } @@ -42,13 +42,13 @@ public class AvailabilityChecker { return SignalProducer { sink, _ in - sendNext(sink, .Checking) + sink.sendNext(.Checking) var project: Project! do { project = try Project(config: input) } catch { - sendNext(sink, .Failed(error)) + sink.sendNext(.Failed(error)) return } @@ -57,11 +57,11 @@ public class AvailabilityChecker { NSOperationQueue.mainQueue().addOperationWithBlock({ () -> Void in if success { - sendNext(sink, .Succeeded) + sink.sendNext(.Succeeded) } else { - sendNext(sink, .Failed(error)) + sink.sendNext(.Failed(error)) } - sendCompleted(sink) + sink.sendCompleted() }) }) } diff --git a/BuildaKit/RACUtils.swift b/BuildaKit/RACUtils.swift index dfbe12f..f65d85d 100644 --- a/BuildaKit/RACUtils.swift +++ b/BuildaKit/RACUtils.swift @@ -13,24 +13,24 @@ public func flattenArray(inProducer: SignalProducer<[T], E>) -> SignalProd return inProducer.flatMap(.Merge) { (vals: [T]) -> SignalProducer in return SignalProducer { sink, _ in - vals.forEach { sendNext(sink, $0) } - sendCompleted(sink) + vals.forEach { sink.sendNext($0) } + sink.sendCompleted() } } } extension SignalProducer { - public func ignoreErrors(action: ((E) -> ())? = nil) -> SignalProducer { + public func ignoreErrors(action: ((Error) -> ())? = nil) -> SignalProducer { return self.flatMapError { action?($0) - return SignalProducer { _, _ in } + return SignalProducer { _, _ in } } } //only sends values when condition has value true - public func forwardIf(condition: SignalProducer) -> SignalProducer { - return combineLatest(self, condition).map { (value: T, condition: Bool) -> T? in + public func forwardIf(condition: SignalProducer) -> SignalProducer { + return combineLatest(self, condition).map { (value: Value, condition: Bool) -> Value? in return condition ? value : nil }.ignoreNil() } diff --git a/Buildasaur/BranchWatchingViewController.swift b/Buildasaur/BranchWatchingViewController.swift index 1028a2b..86bd1f9 100644 --- a/Buildasaur/BranchWatchingViewController.swift +++ b/Buildasaur/BranchWatchingViewController.swift @@ -66,8 +66,9 @@ class BranchWatchingViewController: NSViewController, NSTableViewDelegate, NSTab } } - showables.start(Event.sink(error: { (error) -> () in - UIUtils.showAlertWithError(error) + showables.start(Observer( + failed: { (error) -> () in + UIUtils.showAlertWithError(error) }, completed: { [weak self] () -> () in self?.branchActivityIndicator.stopAnimation(nil) }, next: { [weak self] (branches) -> () in @@ -85,10 +86,10 @@ class BranchWatchingViewController: NSViewController, NSTableViewDelegate, NSTab sself.syncer.github.getBranchesOfRepo(repoName) { (branches, error) -> () in if let error = error { - sendError(sink, error) + sink.sendFailed(error) } else { - sendNext(sink, branches!) - sendCompleted(sink) + sink.sendNext(branches!) + sink.sendCompleted() } } }.observeOn(UIScheduler()) @@ -103,10 +104,10 @@ class BranchWatchingViewController: NSViewController, NSTableViewDelegate, NSTab sself.syncer.github.getOpenPullRequests(repoName) { (prs, error) -> () in if let error = error { - sendError(sink, error) + sink.sendFailed(error) } else { - sendNext(sink, prs!) - sendCompleted(sink) + sink.sendNext(prs!) + sink.sendCompleted() } } }.observeOn(UIScheduler()) diff --git a/Buildasaur/BuildTemplateViewController.swift b/Buildasaur/BuildTemplateViewController.swift index 75268af..bbe4adb 100644 --- a/Buildasaur/BuildTemplateViewController.swift +++ b/Buildasaur/BuildTemplateViewController.swift @@ -207,8 +207,8 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour do { let platformType = try XcodeDeviceParser.parseDeviceTypeFromProjectUrlAndScheme(sself.project.value.url, scheme: scheme).toPlatformType() - sendNext(sink, platformType) - sendCompleted(sink) + sink.sendNext(platformType) + sink.sendCompleted() } catch { UIUtils.showAlertWithError(error) } @@ -232,7 +232,7 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour let scheme = schemes[index] sself.selectedScheme.value = scheme.name } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.schemesPopup.rac_command = toRACCommand(action) @@ -267,7 +267,7 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour sself.selectedSchedule.value = schedule } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.schedulePopup.rac_command = toRACCommand(action) @@ -292,7 +292,7 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour let policy = policies[index] sself.cleaningPolicy.value = policy } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.cleaningPolicyPopup.rac_command = toRACCommand(action) @@ -344,7 +344,7 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour let filter = filters[index] sself.deviceFilter.value = filter } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.deviceFilterPopup.rac_command = toRACCommand(action) @@ -426,16 +426,16 @@ class BuildTemplateViewController: ConfigEditViewController, NSTableViewDataSour sself.xcodeServer.value.getDevices { (devices, error) -> () in if let error = error { - sendError(sink, error) + sink.sendFailed(error) } else { - sendNext(sink, devices!) + sink.sendNext(devices!) } - sendCompleted(sink) + sink.sendCompleted() } } .observeOn(UIScheduler()) - .start(Event.sink( - error: { UIUtils.showAlertWithError($0) }, + .start(Observer( + failed: { UIUtils.showAlertWithError($0) }, completed: completion, next: { [weak self] (devices) -> () in let processed = BuildTemplateViewController diff --git a/Buildasaur/DashboardViewController.swift b/Buildasaur/DashboardViewController.swift index 0dcc527..e65b565 100644 --- a/Buildasaur/DashboardViewController.swift +++ b/Buildasaur/DashboardViewController.swift @@ -55,8 +55,8 @@ class DashboardViewController: PresentableViewController { let anySyncerStateChanged = self.syncerViewModels.producer.flatMap(.Merge) { newViewModels -> SignalProducer, NoError> in return SignalProducer { sink, _ in - newViewModels.forEach { sendNext(sink, $0.syncer.activeSignalProducer.producer) } - sendCompleted(sink) + newViewModels.forEach { sink.sendNext($0.syncer.activeSignalProducer.producer) } + sink.sendCompleted() } }.flatten(.Merge) diff --git a/Buildasaur/EditableViewController.swift b/Buildasaur/EditableViewController.swift index d944cf8..a8a7f17 100644 --- a/Buildasaur/EditableViewController.swift +++ b/Buildasaur/EditableViewController.swift @@ -54,11 +54,11 @@ class EditableViewController: NSViewController { //and force user to fix the problem. final func goNext(animated animated: Bool = false) { - sendNext(self.sinkNext, animated) + self.sinkNext.sendNext(animated) } final func goPrevious() { - sendNext(self.sinkPrevious, ()) + self.sinkPrevious.sendNext(()) } //for overriding diff --git a/Buildasaur/EmptyBuildTemplateViewController.swift b/Buildasaur/EmptyBuildTemplateViewController.swift index fdf9872..e53ff71 100644 --- a/Buildasaur/EmptyBuildTemplateViewController.swift +++ b/Buildasaur/EmptyBuildTemplateViewController.swift @@ -88,7 +88,7 @@ class EmptyBuildTemplateViewController: EditableViewController { let index = sself.existingBuildTemplatesPopup.indexOfSelectedItem sself.selectItemAtIndex(index) } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.existingBuildTemplatesPopup.rac_command = toRACCommand(action) diff --git a/Buildasaur/EmptyProjectViewController.swift b/Buildasaur/EmptyProjectViewController.swift index f5669c9..984b931 100644 --- a/Buildasaur/EmptyProjectViewController.swift +++ b/Buildasaur/EmptyProjectViewController.swift @@ -98,7 +98,7 @@ class EmptyProjectViewController: EditableViewController { let index = sself.existingProjectsPopup.indexOfSelectedItem sself.selectItemAtIndex(index) } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.existingProjectsPopup.rac_command = toRACCommand(action) diff --git a/Buildasaur/EmptyXcodeServerViewController.swift b/Buildasaur/EmptyXcodeServerViewController.swift index b929945..9b3ce5e 100644 --- a/Buildasaur/EmptyXcodeServerViewController.swift +++ b/Buildasaur/EmptyXcodeServerViewController.swift @@ -82,7 +82,7 @@ class EmptyXcodeServerViewController: EditableViewController { let index = sself.existingXcodeServersPopup.indexOfSelectedItem sself.selectItemAtIndex(index) } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.existingXcodeServersPopup.rac_command = toRACCommand(action) diff --git a/Buildasaur/RACUIExtensions.swift b/Buildasaur/RACUIExtensions.swift index 384e32a..45351a4 100644 --- a/Buildasaur/RACUIExtensions.swift +++ b/Buildasaur/RACUIExtensions.swift @@ -88,7 +88,7 @@ extension NSButton { let button = input as! NSButton return SignalProducer { sink, _ in on.value = button.on - sendCompleted(sink) + sink.sendCompleted() } } diff --git a/Buildasaur/SyncerViewController.swift b/Buildasaur/SyncerViewController.swift index b0163c2..318f252 100644 --- a/Buildasaur/SyncerViewController.swift +++ b/Buildasaur/SyncerViewController.swift @@ -182,7 +182,7 @@ class SyncerViewController: ConfigEditViewController { sself.syncInterval.value = value } } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.syncIntervalStepper.rac_command = toRACCommand(action) diff --git a/Buildasaur/TriggerViewController.swift b/Buildasaur/TriggerViewController.swift index 973a80d..230f3ba 100644 --- a/Buildasaur/TriggerViewController.swift +++ b/Buildasaur/TriggerViewController.swift @@ -159,7 +159,7 @@ class TriggerViewController: NSViewController { let all = sself.kinds.value sself.selectedKind.value = all[index] } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.kindPopup.rac_command = toRACCommand(action) @@ -185,7 +185,7 @@ class TriggerViewController: NSViewController { let all = sself.phases.value sself.selectedPhase.value = all[index] } - sendCompleted(sink) + sink.sendCompleted() } let action = Action { (_: AnyObject?) in handler } self.phasePopup.rac_command = toRACCommand(action) diff --git a/Podfile b/Podfile index 3a71ff1..103759b 100644 --- a/Podfile +++ b/Podfile @@ -7,7 +7,7 @@ def pods_for_errbody end def rac - pod 'ReactiveCocoa', '~> 4.0.4-alpha-1' + pod 'ReactiveCocoa', '=4.0.0-RC.1' end def also_xcode_pods diff --git a/Podfile.lock b/Podfile.lock index 60109b6..3799830 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,7 +1,7 @@ PODS: - Alamofire (2.0.0-beta.3) - BuildaUtils (0.2.4) - - CryptoSwift (0.1.1) + - CryptoSwift (0.2.2) - ekgclient (0.3.0): - Alamofire (= 2.0.0-beta.3) - Ji (1.2.0): @@ -10,18 +10,18 @@ PODS: - Ji/Ji-libxml - Ji/Ji-libxml (1.2.0) - Nimble (3.0.0) - - ReactiveCocoa (4.0.4-alpha-1): - - ReactiveCocoa/UI (= 4.0.4-alpha-1) - - Result (~> 0.6-beta.1) - - ReactiveCocoa/Core (4.0.4-alpha-1): + - ReactiveCocoa (4.0.0-RC.1): + - ReactiveCocoa/UI (= 4.0.0-RC.1) + - Result (~> 1.0) + - ReactiveCocoa/Core (4.0.0-RC.1): - ReactiveCocoa/no-arc - - Result (~> 0.6-beta.1) - - ReactiveCocoa/no-arc (4.0.4-alpha-1): - - Result (~> 0.6-beta.1) - - ReactiveCocoa/UI (4.0.4-alpha-1): + - Result (~> 1.0) + - ReactiveCocoa/no-arc (4.0.0-RC.1): + - Result (~> 1.0) + - ReactiveCocoa/UI (4.0.0-RC.1): - ReactiveCocoa/Core - - Result (~> 0.6-beta.1) - - Result (0.6.0-beta.6) + - Result (~> 1.0) + - Result (1.0.1) - XcodeServerSDK (0.5.4): - BuildaUtils (~> 0.2.3) @@ -31,18 +31,18 @@ DEPENDENCIES: - ekgclient (~> 0.3.0) - Ji (~> 1.2.0) - Nimble (~> 3.0.0) - - ReactiveCocoa (~> 4.0.4-alpha-1) + - ReactiveCocoa (= 4.0.0-RC.1) - XcodeServerSDK (~> 0.5.4) SPEC CHECKSUMS: Alamofire: 39dddb7d3725d1771b1d2f7099c8bd45bd83ffbb BuildaUtils: c509ce20402656700006eb5ab80c735fbf2b3864 - CryptoSwift: c11640d3d66107efc8333e4131a5173f072b1d61 + CryptoSwift: d382228d6301c09474132417878a741c2a2e68cd ekgclient: 40f5d347e2ede450b3e50ac7c6bd84d96e7b84ad Ji: ddebb22f9ac445db6e884b66f78ea74fb135fdb7 Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926 - ReactiveCocoa: 618a2fc13d4ed80e380aa6fa56547cef43c7341d - Result: dc390d0b58f9ec43fcd536f1ebdd130803cc6cbc + ReactiveCocoa: 2b0f654beb7642b82cfd3fdb845205ae9889422c + Result: caef80340451e1f07492fa1e89117f83613bce24 XcodeServerSDK: 38c2bbdbc8e1387480adde299c0dc4455f0af11b COCOAPODS: 0.39.0