react-native-purchases 4.3.3 → 4.5.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 +3 -2
- package/android/build.gradle +2 -2
- package/android/build.gradle.bck +127 -0
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +11 -1
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +27 -1
- package/dist/purchases.d.ts +176 -81
- package/dist/purchases.js +691 -127
- package/ios/RNPurchases.h +0 -4
- package/ios/RNPurchases.m +11 -1
- package/ios/RNPurchases.m.bck +374 -0
- package/package.json +1 -1
- package/scripts/build.js +2 -2
- package/scripts/setupJest.js +2 -1
- package/android/.classpath +0 -6
- package/android/.project +0 -34
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
package/RNPurchases.podspec
CHANGED
|
@@ -16,13 +16,14 @@ Pod::Spec.new do |spec|
|
|
|
16
16
|
spec.source_files = "ios/**/*.{h,m,swift}"
|
|
17
17
|
spec.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
|
18
18
|
|
|
19
|
-
# Ignore the
|
|
19
|
+
# Ignore the Purchases.framework that would get downloaded by the download script, meant for
|
|
20
|
+
# developers who don't want to use Cocoapods
|
|
20
21
|
spec.exclude_files = [
|
|
21
22
|
"ios/Purchases.framework",
|
|
22
23
|
"ios/PurchasesHybridCommon.framework"
|
|
23
24
|
]
|
|
24
25
|
|
|
25
26
|
spec.dependency "React-Core"
|
|
26
|
-
spec.dependency "PurchasesHybridCommon", '1.
|
|
27
|
+
spec.dependency "PurchasesHybridCommon", '1.11.1'
|
|
27
28
|
spec.swift_version = '5.0'
|
|
28
29
|
end
|
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 '4.
|
|
32
|
+
versionName '4.5.1'
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
buildTypes {
|
|
@@ -122,6 +122,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
122
122
|
dependencies {
|
|
123
123
|
//noinspection GradleDynamicVersion
|
|
124
124
|
api 'com.facebook.react:react-native:+'
|
|
125
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common:1.
|
|
125
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:1.11.1'
|
|
126
126
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
127
127
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['Purchases_kotlinVersion']
|
|
3
|
+
repositories {
|
|
4
|
+
google()
|
|
5
|
+
jcenter()
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
dependencies {
|
|
9
|
+
classpath 'com.android.tools.build:gradle:4.0.1'
|
|
10
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
apply plugin: 'com.android.library'
|
|
15
|
+
apply plugin: 'kotlin-android'
|
|
16
|
+
|
|
17
|
+
def getExtOrDefault(name) {
|
|
18
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Purchases_' + name]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
def getExtOrIntegerDefault(name) {
|
|
22
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['Purchases_' + name]).toInteger()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
android {
|
|
26
|
+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
27
|
+
|
|
28
|
+
defaultConfig {
|
|
29
|
+
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
30
|
+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
31
|
+
versionCode 1
|
|
32
|
+
versionName '4.5.0'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
buildTypes {
|
|
36
|
+
release {
|
|
37
|
+
minifyEnabled false
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
lintOptions {
|
|
41
|
+
disable 'GradleCompatible'
|
|
42
|
+
}
|
|
43
|
+
compileOptions {
|
|
44
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
45
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
repositories {
|
|
50
|
+
mavenCentral()
|
|
51
|
+
jcenter()
|
|
52
|
+
google()
|
|
53
|
+
|
|
54
|
+
def found = false
|
|
55
|
+
def defaultDir = null
|
|
56
|
+
def androidSourcesName = 'React Native sources'
|
|
57
|
+
|
|
58
|
+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
59
|
+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
60
|
+
} else {
|
|
61
|
+
defaultDir = new File(
|
|
62
|
+
projectDir,
|
|
63
|
+
'/../../../node_modules/react-native/android'
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (defaultDir.exists()) {
|
|
68
|
+
maven {
|
|
69
|
+
url defaultDir.toString()
|
|
70
|
+
name androidSourcesName
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
74
|
+
found = true
|
|
75
|
+
} else {
|
|
76
|
+
def parentDir = rootProject.projectDir
|
|
77
|
+
|
|
78
|
+
1.upto(5, {
|
|
79
|
+
if (found) return true
|
|
80
|
+
parentDir = parentDir.parentFile
|
|
81
|
+
|
|
82
|
+
def androidSourcesDir = new File(
|
|
83
|
+
parentDir,
|
|
84
|
+
'node_modules/react-native'
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
def androidPrebuiltBinaryDir = new File(
|
|
88
|
+
parentDir,
|
|
89
|
+
'node_modules/react-native/android'
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
if (androidPrebuiltBinaryDir.exists()) {
|
|
93
|
+
maven {
|
|
94
|
+
url androidPrebuiltBinaryDir.toString()
|
|
95
|
+
name androidSourcesName
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
99
|
+
found = true
|
|
100
|
+
} else if (androidSourcesDir.exists()) {
|
|
101
|
+
maven {
|
|
102
|
+
url androidSourcesDir.toString()
|
|
103
|
+
name androidSourcesName
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
107
|
+
found = true
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!found) {
|
|
113
|
+
throw new GradleException(
|
|
114
|
+
"${project.name}: unable to locate React Native android sources. " +
|
|
115
|
+
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
121
|
+
|
|
122
|
+
dependencies {
|
|
123
|
+
//noinspection GradleDynamicVersion
|
|
124
|
+
api 'com.facebook.react:react-native:+'
|
|
125
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:1.11.1'
|
|
126
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
127
|
+
}
|
|
@@ -43,7 +43,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
43
43
|
|
|
44
44
|
private static final String PURCHASER_INFO_UPDATED = "Purchases-PurchaserInfoUpdated";
|
|
45
45
|
public static final String PLATFORM_NAME = "react-native";
|
|
46
|
-
public static final String PLUGIN_VERSION = "4.
|
|
46
|
+
public static final String PLUGIN_VERSION = "4.4.1";
|
|
47
47
|
|
|
48
48
|
private final ReactApplicationContext reactContext;
|
|
49
49
|
|
|
@@ -234,6 +234,11 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
234
234
|
CommonKt.setProxyURLString(proxyURLString);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
@ReactMethod
|
|
238
|
+
public void isConfigured(Promise promise) {
|
|
239
|
+
promise.resolve(Purchases.isConfigured());
|
|
240
|
+
}
|
|
241
|
+
|
|
237
242
|
//================================================================================
|
|
238
243
|
// Subscriber Attributes
|
|
239
244
|
//================================================================================
|
|
@@ -296,6 +301,11 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
296
301
|
SubscriberAttributesKt.setOnesignalID(onesignalID);
|
|
297
302
|
}
|
|
298
303
|
|
|
304
|
+
@ReactMethod
|
|
305
|
+
public void setAirshipChannelID(String airshipChannelID) {
|
|
306
|
+
SubscriberAttributesKt.setAirshipChannelID(airshipChannelID);
|
|
307
|
+
}
|
|
308
|
+
|
|
299
309
|
// endregion
|
|
300
310
|
|
|
301
311
|
// region Campaign parameters
|
package/dist/errors.d.ts
CHANGED
package/dist/errors.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
2
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PURCHASES_ERROR_CODE = void 0;
|
|
16
|
+
exports.UninitializedPurchasesError = exports.PURCHASES_ERROR_CODE = void 0;
|
|
4
17
|
// Error codes indicating the reason for an error.
|
|
5
18
|
var PURCHASES_ERROR_CODE;
|
|
6
19
|
(function (PURCHASES_ERROR_CODE) {
|
|
@@ -28,3 +41,16 @@ var PURCHASES_ERROR_CODE;
|
|
|
28
41
|
PURCHASES_ERROR_CODE["INVALID_SUBSCRIBER_ATTRIBUTES_ERROR"] = "21";
|
|
29
42
|
PURCHASES_ERROR_CODE["LOG_OUT_ANONYMOUS_USER_ERROR"] = "22";
|
|
30
43
|
})(PURCHASES_ERROR_CODE = exports.PURCHASES_ERROR_CODE || (exports.PURCHASES_ERROR_CODE = {}));
|
|
44
|
+
var UninitializedPurchasesError = /** @class */ (function (_super) {
|
|
45
|
+
__extends(UninitializedPurchasesError, _super);
|
|
46
|
+
function UninitializedPurchasesError() {
|
|
47
|
+
var _this = _super.call(this, "There is no singleton instance. " +
|
|
48
|
+
"Make sure you configure Purchases before trying to get the default instance. " +
|
|
49
|
+
"More info here: https://errors.rev.cat/configuring-sdk") || this;
|
|
50
|
+
// Set the prototype explicitly.
|
|
51
|
+
Object.setPrototypeOf(_this, UninitializedPurchasesError.prototype);
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
return UninitializedPurchasesError;
|
|
55
|
+
}(Error));
|
|
56
|
+
exports.UninitializedPurchasesError = UninitializedPurchasesError;
|