Преглед изворни кода

add entitlement revocation only once

Stefanos Zachariadis пре 5 година
родитељ
комит
f0a4198865
1 измењених фајлова са 5 додато и 4 уклоњено
  1. 5 4
      Sources/SwiftyStoreKit/PaymentQueueController.swift

+ 5 - 4
Sources/SwiftyStoreKit/PaymentQueueController.swift

@@ -156,6 +156,11 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
     }
     }
     
     
     func onEntitlementRevocation(_ revocation: EntitlementRevocation) {
     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
         self.entitlementRevocation = revocation
     }
     }
 
 
@@ -248,10 +253,6 @@ class PaymentQueueController: NSObject, SKPaymentTransactionObserver {
     }
     }
     
     
     func paymentQueue(_ queue: SKPaymentQueue, didRevokeEntitlementsForProductIdentifiers productIdentifiers: [String]) {
     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)
         self.entitlementRevocation?.callback(productIdentifiers)
     }
     }