expo-iap 5.6.0 → 5.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.
@@ -7,6 +7,7 @@ import dev.hyo.openiap.OpenIapModule
7
7
  import dev.hyo.openiap.ProductQueryType
8
8
  import dev.hyo.openiap.SubscriptionProductReplacementParamsAndroid
9
9
  import dev.hyo.openiap.SubscriptionReplacementModeAndroid
10
+ import dev.hyo.openiap.listener.OpenIapConnectionStateListener
10
11
  import dev.hyo.openiap.listener.OpenIapDeveloperProvidedBillingListener
11
12
  import dev.hyo.openiap.listener.OpenIapPurchaseErrorListener
12
13
  import dev.hyo.openiap.listener.OpenIapPurchaseUpdateListener
@@ -30,6 +31,7 @@ object ExpoIapHelper {
30
31
  val userChoiceBilling: OpenIapUserChoiceBillingListener,
31
32
  val developerProvidedBilling: OpenIapDeveloperProvidedBillingListener,
32
33
  val subscriptionBillingIssue: OpenIapSubscriptionBillingIssueListener,
34
+ val connectionState: OpenIapConnectionStateListener,
33
35
  )
34
36
 
35
37
  internal fun serializeOpenIapError(error: OpenIapError): Map<String, Any?> =
@@ -440,12 +442,21 @@ object ExpoIapHelper {
440
442
  }
441
443
  openIap.addSubscriptionBillingIssueListener(subscriptionBillingIssueListener)
442
444
 
445
+ // Diagnostic only. connectionReady gates event emission, so clearing it
446
+ // here would buffer the purchase error instead of sending it (#408).
447
+ val connectionStateListener =
448
+ OpenIapConnectionStateListener {
449
+ ExpoIapLog.warning("billing service disconnected; connection must be re-initialized")
450
+ }
451
+ openIap.addConnectionStateListener(connectionStateListener)
452
+
443
453
  return ListenerHandles(
444
454
  purchaseUpdate = purchaseUpdateListener,
445
455
  purchaseError = purchaseErrorListener,
446
456
  userChoiceBilling = userChoiceBillingListener,
447
457
  developerProvidedBilling = developerProvidedBillingListener,
448
458
  subscriptionBillingIssue = subscriptionBillingIssueListener,
459
+ connectionState = connectionStateListener,
449
460
  )
450
461
  }
451
462
 
@@ -459,5 +470,6 @@ object ExpoIapHelper {
459
470
  openIap.removeUserChoiceBillingListener(handles.userChoiceBilling)
460
471
  openIap.removeDeveloperProvidedBillingListener(handles.developerProvidedBilling)
461
472
  openIap.removeSubscriptionBillingIssueListener(handles.subscriptionBillingIssue)
473
+ openIap.removeConnectionStateListener(handles.connectionState)
462
474
  }
463
475
  }
@@ -159,13 +159,6 @@ class ExpoIapModule : Module() {
159
159
  ExpoIapLog.warning("Activity not available during initConnection")
160
160
  }
161
161
 
162
- // If already connected, short-circuit
163
- if (connectionReady.get()) {
164
- ExpoIapLog.result("initConnection", true)
165
- promise.resolve(true)
166
- return@withLock
167
- }
168
-
169
162
  // Attach listeners early to avoid races during init
170
163
  if (listenerHandles == null) {
171
164
  listenerHandles =
@@ -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": "expo-iap",
3
- "version": "5.6.0",
3
+ "version": "5.6.1",
4
4
  "description": "In App Purchase module in Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",