react-native-purchases 7.1.0 → 7.3.0
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/GoogleUpgradeInfo.java +19 -0
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +27 -35
- package/ios/RNPurchases.m +1 -1
- package/package.json +2 -2
- 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 '7.
|
|
32
|
+
versionName '7.3.0'
|
|
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:7.
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:7.3.0'
|
|
125
125
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
126
126
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.revenuecat.purchases.react;
|
|
2
|
+
|
|
3
|
+
class GoogleUpgradeInfo {
|
|
4
|
+
private final String oldProductIdentifier;
|
|
5
|
+
private final Integer prorationMode;
|
|
6
|
+
|
|
7
|
+
public GoogleUpgradeInfo(String oldProductIdentifier, Integer prorationMode) {
|
|
8
|
+
this.oldProductIdentifier = oldProductIdentifier;
|
|
9
|
+
this.prorationMode = prorationMode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public String getOldProductIdentifier() {
|
|
13
|
+
return oldProductIdentifier;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public Integer getProrationMode() {
|
|
17
|
+
return prorationMode;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -37,7 +37,6 @@ import java.util.ArrayList;
|
|
|
37
37
|
import java.util.HashMap;
|
|
38
38
|
import java.util.List;
|
|
39
39
|
import java.util.Map;
|
|
40
|
-
import java.util.Set;
|
|
41
40
|
|
|
42
41
|
import kotlin.UninitializedPropertyAccessException;
|
|
43
42
|
|
|
@@ -46,7 +45,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
46
45
|
private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
|
|
47
46
|
private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
|
|
48
47
|
public static final String PLATFORM_NAME = "react-native";
|
|
49
|
-
public static final String PLUGIN_VERSION = "7.
|
|
48
|
+
public static final String PLUGIN_VERSION = "7.3.0";
|
|
50
49
|
|
|
51
50
|
private final ReactApplicationContext reactContext;
|
|
52
51
|
|
|
@@ -145,19 +144,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
145
144
|
@Nullable final ReadableMap googleInfo,
|
|
146
145
|
@Nullable final String presentedOfferingIdentifier,
|
|
147
146
|
final Promise promise) {
|
|
148
|
-
|
|
149
|
-
Integer googleProrationMode = null;
|
|
150
|
-
|
|
151
|
-
if (googleProductChangeInfo != null) {
|
|
152
|
-
// GoogleProductChangeInfo in V6 and later
|
|
153
|
-
googleOldProductId = googleProductChangeInfo.hasKey("oldProductIdentifier") ? googleProductChangeInfo.getString("oldProductIdentifier") : null;
|
|
154
|
-
googleProrationMode = googleProductChangeInfo.hasKey("prorationMode") ? googleProductChangeInfo.getInt("prorationMode") : null;
|
|
155
|
-
|
|
156
|
-
// Legacy UpgradeInfo in V5 and earlier
|
|
157
|
-
if (googleOldProductId == null) {
|
|
158
|
-
googleOldProductId = googleProductChangeInfo.hasKey("oldSKU") ? googleProductChangeInfo.getString("oldSKU") : null;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
147
|
+
GoogleUpgradeInfo googleUpgradeInfo = getUpgradeInfo(googleProductChangeInfo);
|
|
161
148
|
|
|
162
149
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
163
150
|
|
|
@@ -166,8 +153,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
166
153
|
productIdentifier,
|
|
167
154
|
type,
|
|
168
155
|
null,
|
|
169
|
-
|
|
170
|
-
|
|
156
|
+
googleUpgradeInfo.getOldProductIdentifier(),
|
|
157
|
+
googleUpgradeInfo.getProrationMode(),
|
|
171
158
|
googleIsPersonalized,
|
|
172
159
|
presentedOfferingIdentifier,
|
|
173
160
|
getOnResult(promise));
|
|
@@ -180,27 +167,16 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
180
167
|
@Nullable final String discountTimestamp,
|
|
181
168
|
@Nullable final ReadableMap googleInfo,
|
|
182
169
|
final Promise promise) {
|
|
183
|
-
|
|
184
|
-
Integer googleProrationMode = null;
|
|
170
|
+
GoogleUpgradeInfo googleUpgradeInfo = getUpgradeInfo(googleProductChangeInfo);
|
|
185
171
|
|
|
186
|
-
if (googleProductChangeInfo != null) {
|
|
187
|
-
// GoogleProductChangeInfo in V6 and later
|
|
188
|
-
googleOldProductId = googleProductChangeInfo.hasKey("oldProductIdentifier") ? googleProductChangeInfo.getString("oldProductIdentifier") : null;
|
|
189
|
-
googleProrationMode = googleProductChangeInfo.hasKey("prorationMode") ? googleProductChangeInfo.getInt("prorationMode") : null;
|
|
190
|
-
|
|
191
|
-
// Legacy UpgradeInfo in V5 and earlier
|
|
192
|
-
if (googleOldProductId == null) {
|
|
193
|
-
googleOldProductId = googleProductChangeInfo.hasKey("oldSKU") ? googleProductChangeInfo.getString("oldSKU") : null;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
172
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
197
173
|
|
|
198
174
|
CommonKt.purchasePackage(
|
|
199
175
|
getCurrentActivity(),
|
|
200
176
|
packageIdentifier,
|
|
201
177
|
offeringIdentifier,
|
|
202
|
-
|
|
203
|
-
|
|
178
|
+
googleUpgradeInfo.getOldProductIdentifier(),
|
|
179
|
+
googleUpgradeInfo.getProrationMode(),
|
|
204
180
|
googleIsPersonalized,
|
|
205
181
|
getOnResult(promise));
|
|
206
182
|
}
|
|
@@ -213,8 +189,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
213
189
|
@Nullable final ReadableMap googleInfo,
|
|
214
190
|
@Nullable final String presentedOfferingIdentifier,
|
|
215
191
|
final Promise promise) {
|
|
216
|
-
|
|
217
|
-
Integer googleProrationMode = upgradeInfo != null && upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null;
|
|
192
|
+
GoogleUpgradeInfo googleUpgradeInfo = getUpgradeInfo(upgradeInfo);
|
|
218
193
|
|
|
219
194
|
Boolean googleIsPersonalized = googleInfo != null && googleInfo.hasKey("isPersonalizedPrice") ? googleInfo.getBoolean("isPersonalizedPrice") : null;
|
|
220
195
|
|
|
@@ -222,8 +197,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
222
197
|
getCurrentActivity(),
|
|
223
198
|
productIdentifer,
|
|
224
199
|
optionIdentifier,
|
|
225
|
-
|
|
226
|
-
|
|
200
|
+
googleUpgradeInfo.getOldProductIdentifier(),
|
|
201
|
+
googleUpgradeInfo.getProrationMode(),
|
|
227
202
|
googleIsPersonalized,
|
|
228
203
|
presentedOfferingIdentifier,
|
|
229
204
|
getOnResult(promise));
|
|
@@ -514,4 +489,21 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
514
489
|
};
|
|
515
490
|
}
|
|
516
491
|
|
|
492
|
+
private static GoogleUpgradeInfo getUpgradeInfo(ReadableMap upgradeInfo) {
|
|
493
|
+
String googleOldProductId = null;
|
|
494
|
+
Integer googleProrationMode = null;
|
|
495
|
+
|
|
496
|
+
if (upgradeInfo != null) {
|
|
497
|
+
// GoogleProductChangeInfo in V6 and later
|
|
498
|
+
googleOldProductId = upgradeInfo.hasKey("oldProductIdentifier") ? upgradeInfo.getString("oldProductIdentifier") : null;
|
|
499
|
+
googleProrationMode = upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null;
|
|
500
|
+
|
|
501
|
+
// Legacy UpgradeInfo in V5 and earlier
|
|
502
|
+
if (googleOldProductId == null) {
|
|
503
|
+
googleOldProductId = upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return new GoogleUpgradeInfo(googleOldProductId, googleProrationMode);
|
|
508
|
+
}
|
|
517
509
|
}
|
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": "7.
|
|
4
|
+
"version": "7.3.0",
|
|
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",
|
|
@@ -95,6 +95,6 @@
|
|
|
95
95
|
]
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@revenuecat/purchases-typescript-internal": "7.
|
|
98
|
+
"@revenuecat/purchases-typescript-internal": "7.3.0"
|
|
99
99
|
}
|
|
100
100
|
}
|
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/7.
|
|
5
|
+
<meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/7.3.0/" />
|
|
6
6
|
</head>
|
|
7
7
|
<body>
|
|
8
8
|
</body>
|