Skip to content

Commit

Permalink
Merge develop into feature/verify-receipt-auto-refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
bizz84 committed May 18, 2017
2 parents 0a794db + 0b759a0 commit 26338ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions SwiftyStoreKit/InAppProductQueryRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class InAppProductQueryRequest: NSObject, SKProductsRequestDelegate {

let retrievedProducts = Set<SKProduct>(response.products)
let invalidProductIDs = Set<String>(response.invalidProductIdentifiers)
callback(RetrieveResults(retrievedProducts: retrievedProducts,
performCallback(RetrieveResults(retrievedProducts: retrievedProducts,
invalidProductIDs: invalidProductIDs, error: nil))
}

Expand All @@ -68,6 +68,12 @@ class InAppProductQueryRequest: NSObject, SKProductsRequestDelegate {
}

func request(_ request: SKRequest, didFailWithError error: Error) {
callback(RetrieveResults(retrievedProducts: Set<SKProduct>(), invalidProductIDs: Set<String>(), error: error))
performCallback(RetrieveResults(retrievedProducts: Set<SKProduct>(), invalidProductIDs: Set<String>(), error: error))
}

private func performCallback(_ results: RetrieveResults) {
DispatchQueue.main.async {
self.callback(results)
}
}
}
10 changes: 7 additions & 3 deletions SwiftyStoreKit/InAppReceiptRefreshRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ class InAppReceiptRefreshRequest: NSObject, SKRequestDelegate {
print("\(k): \(v)")
}
}*/
callback(.success)
performCallback(.success)
}
func request(_ request: SKRequest, didFailWithError error: Error) {
// XXX could here check domain and error code to return typed exception
callback(.error(e: error))
performCallback(.error(e: error))
}
private func performCallback(_ result: ResultType) {
DispatchQueue.main.async {
self.callback(result)
}
}

}

0 comments on commit 26338ff

Please sign in to comment.