|
@@ -47,6 +47,8 @@ public class SwiftyStoreKit {
|
|
|
|
|
|
// As we can have multiple inflight queries and purchases, we store them in a dictionary by product id
|
|
// As we can have multiple inflight queries and purchases, we store them in a dictionary by product id
|
|
private var inflightQueries: [Set<String>: InAppProductQueryRequest] = [:]
|
|
private var inflightQueries: [Set<String>: InAppProductQueryRequest] = [:]
|
|
|
|
+ private var paymentQueueController = PaymentQueueController(paymentQueue: SKPaymentQueue.default())
|
|
|
|
+
|
|
private var inflightPurchases: [String: InAppProductPurchaseRequest] = [:]
|
|
private var inflightPurchases: [String: InAppProductPurchaseRequest] = [:]
|
|
private var restoreRequest: InAppProductPurchaseRequest?
|
|
private var restoreRequest: InAppProductPurchaseRequest?
|
|
private var completeTransactionsObserver: InAppCompleteTransactionsObserver?
|
|
private var completeTransactionsObserver: InAppCompleteTransactionsObserver?
|
|
@@ -112,6 +114,8 @@ public class SwiftyStoreKit {
|
|
|
|
|
|
public class func restorePurchases(atomically: Bool = true, completion: @escaping (RestoreResults) -> ()) {
|
|
public class func restorePurchases(atomically: Bool = true, completion: @escaping (RestoreResults) -> ()) {
|
|
|
|
|
|
|
|
+ // TODO: paymentQueueController.restorePurchases
|
|
|
|
+
|
|
sharedInstance.restoreRequest = InAppProductPurchaseRequest.restorePurchases(atomically: atomically) { results in
|
|
sharedInstance.restoreRequest = InAppProductPurchaseRequest.restorePurchases(atomically: atomically) { results in
|
|
|
|
|
|
sharedInstance.restoreRequest = nil
|
|
sharedInstance.restoreRequest = nil
|
|
@@ -207,6 +211,8 @@ public class SwiftyStoreKit {
|
|
completion(.error(error: .paymentNotAllowed))
|
|
completion(.error(error: .paymentNotAllowed))
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // TODO: paymentQueueController.startPayment
|
|
|
|
|
|
inflightPurchases[product.productIdentifier] = InAppProductPurchaseRequest.startPayment(product: product, atomically: atomically, applicationUsername: applicationUsername) { results in
|
|
inflightPurchases[product.productIdentifier] = InAppProductPurchaseRequest.startPayment(product: product, atomically: atomically, applicationUsername: applicationUsername) { results in
|
|
|
|
|