react-native-iap 16.6.0 → 16.6.1

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.
@@ -36,6 +36,7 @@ import dev.hyo.openiap.VerifyPurchaseProps
36
36
  import dev.hyo.openiap.VerifyPurchaseResultAndroid
37
37
  import dev.hyo.openiap.VerifyPurchaseResultHorizon
38
38
  import dev.hyo.openiap.InitConnectionConfig as OpenIapInitConnectionConfig
39
+ import dev.hyo.openiap.listener.OpenIapConnectionStateListener
39
40
  import dev.hyo.openiap.listener.OpenIapPurchaseErrorListener
40
41
  import dev.hyo.openiap.listener.OpenIapPurchaseUpdateListener
41
42
  import dev.hyo.openiap.listener.OpenIapUserChoiceBillingListener
@@ -299,6 +300,16 @@ class HybridRnIap : HybridRnIapSpec() {
299
300
  try {
300
301
  if (!listenersAttached) {
301
302
  RnIapLog.payload("listeners.attach", null)
303
+ // Service drop: clear the cached flag so requestPurchase fails
304
+ // fast (#408). JS still learns of it only from the next call.
305
+ openIap.addConnectionStateListener(
306
+ OpenIapConnectionStateListener {
307
+ isInitialized = false
308
+ RnIapLog.warn(
309
+ "billing service disconnected; connection must be re-initialized"
310
+ )
311
+ }
312
+ )
302
313
  openIap.addPurchaseUpdateListener(OpenIapPurchaseUpdateListener { p ->
303
314
  runCatching {
304
315
  RnIapLog.result(
@@ -589,7 +600,7 @@ class HybridRnIap : HybridRnIapSpec() {
589
600
  }
590
601
 
591
602
  if (rejectDisconnectedPurchase(isInitialized) { error ->
592
- RnIapLog.warn("requestPurchase called before initConnection")
603
+ RnIapLog.warn("requestPurchase without an active billing connection")
593
604
  sendPurchaseError(toErrorResult(error))
594
605
  }) {
595
606
  return@async defaultResult
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "spec": "3.4.0",
3
- "google": "3.5.1",
3
+ "google": "3.5.2",
4
4
  "apple": "3.4.0"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "16.6.0",
3
+ "version": "16.6.1",
4
4
  "description": "React Native In-App Purchases module for iOS and Android using Nitro",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",