react-native-iap 8.0.10 → 8.1.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.
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -49,7 +49,7 @@ class RNIapModule(reactContext: ReactApplicationContext) :
|
|
|
49
49
|
|
|
50
50
|
private fun ensureConnection(promise: Promise, callback: EnsureConnectionCallback) {
|
|
51
51
|
val billingClient = billingClientCache
|
|
52
|
-
if (billingClient
|
|
52
|
+
if (billingClient?.isReady == true) {
|
|
53
53
|
callback.run(billingClient)
|
|
54
54
|
return
|
|
55
55
|
}
|
|
@@ -58,7 +58,7 @@ class RNIapModule(reactContext: ReactApplicationContext) :
|
|
|
58
58
|
|
|
59
59
|
@ReactMethod
|
|
60
60
|
fun initConnection(promise: Promise) {
|
|
61
|
-
if (billingClientCache
|
|
61
|
+
if (billingClientCache?.isReady == true) {
|
|
62
62
|
Log.i(
|
|
63
63
|
TAG,
|
|
64
64
|
"Already initialized, you should only call initConnection() once when your app starts"
|
|
@@ -94,6 +94,7 @@ class RNIapModule(reactContext: ReactApplicationContext) :
|
|
|
94
94
|
|
|
95
95
|
override fun onBillingServiceDisconnected() {
|
|
96
96
|
try {
|
|
97
|
+
billingClientCache = null
|
|
97
98
|
promise.reject("initConnection", "Billing service disconnected")
|
|
98
99
|
} catch (oce: ObjectAlreadyConsumedException) {
|
|
99
100
|
Log.e(TAG, oce.message!!)
|
package/package.json
CHANGED
package/src/iap.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { EmitterSubscription } from 'react-native';
|
|
|
5
5
|
import { InAppPurchase, InstallSourceAndroid, Product, ProductPurchase, ProrationModesAndroid, PurchaseError, PurchaseResult, Subscription, SubscriptionPurchase } from './types';
|
|
6
6
|
export declare const getInstallSourceAndroid: () => InstallSourceAndroid;
|
|
7
7
|
/**
|
|
8
|
-
* Init module for purchase flow. Required on Android. In ios it will check
|
|
8
|
+
* Init module for purchase flow. Required on Android. In ios it will check whether user canMakePayment.
|
|
9
9
|
* @returns {Promise<boolean>}
|
|
10
10
|
*/
|
|
11
11
|
export declare const initConnection: () => Promise<boolean>;
|
|
@@ -121,7 +121,7 @@ export declare const buyPromotedProductIOS: () => Promise<void>;
|
|
|
121
121
|
/**
|
|
122
122
|
* Buy products or subscriptions with offers (iOS only)
|
|
123
123
|
*
|
|
124
|
-
* Runs the payment process with some
|
|
124
|
+
* Runs the payment process with some info you must fetch
|
|
125
125
|
* from your server.
|
|
126
126
|
* @param {string} sku The product identifier
|
|
127
127
|
* @param {string} forUser An user identifier on you system
|
|
@@ -190,8 +190,3 @@ export declare const getPendingPurchasesIOS: () => Promise<ProductPurchase[]>;
|
|
|
190
190
|
* @returns {Promise<null>}
|
|
191
191
|
*/
|
|
192
192
|
export declare const presentCodeRedemptionSheetIOS: () => Promise<null>;
|
|
193
|
-
/**
|
|
194
|
-
* Checks if the internal client is ready to be used (Android only)
|
|
195
|
-
* @returns {Promise<boolean>}
|
|
196
|
-
*/
|
|
197
|
-
export declare const isReadyAndroid: () => Promise<boolean>;
|
package/src/iap.js
CHANGED
|
@@ -71,7 +71,7 @@ var getNativeModule = function () {
|
|
|
71
71
|
: RNIapIos;
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
|
-
* Init module for purchase flow. Required on Android. In ios it will check
|
|
74
|
+
* Init module for purchase flow. Required on Android. In ios it will check whether user canMakePayment.
|
|
75
75
|
* @returns {Promise<boolean>}
|
|
76
76
|
*/
|
|
77
77
|
export var initConnection = function () {
|
|
@@ -463,7 +463,7 @@ var requestAgnosticReceiptValidationIos = function (receiptBody) { return __awai
|
|
|
463
463
|
/**
|
|
464
464
|
* Buy products or subscriptions with offers (iOS only)
|
|
465
465
|
*
|
|
466
|
-
* Runs the payment process with some
|
|
466
|
+
* Runs the payment process with some info you must fetch
|
|
467
467
|
* from your server.
|
|
468
468
|
* @param {string} sku The product identifier
|
|
469
469
|
* @param {string} forUser An user identifier on you system
|
|
@@ -551,12 +551,12 @@ export var validateReceiptAndroid = function (packageName, productId, productTok
|
|
|
551
551
|
export var validateReceiptAmazon = function (developerSecret, userId, receiptId, useSandbox) {
|
|
552
552
|
if (useSandbox === void 0) { useSandbox = true; }
|
|
553
553
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
554
|
-
var
|
|
554
|
+
var sandBoxUrl, url, response;
|
|
555
555
|
return __generator(this, function (_a) {
|
|
556
556
|
switch (_a.label) {
|
|
557
557
|
case 0:
|
|
558
|
-
|
|
559
|
-
url = "https://appstore-sdk.amazon.com/".concat(
|
|
558
|
+
sandBoxUrl = useSandbox ? 'sandbox/' : '';
|
|
559
|
+
url = "https://appstore-sdk.amazon.com/".concat(sandBoxUrl, "version/1.0/verifyReceiptId/developer/").concat(developerSecret, "/user/").concat(userId, "/receiptId/").concat(receiptId);
|
|
560
560
|
return [4 /*yield*/, fetch(url, {
|
|
561
561
|
method: 'GET',
|
|
562
562
|
headers: {
|
|
@@ -616,10 +616,3 @@ export var getPendingPurchasesIOS = function () { return __awaiter(void 0, void
|
|
|
616
616
|
export var presentCodeRedemptionSheetIOS = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
617
617
|
return [2 /*return*/, getIosModule().presentCodeRedemptionSheet()];
|
|
618
618
|
}); }); };
|
|
619
|
-
/**
|
|
620
|
-
* Checks if the internal client is ready to be used (Android only)
|
|
621
|
-
* @returns {Promise<boolean>}
|
|
622
|
-
*/
|
|
623
|
-
export var isReadyAndroid = function () {
|
|
624
|
-
return getAndroidModule().isReadyAndroid();
|
|
625
|
-
};
|