react-native-iap 12.15.6 → 12.15.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,7 +37,7 @@ fun Promise.safeReject(
37
37
  throwable: Throwable?,
38
38
  ) {
39
39
  try {
40
- this.reject(code, message, throwable)
40
+ this.reject(code ?: "", message, throwable)
41
41
  } catch (oce: ObjectAlreadyConsumedException) {
42
42
  Log.d(TAG, "Already consumed ${oce.message}")
43
43
  }
@@ -592,10 +592,10 @@ class RNIapIosSk2iOS15: Sk2Delegate {
592
592
  reject: @escaping RCTPromiseRejectBlock = { _, _, _ in }
593
593
  ) {
594
594
  Task {
595
- var purchasedItems: [Transaction] = []
595
+ var purchasedItemsSerialized: [[String: Any?]] = []
596
596
 
597
- func addTransaction(transaction: Transaction) {
598
- purchasedItems.append( transaction)
597
+ func addTransaction(transaction: Transaction, verification: VerificationResult<Transaction>) {
598
+ purchasedItemsSerialized.append(serialize(transaction, verification))
599
599
  if alsoPublishToEventListener {
600
600
  self.sendEvent?("purchase-updated", serialize(transaction))
601
601
  }
@@ -606,19 +606,19 @@ class RNIapIosSk2iOS15: Sk2Delegate {
606
606
  }
607
607
  }
608
608
  // Iterate through all of the user's purchased products.
609
- for await result in onlyIncludeActiveItems ? Transaction.currentEntitlements : Transaction.all {
609
+ for await verification in onlyIncludeActiveItems ? Transaction.currentEntitlements : Transaction.all {
610
610
  do {
611
611
  // Check whether the transaction is verified. If it isn’t, catch `failedVerification` error.
612
- let transaction = try checkVerified(result)
612
+ let transaction = try checkVerified(verification)
613
613
  // Check the `productType` of the transaction and get the corresponding product from the store.
614
614
  if !onlyIncludeActiveItems {
615
- addTransaction(transaction: transaction)
615
+ addTransaction(transaction: transaction, verification: verification)
616
616
  continue
617
617
  }
618
618
  switch transaction.productType {
619
619
  case .nonConsumable:
620
620
  if await productStore.getProduct(productID: transaction.productID) != nil {
621
- addTransaction(transaction: transaction)
621
+ addTransaction(transaction: transaction, verification: verification)
622
622
  }
623
623
 
624
624
  case .nonRenewable:
@@ -633,18 +633,18 @@ class RNIapIosSk2iOS15: Sk2Delegate {
633
633
  to: transaction.purchaseDate)!
634
634
 
635
635
  if currentDate < expirationDate {
636
- addTransaction(transaction: transaction)
636
+ addTransaction(transaction: transaction, verification: verification)
637
637
  }
638
638
  }
639
639
 
640
640
  case .autoRenewable:
641
641
  if await productStore.getProduct(productID: transaction.productID) != nil {
642
- addTransaction(transaction: transaction)
642
+ addTransaction(transaction: transaction, verification: verification)
643
643
  }
644
644
 
645
645
  case .consumable:
646
646
  if await productStore.getProduct(productID: transaction.productID) != nil {
647
- addTransaction(transaction: transaction)
647
+ addTransaction(transaction: transaction, verification: verification)
648
648
  }
649
649
 
650
650
  default:
@@ -674,7 +674,7 @@ class RNIapIosSk2iOS15: Sk2Delegate {
674
674
  // group, so products in the subscriptions array all belong to the same group. The statuses that
675
675
  // `product.subscription.status` returns apply to the entire subscription group.
676
676
  // subscriptionGroupStatus = try? await subscriptions.first?.subscription?.status.first?.state
677
- resolve(purchasedItems.map({(t: Transaction) in serialize(t)}))
677
+ resolve(purchasedItemsSerialized)
678
678
  }
679
679
  }
680
680
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "12.15.6",
3
+ "version": "12.15.7",
4
4
  "description": "React Native In App Purchase Module.",
5
5
  "repository": "https://github.com/hyochan/react-native-iap",
6
6
  "author": "hyochan <hyochan.dev@gmail.com> (https://github.com/hyochan)",