react-native-purchases 5.9.0 → 5.10.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.
- package/RNPurchases.podspec +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesConverters.kt +2 -1
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +49 -49
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesPackage.java +17 -17
- package/ios/RNPurchases.m +1 -1
- package/package.json +1 -1
- package/scripts/docs/index.html +1 -1
package/RNPurchases.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -29,7 +29,7 @@ android {
|
|
|
29
29
|
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
30
30
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
31
31
|
versionCode 1
|
|
32
|
-
versionName '5.
|
|
32
|
+
versionName '5.10.1'
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
buildTypes {
|
|
@@ -121,6 +121,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
121
121
|
dependencies {
|
|
122
122
|
//noinspection GradleDynamicVersion
|
|
123
123
|
api 'com.facebook.react:react-native:+'
|
|
124
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.13.2'
|
|
125
125
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
126
126
|
}
|
|
@@ -28,6 +28,7 @@ internal object RNPurchasesConverters {
|
|
|
28
28
|
key,
|
|
29
29
|
convertReadableMapToJson(readableMap.getMap(key))
|
|
30
30
|
)
|
|
31
|
+
|
|
31
32
|
ReadableType.Array -> jsonObject.put(
|
|
32
33
|
key,
|
|
33
34
|
convertReadableArrayToJson(readableMap.getArray(key))
|
|
@@ -42,7 +43,7 @@ internal object RNPurchasesConverters {
|
|
|
42
43
|
val array = JSONArray()
|
|
43
44
|
for (i in 0 until readableArray!!.size()) {
|
|
44
45
|
when (readableArray.getType(i)) {
|
|
45
|
-
ReadableType.Null -> {
|
|
46
|
+
ReadableType.Null -> {}
|
|
46
47
|
ReadableType.Boolean -> array.put(readableArray.getBoolean(i))
|
|
47
48
|
ReadableType.Number -> array.put(readableArray.getDouble(i))
|
|
48
49
|
ReadableType.String -> array.put(readableArray.getString(i))
|
|
@@ -70,12 +70,12 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
70
70
|
|
|
71
71
|
@ReactMethod
|
|
72
72
|
public void addListener(String eventName) {
|
|
73
|
-
|
|
73
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
@ReactMethod
|
|
77
77
|
public void removeListeners(Integer count) {
|
|
78
|
-
|
|
78
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
@ReactMethod
|
|
@@ -120,7 +120,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
120
120
|
@Override
|
|
121
121
|
public void onError(ErrorContainer errorContainer) {
|
|
122
122
|
promise.reject(errorContainer.getCode() + "", errorContainer.getMessage(),
|
|
123
|
-
|
|
123
|
+
convertMapToWriteableMap(errorContainer.getInfo()));
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
}
|
|
@@ -132,12 +132,12 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
132
132
|
@Nullable final String discountTimestamp,
|
|
133
133
|
final Promise promise) {
|
|
134
134
|
CommonKt.purchaseProduct(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
getCurrentActivity(),
|
|
136
|
+
productIdentifier,
|
|
137
|
+
upgradeInfo != null && upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null,
|
|
138
|
+
upgradeInfo != null && upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null,
|
|
139
|
+
type,
|
|
140
|
+
getOnResult(promise));
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
@ReactMethod
|
|
@@ -147,12 +147,12 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
147
147
|
@Nullable final String discountTimestamp,
|
|
148
148
|
final Promise promise) {
|
|
149
149
|
CommonKt.purchasePackage(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
getCurrentActivity(),
|
|
151
|
+
packageIdentifier,
|
|
152
|
+
offeringIdentifier,
|
|
153
|
+
upgradeInfo != null && upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null,
|
|
154
|
+
upgradeInfo != null && upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null,
|
|
155
|
+
getOnResult(promise));
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
@ReactMethod
|
|
@@ -227,8 +227,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
227
227
|
@Override
|
|
228
228
|
public void onReceived(@NonNull CustomerInfo customerInfo) {
|
|
229
229
|
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
.emit(RNPurchasesModule.CUSTOMER_INFO_UPDATED,
|
|
231
|
+
convertMapToWriteableMap(CustomerInfoMapperKt.map(customerInfo)));
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
@ReactMethod
|
|
@@ -243,7 +243,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
243
243
|
|
|
244
244
|
@ReactMethod
|
|
245
245
|
public void isConfigured(Promise promise) {
|
|
246
|
-
|
|
246
|
+
promise.resolve(Purchases.isConfigured());
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
//================================================================================
|
|
@@ -258,74 +258,74 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
258
258
|
|
|
259
259
|
@ReactMethod
|
|
260
260
|
public void setEmail(String email) {
|
|
261
|
-
|
|
261
|
+
SubscriberAttributesKt.setEmail(email);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
@ReactMethod
|
|
265
265
|
public void setPhoneNumber(String phoneNumber) {
|
|
266
|
-
|
|
266
|
+
SubscriberAttributesKt.setPhoneNumber(phoneNumber);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
@ReactMethod
|
|
270
270
|
public void setDisplayName(String displayName) {
|
|
271
|
-
|
|
271
|
+
SubscriberAttributesKt.setDisplayName(displayName);
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
@ReactMethod
|
|
275
275
|
public void setPushToken(String pushToken) {
|
|
276
|
-
|
|
276
|
+
SubscriberAttributesKt.setPushToken(pushToken);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// region Attribution IDs
|
|
280
280
|
|
|
281
281
|
@ReactMethod
|
|
282
282
|
public void collectDeviceIdentifiers() {
|
|
283
|
-
|
|
283
|
+
SubscriberAttributesKt.collectDeviceIdentifiers();
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
@ReactMethod
|
|
287
287
|
public void setAdjustID(String adjustID) {
|
|
288
|
-
|
|
288
|
+
SubscriberAttributesKt.setAdjustID(adjustID);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
@ReactMethod
|
|
292
292
|
public void setAppsflyerID(String appsflyerID) {
|
|
293
|
-
|
|
293
|
+
SubscriberAttributesKt.setAppsflyerID(appsflyerID);
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
@ReactMethod
|
|
297
297
|
public void setFBAnonymousID(String fbAnonymousID) {
|
|
298
|
-
|
|
298
|
+
SubscriberAttributesKt.setFBAnonymousID(fbAnonymousID);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
@ReactMethod
|
|
302
302
|
public void setMparticleID(String mparticleID) {
|
|
303
|
-
|
|
303
|
+
SubscriberAttributesKt.setMparticleID(mparticleID);
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
@ReactMethod
|
|
307
307
|
public void setCleverTapID(String cleverTapID) {
|
|
308
|
-
|
|
308
|
+
SubscriberAttributesKt.setCleverTapID(cleverTapID);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
@ReactMethod
|
|
312
312
|
public void setMixpanelDistinctID(String mixpanelDistinctID) {
|
|
313
|
-
|
|
313
|
+
SubscriberAttributesKt.setMixpanelDistinctID(mixpanelDistinctID);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
@ReactMethod
|
|
317
317
|
public void setFirebaseAppInstanceID(String firebaseAppInstanceId) {
|
|
318
|
-
|
|
318
|
+
SubscriberAttributesKt.setFirebaseAppInstanceID(firebaseAppInstanceId);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
@ReactMethod
|
|
322
322
|
public void setOnesignalID(String onesignalID) {
|
|
323
|
-
|
|
323
|
+
SubscriberAttributesKt.setOnesignalID(onesignalID);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
@ReactMethod
|
|
327
327
|
public void setAirshipChannelID(String airshipChannelID) {
|
|
328
|
-
|
|
328
|
+
SubscriberAttributesKt.setAirshipChannelID(airshipChannelID);
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
// endregion
|
|
@@ -364,25 +364,25 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
364
364
|
|
|
365
365
|
@ReactMethod
|
|
366
366
|
public void canMakePayments(ReadableArray features, final Promise promise) {
|
|
367
|
-
|
|
367
|
+
ArrayList<Integer> featureList = new ArrayList<>();
|
|
368
368
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
CommonKt.canMakePayments(reactContext, featureList, new OnResultAny<Boolean>() {
|
|
375
|
-
@Override
|
|
376
|
-
public void onError(@Nullable ErrorContainer errorContainer) {
|
|
377
|
-
promise.reject(errorContainer.getCode() + "", errorContainer.getMessage(),
|
|
378
|
-
convertMapToWriteableMap(errorContainer.getInfo()));
|
|
369
|
+
if (features != null) {
|
|
370
|
+
for (int i = 0; i < features.size(); i++) {
|
|
371
|
+
featureList.add(features.getInt(i));
|
|
372
|
+
}
|
|
379
373
|
}
|
|
374
|
+
CommonKt.canMakePayments(reactContext, featureList, new OnResultAny<Boolean>() {
|
|
375
|
+
@Override
|
|
376
|
+
public void onError(@Nullable ErrorContainer errorContainer) {
|
|
377
|
+
promise.reject(errorContainer.getCode() + "", errorContainer.getMessage(),
|
|
378
|
+
convertMapToWriteableMap(errorContainer.getInfo()));
|
|
379
|
+
}
|
|
380
380
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
381
|
+
@Override
|
|
382
|
+
public void onReceived(Boolean result) {
|
|
383
|
+
promise.resolve(result);
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
// endregion
|
|
@@ -402,7 +402,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
402
402
|
@Override
|
|
403
403
|
public void onError(ErrorContainer errorContainer) {
|
|
404
404
|
promise.reject(errorContainer.getCode() + "", errorContainer.getMessage(),
|
|
405
|
-
|
|
405
|
+
convertMapToWriteableMap(errorContainer.getInfo()));
|
|
406
406
|
}
|
|
407
407
|
};
|
|
408
408
|
}
|
|
@@ -15,20 +15,20 @@ import com.facebook.react.bridge.JavaScriptModule;
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
public class RNPurchasesPackage implements ReactPackage {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
18
|
+
@NonNull
|
|
19
|
+
@Override
|
|
20
|
+
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
21
|
+
return Arrays.<NativeModule>asList(new RNPurchasesModule(reactContext));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Deprecated from RN 0.47
|
|
25
|
+
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
|
26
|
+
return Collections.emptyList();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@NonNull
|
|
30
|
+
@Override
|
|
31
|
+
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
32
|
+
return Collections.emptyList();
|
|
33
|
+
}
|
|
34
|
+
}
|
package/ios/RNPurchases.m
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-purchases",
|
|
3
3
|
"title": "React Native Purchases",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.10.1",
|
|
5
5
|
"description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
package/scripts/docs/index.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html>
|
|
4
4
|
<head>
|
|
5
|
-
<meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.
|
|
5
|
+
<meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.10.1/" />
|
|
6
6
|
</head>
|
|
7
7
|
<body>
|
|
8
8
|
</body>
|