@capgo/native-purchases 8.6.1 → 8.6.2

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.
@@ -42,7 +42,7 @@ import org.json.JSONArray;
42
42
  @CapacitorPlugin(name = "NativePurchases")
43
43
  public class NativePurchasesPlugin extends Plugin {
44
44
 
45
- private final String pluginVersion = "8.6.1";
45
+ private final String pluginVersion = "8.6.2";
46
46
  public static final String TAG = "NativePurchases";
47
47
  private static final int BILLING_CONNECTION_MAX_ATTEMPTS = 3;
48
48
  private static final long BILLING_SETUP_TIMEOUT_SECONDS = 10;
@@ -427,14 +427,15 @@ public class NativePurchasesPlugin extends Plugin {
427
427
  @Override
428
428
  public void onBillingServiceDisconnected() {
429
429
  Log.d(TAG, "onBillingServiceDisconnected() called");
430
+ if (!setupSettled.compareAndSet(false, true)) {
431
+ Log.d(TAG, "Billing service disconnected after setup settled");
432
+ return;
433
+ }
430
434
  synchronized (billingClientLock) {
431
435
  if (billingClient == client) {
432
436
  billingClient = null;
433
437
  }
434
438
  }
435
- if (!setupSettled.compareAndSet(false, true)) {
436
- return;
437
- }
438
439
  setupError[0] = BillingResult.newBuilder()
439
440
  .setResponseCode(BillingClient.BillingResponseCode.SERVICE_DISCONNECTED)
440
441
  .setDebugMessage("Billing service disconnected during setup")
@@ -467,6 +468,13 @@ public class NativePurchasesPlugin extends Plugin {
467
468
  throw new RuntimeException(getBillingSetupErrorMessage(setupError[0]));
468
469
  }
469
470
 
471
+ synchronized (billingClientLock) {
472
+ if (billingClient != client || !client.isReady()) {
473
+ closeBillingClientLocked();
474
+ throw new RuntimeException("Billing service disconnected. Please try again.");
475
+ }
476
+ }
477
+
470
478
  Log.d(TAG, "Billing client setup completed successfully");
471
479
  } catch (InterruptedException e) {
472
480
  Thread.currentThread().interrupt();
@@ -8,7 +8,7 @@ enum PurchaseAction {
8
8
  NONE
9
9
  }
10
10
 
11
- final class PurchaseActionDecider {
11
+ public final class PurchaseActionDecider {
12
12
 
13
13
  private PurchaseActionDecider() {}
14
14
 
@@ -23,7 +23,7 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
23
23
  CAPPluginMethod(name: "getStorefront", returnType: CAPPluginReturnPromise)
24
24
  ]
25
25
 
26
- private let pluginVersion: String = "8.6.1"
26
+ private let pluginVersion: String = "8.6.2"
27
27
  private var transactionUpdatesTask: Task<Void, Never>?
28
28
 
29
29
  @objc func getPluginVersion(_ call: CAPPluginCall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-purchases",
3
- "version": "8.6.1",
3
+ "version": "8.6.2",
4
4
  "description": "In-app Subscriptions Made Easy",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",