Эх сурвалжийг харах

add entitlement revocation only once

Stefanos Zachariadis 5 жил өмнө
parent
commit
f0a4198865

+ 5 - 4
Sources/SwiftyStoreKit/PaymentQueueController.swift

@@ -156,6 +156,11 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
     }
     
     func onEntitlementRevocation(_ revocation: EntitlementRevocation) {
+        guard entitlementRevocation == nil else {
+            print("SwiftyStoreKit.onEntitlementRevocation() should only be called once when the app launches. Ignoring this call")
+            return
+        }
+
         self.entitlementRevocation = revocation
     }
 
@@ -248,10 +253,6 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
     }
     
     func paymentQueue(_ queue: SKPaymentQueue, didRevokeEntitlementsForProductIdentifiers productIdentifiers: [String]) {
-        guard entitlementRevocation == nil else {
-            print("SwiftyStoreKit.onEntitlementRevocation() should only be called once when the app launches. Ignoring this call")
-            return
-        }
 
         self.entitlementRevocation?.callback(productIdentifiers)
     }