@capgo/native-purchases 7.16.3-alpha.2 → 7.16.3-alpha.3
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 = "7.16.3-alpha.
|
|
45
|
+
private final String pluginVersion = "7.16.3-alpha.3";
|
|
46
46
|
public static final String TAG = "NativePurchases";
|
|
47
47
|
private static final Phaser semaphoreReady = new Phaser(1);
|
|
48
48
|
private BillingClient billingClient;
|
|
@@ -52,10 +52,32 @@ public class NativePurchasesPlugin extends Plugin {
|
|
|
52
52
|
@PluginMethod
|
|
53
53
|
public void isBillingSupported(PluginCall call) {
|
|
54
54
|
Log.d(TAG, "isBillingSupported() called");
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
try {
|
|
56
|
+
// Try to initialize billing client to check if billing is actually available
|
|
57
|
+
// Pass null so initBillingClient doesn't reject the call - we'll handle the result ourselves
|
|
58
|
+
this.initBillingClient(null);
|
|
59
|
+
// If initialization succeeded, billing is supported
|
|
60
|
+
JSObject ret = new JSObject();
|
|
61
|
+
ret.put("isBillingSupported", true);
|
|
62
|
+
Log.d(TAG, "isBillingSupported() returning true - billing client initialized successfully");
|
|
63
|
+
closeBillingClient();
|
|
64
|
+
call.resolve(ret);
|
|
65
|
+
} catch (RuntimeException e) {
|
|
66
|
+
Log.e(TAG, "isBillingSupported() - billing client initialization failed: " + e.getMessage());
|
|
67
|
+
closeBillingClient();
|
|
68
|
+
// Return false instead of rejecting - this is a check method
|
|
69
|
+
JSObject ret = new JSObject();
|
|
70
|
+
ret.put("isBillingSupported", false);
|
|
71
|
+
Log.d(TAG, "isBillingSupported() returning false - billing not available");
|
|
72
|
+
call.resolve(ret);
|
|
73
|
+
} catch (Exception e) {
|
|
74
|
+
Log.e(TAG, "isBillingSupported() - unexpected error: " + e.getMessage());
|
|
75
|
+
closeBillingClient();
|
|
76
|
+
JSObject ret = new JSObject();
|
|
77
|
+
ret.put("isBillingSupported", false);
|
|
78
|
+
Log.d(TAG, "isBillingSupported() returning false - unexpected error");
|
|
79
|
+
call.resolve(ret);
|
|
80
|
+
}
|
|
59
81
|
}
|
|
60
82
|
|
|
61
83
|
@Override
|
|
@@ -24,7 +24,7 @@ public class NativePurchasesPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
24
24
|
CAPPluginMethod(name: "isEntitledToOldBusinessModel", returnType: CAPPluginReturnPromise)
|
|
25
25
|
]
|
|
26
26
|
|
|
27
|
-
private let pluginVersion: String = "7.16.3-alpha.
|
|
27
|
+
private let pluginVersion: String = "7.16.3-alpha.3"
|
|
28
28
|
private var transactionUpdatesTask: Task<Void, Never>?
|
|
29
29
|
|
|
30
30
|
@objc func getPluginVersion(_ call: CAPPluginCall) {
|