Skip to content

Commit 0e1c0e2

Browse files
committed
'Cancel' for PromiseKit --
* Delete CancellableGuarantee and all its usages * In PromiseKit Core: instead of using additional functions and methods with the 'CC' suffix, created a new 'cancellable' function to wrap any Promise or Guarantee * In the extensions: Rename methods with 'CC' suffix to 'cancellable' prefix (may revisit this) * Fix the CancellableCatchable 'recover' methods to properly handle cancellation errors * Added an 'afterTask' property to Guarantee, to keep track of the task for calls to 'after'. This way the timer can be appropriately cancelled if the returned Guarantee is passed to the new 'cancellable' function. (may revisit this) * Update all cancellable tests for the cancellable API changes
1 parent fe11657 commit 0e1c0e2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Sources/SKProductsRequest+Promise.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extension SKProductsRequest {
5959

6060
- Returns: A cancellable promise that fulfills if the request succeeds.
6161
*/
62-
public func startCC(_: PMKNamespacer) -> CancellablePromise<SKProductsResponse> {
62+
public func cancellableStart(_: PMKNamespacer) -> CancellablePromise<SKProductsResponse> {
6363
let proxy = SKDelegate()
6464
delegate = proxy
6565
proxy.retainCycle = proxy

Sources/SKReceiptRefreshRequest+Promise.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private class ReceiptRefreshObserver: NSObject, SKRequestDelegate, CancellableTa
4545
//////////////////////////////////////////////////////////// Cancellation
4646

4747
extension SKReceiptRefreshRequest {
48-
public func promiseCC() -> CancellablePromise<SKReceiptRefreshRequest> {
48+
public func cancellablePromise() -> CancellablePromise<SKReceiptRefreshRequest> {
4949
let rro = ReceiptRefreshObserver(request: self)
5050
return CancellablePromise(task: rro, promise: rro.promise, resolver: rro.seal)
5151
}

Tests/TestStoreKit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extension SKProductsRequestTests {
4040
let ex = expectation(description: "")
4141

4242
let request = MockProductsRequest()
43-
request.startCC(.promise).done { _ in
43+
request.cancellableStart(.promise).done { _ in
4444
XCTFail()
4545
}.catch(policy: .allErrors) {
4646
$0.isCancelled ? ex.fulfill() : XCTFail()

0 commit comments

Comments
 (0)