react-native-purchases 4.6.0 → 4.6.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/android/build.gradle +2 -3
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +1 -1
- package/ios/RNPurchases.m +1 -1
- package/package.json +1 -1
- package/android/.classpath +0 -6
- package/android/.project +0 -34
- package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
- package/android/build.gradle.bck +0 -127
- package/ios/RNPurchases.m.bck +0 -375
package/android/build.gradle
CHANGED
|
@@ -2,7 +2,7 @@ buildscript {
|
|
|
2
2
|
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['Purchases_kotlinVersion']
|
|
3
3
|
repositories {
|
|
4
4
|
google()
|
|
5
|
-
|
|
5
|
+
mavenCentral()
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
dependencies {
|
|
@@ -29,7 +29,7 @@ android {
|
|
|
29
29
|
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
30
30
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
31
31
|
versionCode 1
|
|
32
|
-
versionName '4.6.
|
|
32
|
+
versionName '4.6.1'
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
buildTypes {
|
|
@@ -48,7 +48,6 @@ android {
|
|
|
48
48
|
|
|
49
49
|
repositories {
|
|
50
50
|
mavenCentral()
|
|
51
|
-
jcenter()
|
|
52
51
|
google()
|
|
53
52
|
|
|
54
53
|
def found = false
|
|
@@ -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.6.1";
|
|
47
47
|
|
|
48
48
|
private final ReactApplicationContext reactContext;
|
|
49
49
|
|
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": "4.6.
|
|
4
|
+
"version": "4.6.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/android/.classpath
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<classpath>
|
|
3
|
-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
|
|
4
|
-
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
|
5
|
-
<classpathentry kind="output" path="bin/default"/>
|
|
6
|
-
</classpath>
|
package/android/.project
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<projectDescription>
|
|
3
|
-
<name>react-native-purchases</name>
|
|
4
|
-
<comment>Project react-native-purchases created by Buildship.</comment>
|
|
5
|
-
<projects>
|
|
6
|
-
</projects>
|
|
7
|
-
<buildSpec>
|
|
8
|
-
<buildCommand>
|
|
9
|
-
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
-
<arguments>
|
|
11
|
-
</arguments>
|
|
12
|
-
</buildCommand>
|
|
13
|
-
<buildCommand>
|
|
14
|
-
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
15
|
-
<arguments>
|
|
16
|
-
</arguments>
|
|
17
|
-
</buildCommand>
|
|
18
|
-
</buildSpec>
|
|
19
|
-
<natures>
|
|
20
|
-
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
21
|
-
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
22
|
-
</natures>
|
|
23
|
-
<filteredResources>
|
|
24
|
-
<filter>
|
|
25
|
-
<id>1635967466942</id>
|
|
26
|
-
<name></name>
|
|
27
|
-
<type>30</type>
|
|
28
|
-
<matcher>
|
|
29
|
-
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
30
|
-
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
31
|
-
</matcher>
|
|
32
|
-
</filter>
|
|
33
|
-
</filteredResources>
|
|
34
|
-
</projectDescription>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
arguments=
|
|
2
|
-
auto.sync=false
|
|
3
|
-
build.scans.enabled=false
|
|
4
|
-
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.1.1))
|
|
5
|
-
connection.project.dir=
|
|
6
|
-
eclipse.preferences.version=1
|
|
7
|
-
gradle.user.home=
|
|
8
|
-
java.home=/Users/madelinebeyl/.sdkman/candidates/java/11.0.11.hs-adpt
|
|
9
|
-
jvm.arguments=
|
|
10
|
-
offline.mode=false
|
|
11
|
-
override.workspace.settings=true
|
|
12
|
-
show.console.view=true
|
|
13
|
-
show.executions.view=true
|
package/android/build.gradle.bck
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
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.3'
|
|
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:2.0.1'
|
|
126
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
127
|
-
}
|
package/ios/RNPurchases.m.bck
DELETED
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
// Created by RevenueCat.
|
|
4
|
-
// Copyright © 2019 RevenueCat. All rights reserved.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
#import "RNPurchases.h"
|
|
8
|
-
|
|
9
|
-
@import StoreKit;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@interface RNPurchases () <RCPurchasesDelegate>
|
|
13
|
-
|
|
14
|
-
@property (nonatomic, retain) NSMutableArray<RCDeferredPromotionalPurchaseBlock> *defermentBlocks;
|
|
15
|
-
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
NSString *RNPurchasesPurchaserInfoUpdatedEvent = @"Purchases-PurchaserInfoUpdated";
|
|
20
|
-
NSString *RNPurchasesShouldPurchasePromoProductEvent = @"Purchases-ShouldPurchasePromoProduct";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@implementation RNPurchases
|
|
24
|
-
|
|
25
|
-
- (dispatch_queue_t)methodQueue {
|
|
26
|
-
return dispatch_get_main_queue();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
- (NSArray<NSString *> *)supportedEvents {
|
|
30
|
-
return @[RNPurchasesPurchaserInfoUpdatedEvent, RNPurchasesShouldPurchasePromoProductEvent];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
RCT_EXPORT_MODULE();
|
|
34
|
-
|
|
35
|
-
RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
|
|
36
|
-
appUserID:(nullable NSString *)appUserID
|
|
37
|
-
observerMode:(BOOL)observerMode
|
|
38
|
-
userDefaultsSuiteName:(nullable NSString *)userDefaultsSuiteName) {
|
|
39
|
-
[RCPurchases configureWithAPIKey:apiKey
|
|
40
|
-
appUserID:appUserID
|
|
41
|
-
observerMode:observerMode
|
|
42
|
-
userDefaultsSuiteName:userDefaultsSuiteName
|
|
43
|
-
platformFlavor:self.platformFlavor
|
|
44
|
-
platformFlavorVersion:self.platformFlavorVersion
|
|
45
|
-
dangerousSettings:nil];
|
|
46
|
-
RCPurchases.sharedPurchases.delegate = self;
|
|
47
|
-
[RCCommonFunctionality configure];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
RCT_EXPORT_METHOD(setAllowSharingStoreAccount:(BOOL)allowSharingStoreAccount) {
|
|
51
|
-
#pragma GCC diagnostic push
|
|
52
|
-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
53
|
-
[RCCommonFunctionality setAllowSharingStoreAccount:allowSharingStoreAccount];
|
|
54
|
-
#pragma GCC diagnostic pop
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
RCT_EXPORT_METHOD(setFinishTransactions:(BOOL)finishTransactions) {
|
|
58
|
-
[RCCommonFunctionality setFinishTransactions:finishTransactions];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
RCT_EXPORT_METHOD(addAttributionData:(NSDictionary *)data
|
|
62
|
-
forNetwork:(NSInteger)network
|
|
63
|
-
forNetworkUserId:(nullable NSString *)networkUserId) {
|
|
64
|
-
#pragma GCC diagnostic push
|
|
65
|
-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
66
|
-
[RCCommonFunctionality addAttributionData:data network:network networkUserId:networkUserId];
|
|
67
|
-
#pragma GCC diagnostic pop
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
RCT_REMAP_METHOD(getOfferings,
|
|
71
|
-
getOfferingsWithResolve:(RCTPromiseResolveBlock)resolve
|
|
72
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
73
|
-
[RCCommonFunctionality getOfferingsWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
|
|
74
|
-
reject:reject]];
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
RCT_EXPORT_METHOD(getProductInfo:(NSArray *)products
|
|
78
|
-
type:(NSString *)type
|
|
79
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
80
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
81
|
-
[RCCommonFunctionality getProductInfo:products completionBlock:^(NSArray<NSDictionary *> *productObjects) {
|
|
82
|
-
resolve(productObjects);
|
|
83
|
-
}];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
RCT_REMAP_METHOD(purchaseProduct,
|
|
87
|
-
purchaseProduct:(NSString *)productIdentifier
|
|
88
|
-
upgradeInfo:(NSDictionary *)upgradeInfo
|
|
89
|
-
type:(NSString *)type
|
|
90
|
-
signedDiscountTimestamp:(NSString *)signedDiscountTimestamp
|
|
91
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
92
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
93
|
-
[RCCommonFunctionality purchaseProduct:productIdentifier
|
|
94
|
-
signedDiscountTimestamp:signedDiscountTimestamp
|
|
95
|
-
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
RCT_REMAP_METHOD(purchasePackage,
|
|
100
|
-
purchasePackage:(NSString *)packageIdentifier
|
|
101
|
-
offeringIdentifier:(NSString *)offeringIdentifier
|
|
102
|
-
upgradeInfo:(NSDictionary *)upgradeInfo
|
|
103
|
-
signedDiscountTimestamp:(NSString *)signedDiscountTimestamp
|
|
104
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
105
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
106
|
-
[RCCommonFunctionality purchasePackage:packageIdentifier
|
|
107
|
-
offering:offeringIdentifier
|
|
108
|
-
signedDiscountTimestamp:signedDiscountTimestamp
|
|
109
|
-
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
RCT_REMAP_METHOD(restoreTransactions,
|
|
113
|
-
restoreTransactionsWithResolve:(RCTPromiseResolveBlock)resolve
|
|
114
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
115
|
-
[RCCommonFunctionality restoreTransactionsWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
|
|
116
|
-
reject:reject]];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
RCT_EXPORT_METHOD(syncPurchases) {
|
|
120
|
-
[RCCommonFunctionality syncPurchasesWithCompletionBlock:nil];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
RCT_REMAP_METHOD(getAppUserID,
|
|
124
|
-
getAppUserIDWithResolve:(RCTPromiseResolveBlock)resolve
|
|
125
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
126
|
-
resolve([RCCommonFunctionality appUserID]);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
RCT_EXPORT_METHOD(createAlias:(nullable NSString *)newAppUserID
|
|
130
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
131
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
132
|
-
[RCCommonFunctionality createAlias:newAppUserID
|
|
133
|
-
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
RCT_EXPORT_METHOD(logIn:(nonnull NSString *)appUserID
|
|
137
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
138
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
139
|
-
[RCCommonFunctionality logInWithAppUserID:appUserID
|
|
140
|
-
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
RCT_REMAP_METHOD(logOut,
|
|
144
|
-
logOutWithResolve:(RCTPromiseResolveBlock)resolve
|
|
145
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
146
|
-
[RCCommonFunctionality logOutWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
RCT_EXPORT_METHOD(identify:(nullable NSString *)appUserID
|
|
150
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
151
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
152
|
-
#pragma GCC diagnostic push
|
|
153
|
-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
154
|
-
[RCCommonFunctionality identify:appUserID
|
|
155
|
-
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
156
|
-
#pragma GCC diagnostic pop
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
RCT_REMAP_METHOD(reset,
|
|
160
|
-
resetWithResolve:(RCTPromiseResolveBlock)resolve
|
|
161
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
162
|
-
#pragma GCC diagnostic push
|
|
163
|
-
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
164
|
-
[RCCommonFunctionality resetWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
165
|
-
#pragma GCC diagnostic pop
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
RCT_REMAP_METHOD(setDebugLogsEnabled,
|
|
169
|
-
debugLogsEnabled:(BOOL)enabled) {
|
|
170
|
-
[RCCommonFunctionality setDebugLogsEnabled:enabled];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
RCT_EXPORT_METHOD(setSimulatesAskToBuyInSandbox:(BOOL)simulatesAskToBuyInSandbox)
|
|
174
|
-
{
|
|
175
|
-
[RCCommonFunctionality setSimulatesAskToBuyInSandbox:simulatesAskToBuyInSandbox];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
RCT_REMAP_METHOD(getPurchaserInfo,
|
|
179
|
-
purchaserInfoWithResolve:(RCTPromiseResolveBlock)resolve
|
|
180
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
181
|
-
[RCCommonFunctionality getPurchaserInfoWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
RCT_EXPORT_METHOD(setAutomaticAppleSearchAdsAttributionCollection:(BOOL)automaticAppleSearchAdsAttributionCollection)
|
|
185
|
-
{
|
|
186
|
-
[RCCommonFunctionality setAutomaticAppleSearchAdsAttributionCollection:automaticAppleSearchAdsAttributionCollection];
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
RCT_REMAP_METHOD(isAnonymous,
|
|
190
|
-
isAnonymousWithResolve:(RCTPromiseResolveBlock)resolve
|
|
191
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
192
|
-
resolve(@([RCCommonFunctionality isAnonymous]));
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
RCT_EXPORT_METHOD(makeDeferredPurchase:(nonnull NSNumber *)callbackID
|
|
196
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
197
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
198
|
-
RCDeferredPromotionalPurchaseBlock defermentBlock = [self.defermentBlocks objectAtIndex:[callbackID integerValue]];
|
|
199
|
-
[RCCommonFunctionality makeDeferredPurchase:defermentBlock
|
|
200
|
-
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
RCT_EXPORT_METHOD(checkTrialOrIntroductoryPriceEligibility:(NSArray *)products
|
|
204
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
205
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
206
|
-
[RCCommonFunctionality checkTrialOrIntroductoryPriceEligibility:products
|
|
207
|
-
completionBlock:^(NSDictionary<NSString *,RCIntroEligibility *> * _Nonnull responseDictionary) {
|
|
208
|
-
resolve([NSDictionary dictionaryWithDictionary:responseDictionary]);
|
|
209
|
-
}];
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
RCT_REMAP_METHOD(getPaymentDiscount,
|
|
213
|
-
getPaymentDiscountForProductIdentifier:(NSString *)productIdentifier
|
|
214
|
-
discountIdentifier:(nullable NSString *)discountIdentifier
|
|
215
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
216
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
217
|
-
[RCCommonFunctionality paymentDiscountForProductIdentifier:productIdentifier
|
|
218
|
-
discount:discountIdentifier
|
|
219
|
-
completionBlock:[self getResponseCompletionBlockWithResolve:resolve
|
|
220
|
-
reject:reject]];
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
RCT_EXPORT_METHOD(invalidatePurchaserInfoCache) {
|
|
224
|
-
[RCCommonFunctionality invalidatePurchaserInfoCache];
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
RCT_EXPORT_METHOD(presentCodeRedemptionSheet) {
|
|
228
|
-
if (@available(iOS 14.0, *)) {
|
|
229
|
-
[RCCommonFunctionality presentCodeRedemptionSheet];
|
|
230
|
-
} else {
|
|
231
|
-
NSLog(@"[Purchases] Warning: tried to present codeRedemptionSheet, but it's only available on iOS 14.0 or greater.");
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
#pragma mark - Subscriber Attributes
|
|
236
|
-
|
|
237
|
-
RCT_EXPORT_METHOD(setProxyURLString:(nullable NSString *)proxyURLString) {
|
|
238
|
-
[RCCommonFunctionality setProxyURLString:proxyURLString];
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
RCT_EXPORT_METHOD(setAttributes:(NSDictionary *)attributes) {
|
|
242
|
-
[RCCommonFunctionality setAttributes:attributes];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
RCT_EXPORT_METHOD(setEmail:(NSString *)email) {
|
|
246
|
-
[RCCommonFunctionality setEmail:email];
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
RCT_EXPORT_METHOD(setPhoneNumber:(NSString *)phoneNumber) {
|
|
250
|
-
[RCCommonFunctionality setPhoneNumber:phoneNumber];
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
RCT_EXPORT_METHOD(setDisplayName:(NSString *)displayName) {
|
|
254
|
-
[RCCommonFunctionality setDisplayName:displayName];
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
RCT_EXPORT_METHOD(setPushToken:(NSString *)pushToken) {
|
|
258
|
-
[RCCommonFunctionality setPushToken:pushToken];
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
# pragma mark Attribution IDs
|
|
262
|
-
|
|
263
|
-
RCT_EXPORT_METHOD(collectDeviceIdentifiers) {
|
|
264
|
-
[RCCommonFunctionality collectDeviceIdentifiers];
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
RCT_EXPORT_METHOD(setAdjustID:(NSString *)adjustID) {
|
|
268
|
-
[RCCommonFunctionality setAdjustID:adjustID];
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
RCT_EXPORT_METHOD(setAppsflyerID:(NSString *)appsflyerID) {
|
|
272
|
-
[RCCommonFunctionality setAppsflyerID:appsflyerID];
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
RCT_EXPORT_METHOD(setFBAnonymousID:(NSString *)fbAnonymousID) {
|
|
276
|
-
[RCCommonFunctionality setFBAnonymousID:fbAnonymousID];
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
RCT_EXPORT_METHOD(setMparticleID:(NSString *)mparticleID) {
|
|
280
|
-
[RCCommonFunctionality setMparticleID:mparticleID];
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
RCT_EXPORT_METHOD(setOnesignalID:(NSString *)onesignalID) {
|
|
284
|
-
[RCCommonFunctionality setOnesignalID:onesignalID];
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
RCT_EXPORT_METHOD(setAirshipChannelID:(NSString *)airshipChannelID) {
|
|
288
|
-
[RCCommonFunctionality setAirshipChannelID:airshipChannelID];
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
# pragma mark Campaign parameters
|
|
292
|
-
|
|
293
|
-
RCT_EXPORT_METHOD(setMediaSource:(NSString *)mediaSource) {
|
|
294
|
-
[RCCommonFunctionality setMediaSource:mediaSource];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
RCT_EXPORT_METHOD(setCampaign:(NSString *)campaign) {
|
|
298
|
-
[RCCommonFunctionality setCampaign:campaign];
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
RCT_EXPORT_METHOD(setAdGroup:(NSString *)adGroup) {
|
|
302
|
-
[RCCommonFunctionality setAdGroup:adGroup];
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
RCT_EXPORT_METHOD(setAd:(NSString *)ad) {
|
|
306
|
-
[RCCommonFunctionality setAd:ad];
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
RCT_EXPORT_METHOD(setKeyword:(NSString *)keyword) {
|
|
310
|
-
[RCCommonFunctionality setKeyword:keyword];
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
RCT_EXPORT_METHOD(setCreative:(NSString *)creative) {
|
|
314
|
-
[RCCommonFunctionality setCreative:creative];
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
RCT_REMAP_METHOD(canMakePayments,
|
|
318
|
-
canMakePaymentsWithFeatures:(NSArray<NSNumber *> *)features
|
|
319
|
-
resolve:(RCTPromiseResolveBlock)resolve
|
|
320
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
321
|
-
resolve(@([RCCommonFunctionality canMakePaymentsWithFeatures:features]));
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
RCT_REMAP_METHOD(isConfigured,
|
|
325
|
-
isConfiguredWithResolve:(RCTPromiseResolveBlock)resolve
|
|
326
|
-
reject:(RCTPromiseRejectBlock)reject) {
|
|
327
|
-
resolve(@(RCPurchases.isConfigured));
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
#pragma mark -
|
|
331
|
-
#pragma mark Delegate Methods
|
|
332
|
-
- (void)purchases:(RCPurchases *)purchases didReceiveUpdatedPurchaserInfo:(RCPurchaserInfo *)purchaserInfo {
|
|
333
|
-
[self sendEventWithName:RNPurchasesPurchaserInfoUpdatedEvent body:purchaserInfo.dictionary];
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
- (void) purchases:(RCPurchases *)purchases
|
|
337
|
-
shouldPurchasePromoProduct:(SKProduct *)product
|
|
338
|
-
defermentBlock:(RCDeferredPromotionalPurchaseBlock)makeDeferredPurchase {
|
|
339
|
-
if (!self.defermentBlocks) {
|
|
340
|
-
self.defermentBlocks = [NSMutableArray array];
|
|
341
|
-
}
|
|
342
|
-
[self.defermentBlocks addObject:makeDeferredPurchase];
|
|
343
|
-
NSInteger position = [self.defermentBlocks count] - 1;
|
|
344
|
-
[self sendEventWithName:RNPurchasesShouldPurchasePromoProductEvent body:@{@"callbackID": @(position)}];
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
#pragma mark -
|
|
348
|
-
#pragma mark Helper Methods
|
|
349
|
-
|
|
350
|
-
- (void)rejectPromiseWithBlock:(RCTPromiseRejectBlock)reject error:(NSError *)error {
|
|
351
|
-
reject([NSString stringWithFormat: @"%ld", (long)error.code], error.localizedDescription, error);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
- (void (^)(NSDictionary *, RCErrorContainer *))getResponseCompletionBlockWithResolve:(RCTPromiseResolveBlock)resolve
|
|
355
|
-
reject:(RCTPromiseRejectBlock)reject {
|
|
356
|
-
return ^(NSDictionary *_Nullable responseDictionary, RCErrorContainer *_Nullable error) {
|
|
357
|
-
if (error) {
|
|
358
|
-
reject([NSString stringWithFormat:@"%ld", (long) error.code], error.message, error.error);
|
|
359
|
-
} else if (responseDictionary) {
|
|
360
|
-
resolve([NSDictionary dictionaryWithDictionary:responseDictionary]);
|
|
361
|
-
} else {
|
|
362
|
-
resolve(nil);
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
- (NSString *)platformFlavor {
|
|
368
|
-
return @"react-native";
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
- (NSString *)platformFlavorVersion {
|
|
372
|
-
return @"4.5.3";
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
@end
|