react-native-iap 9.0.0-beta3 → 9.0.0-beta4

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.
Binary file
@@ -200,11 +200,13 @@ class RNIapModule(
200
200
  val skuList = ArrayList<QueryProductDetailsParams.Product>()
201
201
  for (i in 0 until skuArr.size()) {
202
202
  if (skuArr.getType(i) == ReadableType.String) {
203
- val sku: String = skuArr.getString(i)
204
- skuList.add(
205
- QueryProductDetailsParams.Product.newBuilder().setProductId(sku)
206
- .setProductType(type).build()
207
- )
203
+ val sku = skuArr.getString(i)
204
+ sku?.let {
205
+ skuList.add(
206
+ QueryProductDetailsParams.Product.newBuilder().setProductId(sku)
207
+ .setProductType(type).build()
208
+ )
209
+ }
208
210
  }
209
211
  }
210
212
  val params = QueryProductDetailsParams.newBuilder().setProductList(skuList)
@@ -386,10 +388,10 @@ class RNIapModule(
386
388
  type: String,
387
389
  sku: String, // TODO: should this now be an array?
388
390
  purchaseToken: String?,
389
- prorationMode: Int?,
391
+ prorationMode: Int,
390
392
  obfuscatedAccountId: String?,
391
393
  obfuscatedProfileId: String?,
392
- selectedOfferIndex: Int?, // New optional parameter in V5, TODO: should it be an array?
394
+ selectedOfferIndex: Int, // New optional parameter in V5, TODO: should it be an array?
393
395
  promise: Promise
394
396
  ) {
395
397
  val activity = currentActivity
@@ -419,7 +421,7 @@ class RNIapModule(
419
421
  return@ensureConnection
420
422
  }
421
423
  var productParams = BillingFlowParams.ProductDetailsParams.newBuilder().setProductDetails(selectedSku)
422
- if (selectedOfferIndex != null && (
424
+ if (selectedOfferIndex > -1 && (
423
425
  selectedSku.subscriptionOfferDetails?.size
424
426
  ?: 0
425
427
  ) > selectedOfferIndex
@@ -20,10 +20,10 @@ interface RNIapModuleInterface {
20
20
  type: String,
21
21
  sku: String,
22
22
  purchaseToken: String?,
23
- prorationMode: Int?,
23
+ prorationMode: Int,
24
24
  obfuscatedAccountId: String?,
25
25
  obfuscatedProfileId: String?,
26
- selectedOfferIndex: Int?, // New optional parameter in V5 (added to maintain interface consistency)
26
+ selectedOfferIndex: Int, // New optional parameter in V5 (added to maintain interface consistency)
27
27
  promise: Promise
28
28
  )
29
29
  fun acknowledgePurchase(
@@ -196,8 +196,10 @@ class RNIapModuleV4(
196
196
  val skuList = ArrayList<String>()
197
197
  for (i in 0 until skuArr.size()) {
198
198
  if (skuArr.getType(i) == ReadableType.String) {
199
- val sku: String = skuArr.getString(i)
200
- skuList.add(sku)
199
+ val sku = skuArr.getString(i)
200
+ sku?.let {
201
+ skuList.add(sku)
202
+ }
201
203
  }
202
204
  }
203
205
  val params = SkuDetailsParams.newBuilder()
@@ -361,10 +363,10 @@ class RNIapModuleV4(
361
363
  type: String,
362
364
  sku: String,
363
365
  purchaseToken: String?,
364
- prorationMode: Int?,
366
+ prorationMode: Int,
365
367
  obfuscatedAccountId: String?,
366
368
  obfuscatedProfileId: String?,
367
- selectedOfferIndex: Int?, // New optional parameter in V5 (added to maintain interface consistency)
369
+ selectedOfferIndex: Int, // New optional parameter in V5 (added to maintain interface consistency)
368
370
  promise: Promise
369
371
  ) {
370
372
  val activity = currentActivity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "9.0.0-beta3",
3
+ "version": "9.0.0-beta4",
4
4
  "packageManager": "yarn@3.2.0",
5
5
  "description": "React Native In App Purchase Module.",
6
6
  "main": "index.js",
package/src/iap.js CHANGED
@@ -310,7 +310,7 @@ export var requestPurchase = function (_a) {
310
310
  * @returns {Promise<SubscriptionPurchase | null>} Promise resolves to null when using proratioModesAndroid=DEFERRED, and to a SubscriptionPurchase otherwise
311
311
  */
312
312
  export var requestSubscription = function (_a) {
313
- var sku = _a.sku, _b = _a.andDangerouslyFinishTransactionAutomaticallyIOS, andDangerouslyFinishTransactionAutomaticallyIOS = _b === void 0 ? false : _b, _c = _a.purchaseTokenAndroid, purchaseTokenAndroid = _c === void 0 ? undefined : _c, _d = _a.prorationModeAndroid, prorationModeAndroid = _d === void 0 ? -1 : _d, _e = _a.obfuscatedAccountIdAndroid, obfuscatedAccountIdAndroid = _e === void 0 ? undefined : _e, _f = _a.obfuscatedProfileIdAndroid, obfuscatedProfileIdAndroid = _f === void 0 ? undefined : _f, _g = _a.selectedOfferIndex, selectedOfferIndex = _g === void 0 ? undefined : _g;
313
+ var sku = _a.sku, _b = _a.andDangerouslyFinishTransactionAutomaticallyIOS, andDangerouslyFinishTransactionAutomaticallyIOS = _b === void 0 ? false : _b, _c = _a.purchaseTokenAndroid, purchaseTokenAndroid = _c === void 0 ? undefined : _c, _d = _a.prorationModeAndroid, prorationModeAndroid = _d === void 0 ? -1 : _d, _e = _a.obfuscatedAccountIdAndroid, obfuscatedAccountIdAndroid = _e === void 0 ? undefined : _e, _f = _a.obfuscatedProfileIdAndroid, obfuscatedProfileIdAndroid = _f === void 0 ? undefined : _f, _g = _a.selectedOfferIndex, selectedOfferIndex = _g === void 0 ? -1 : _g;
314
314
  return (Platform.select({
315
315
  ios: function () { return __awaiter(void 0, void 0, void 0, function () {
316
316
  return __generator(this, function (_a) {