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/ios/RNPurchases.h
CHANGED
|
@@ -3,11 +3,7 @@
|
|
|
3
3
|
// Copyright © 2019 RevenueCat. All rights reserved.
|
|
4
4
|
//
|
|
5
5
|
|
|
6
|
-
#if __has_include("RCTEventEmitter.h")
|
|
7
|
-
#import "RCTEventEmitter.h"
|
|
8
|
-
#else
|
|
9
6
|
#import <React/RCTEventEmitter.h>
|
|
10
|
-
#endif
|
|
11
7
|
|
|
12
8
|
#import <Purchases/RCPurchases.h>
|
|
13
9
|
#import <PurchasesHybridCommon/PurchasesHybridCommon.h>
|
package/ios/RNPurchases.m
CHANGED
|
@@ -283,6 +283,10 @@ RCT_EXPORT_METHOD(setOnesignalID:(NSString *)onesignalID) {
|
|
|
283
283
|
[RCCommonFunctionality setOnesignalID:onesignalID];
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
RCT_EXPORT_METHOD(setAirshipChannelID:(NSString *)airshipChannelID) {
|
|
287
|
+
[RCCommonFunctionality setAirshipChannelID:airshipChannelID];
|
|
288
|
+
}
|
|
289
|
+
|
|
286
290
|
# pragma mark Campaign parameters
|
|
287
291
|
|
|
288
292
|
RCT_EXPORT_METHOD(setMediaSource:(NSString *)mediaSource) {
|
|
@@ -316,6 +320,12 @@ RCT_REMAP_METHOD(canMakePayments,
|
|
|
316
320
|
resolve(@([RCCommonFunctionality canMakePaymentsWithFeatures:features]));
|
|
317
321
|
}
|
|
318
322
|
|
|
323
|
+
RCT_REMAP_METHOD(isConfigured,
|
|
324
|
+
isConfiguredWithResolve:(RCTPromiseResolveBlock)resolve
|
|
325
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
326
|
+
resolve(@(RCPurchases.isConfigured));
|
|
327
|
+
}
|
|
328
|
+
|
|
319
329
|
#pragma mark -
|
|
320
330
|
#pragma mark Delegate Methods
|
|
321
331
|
- (void)purchases:(RCPurchases *)purchases didReceiveUpdatedPurchaserInfo:(RCPurchaserInfo *)purchaserInfo {
|
|
@@ -358,7 +368,7 @@ shouldPurchasePromoProduct:(SKProduct *)product
|
|
|
358
368
|
}
|
|
359
369
|
|
|
360
370
|
- (NSString *)platformFlavorVersion {
|
|
361
|
-
return @"4.
|
|
371
|
+
return @"4.5.1";
|
|
362
372
|
}
|
|
363
373
|
|
|
364
374
|
@end
|
|
@@ -0,0 +1,374 @@
|
|
|
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
|
+
RCPurchases.sharedPurchases.delegate = self;
|
|
46
|
+
[RCCommonFunctionality configure];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
RCT_EXPORT_METHOD(setAllowSharingStoreAccount:(BOOL)allowSharingStoreAccount) {
|
|
50
|
+
#pragma GCC diagnostic push
|
|
51
|
+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
52
|
+
[RCCommonFunctionality setAllowSharingStoreAccount:allowSharingStoreAccount];
|
|
53
|
+
#pragma GCC diagnostic pop
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
RCT_EXPORT_METHOD(setFinishTransactions:(BOOL)finishTransactions) {
|
|
57
|
+
[RCCommonFunctionality setFinishTransactions:finishTransactions];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
RCT_EXPORT_METHOD(addAttributionData:(NSDictionary *)data
|
|
61
|
+
forNetwork:(NSInteger)network
|
|
62
|
+
forNetworkUserId:(nullable NSString *)networkUserId) {
|
|
63
|
+
#pragma GCC diagnostic push
|
|
64
|
+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
65
|
+
[RCCommonFunctionality addAttributionData:data network:network networkUserId:networkUserId];
|
|
66
|
+
#pragma GCC diagnostic pop
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
RCT_REMAP_METHOD(getOfferings,
|
|
70
|
+
getOfferingsWithResolve:(RCTPromiseResolveBlock)resolve
|
|
71
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
72
|
+
[RCCommonFunctionality getOfferingsWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
|
|
73
|
+
reject:reject]];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
RCT_EXPORT_METHOD(getProductInfo:(NSArray *)products
|
|
77
|
+
type:(NSString *)type
|
|
78
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
79
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
80
|
+
[RCCommonFunctionality getProductInfo:products completionBlock:^(NSArray<NSDictionary *> *productObjects) {
|
|
81
|
+
resolve(productObjects);
|
|
82
|
+
}];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
RCT_REMAP_METHOD(purchaseProduct,
|
|
86
|
+
purchaseProduct:(NSString *)productIdentifier
|
|
87
|
+
upgradeInfo:(NSDictionary *)upgradeInfo
|
|
88
|
+
type:(NSString *)type
|
|
89
|
+
signedDiscountTimestamp:(NSString *)signedDiscountTimestamp
|
|
90
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
91
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
92
|
+
[RCCommonFunctionality purchaseProduct:productIdentifier
|
|
93
|
+
signedDiscountTimestamp:signedDiscountTimestamp
|
|
94
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
RCT_REMAP_METHOD(purchasePackage,
|
|
99
|
+
purchasePackage:(NSString *)packageIdentifier
|
|
100
|
+
offeringIdentifier:(NSString *)offeringIdentifier
|
|
101
|
+
upgradeInfo:(NSDictionary *)upgradeInfo
|
|
102
|
+
signedDiscountTimestamp:(NSString *)signedDiscountTimestamp
|
|
103
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
104
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
105
|
+
[RCCommonFunctionality purchasePackage:packageIdentifier
|
|
106
|
+
offering:offeringIdentifier
|
|
107
|
+
signedDiscountTimestamp:signedDiscountTimestamp
|
|
108
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
RCT_REMAP_METHOD(restoreTransactions,
|
|
112
|
+
restoreTransactionsWithResolve:(RCTPromiseResolveBlock)resolve
|
|
113
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
114
|
+
[RCCommonFunctionality restoreTransactionsWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
|
|
115
|
+
reject:reject]];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
RCT_EXPORT_METHOD(syncPurchases) {
|
|
119
|
+
[RCCommonFunctionality syncPurchasesWithCompletionBlock:nil];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
RCT_REMAP_METHOD(getAppUserID,
|
|
123
|
+
getAppUserIDWithResolve:(RCTPromiseResolveBlock)resolve
|
|
124
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
125
|
+
resolve([RCCommonFunctionality appUserID]);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
RCT_EXPORT_METHOD(createAlias:(nullable NSString *)newAppUserID
|
|
129
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
130
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
131
|
+
[RCCommonFunctionality createAlias:newAppUserID
|
|
132
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
RCT_EXPORT_METHOD(logIn:(nonnull NSString *)appUserID
|
|
136
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
137
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
138
|
+
[RCCommonFunctionality logInWithAppUserID:appUserID
|
|
139
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
RCT_REMAP_METHOD(logOut,
|
|
143
|
+
logOutWithResolve:(RCTPromiseResolveBlock)resolve
|
|
144
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
145
|
+
[RCCommonFunctionality logOutWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
RCT_EXPORT_METHOD(identify:(nullable NSString *)appUserID
|
|
149
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
150
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
151
|
+
#pragma GCC diagnostic push
|
|
152
|
+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
153
|
+
[RCCommonFunctionality identify:appUserID
|
|
154
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
155
|
+
#pragma GCC diagnostic pop
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
RCT_REMAP_METHOD(reset,
|
|
159
|
+
resetWithResolve:(RCTPromiseResolveBlock)resolve
|
|
160
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
161
|
+
#pragma GCC diagnostic push
|
|
162
|
+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
163
|
+
[RCCommonFunctionality resetWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
164
|
+
#pragma GCC diagnostic pop
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
RCT_REMAP_METHOD(setDebugLogsEnabled,
|
|
168
|
+
debugLogsEnabled:(BOOL)enabled) {
|
|
169
|
+
[RCCommonFunctionality setDebugLogsEnabled:enabled];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
RCT_EXPORT_METHOD(setSimulatesAskToBuyInSandbox:(BOOL)simulatesAskToBuyInSandbox)
|
|
173
|
+
{
|
|
174
|
+
[RCCommonFunctionality setSimulatesAskToBuyInSandbox:simulatesAskToBuyInSandbox];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
RCT_REMAP_METHOD(getPurchaserInfo,
|
|
178
|
+
purchaserInfoWithResolve:(RCTPromiseResolveBlock)resolve
|
|
179
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
180
|
+
[RCCommonFunctionality getPurchaserInfoWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
RCT_EXPORT_METHOD(setAutomaticAppleSearchAdsAttributionCollection:(BOOL)automaticAppleSearchAdsAttributionCollection)
|
|
184
|
+
{
|
|
185
|
+
[RCCommonFunctionality setAutomaticAppleSearchAdsAttributionCollection:automaticAppleSearchAdsAttributionCollection];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
RCT_REMAP_METHOD(isAnonymous,
|
|
189
|
+
isAnonymousWithResolve:(RCTPromiseResolveBlock)resolve
|
|
190
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
191
|
+
resolve(@([RCCommonFunctionality isAnonymous]));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
RCT_EXPORT_METHOD(makeDeferredPurchase:(nonnull NSNumber *)callbackID
|
|
195
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
196
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
197
|
+
RCDeferredPromotionalPurchaseBlock defermentBlock = [self.defermentBlocks objectAtIndex:[callbackID integerValue]];
|
|
198
|
+
[RCCommonFunctionality makeDeferredPurchase:defermentBlock
|
|
199
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
RCT_EXPORT_METHOD(checkTrialOrIntroductoryPriceEligibility:(NSArray *)products
|
|
203
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
204
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
205
|
+
[RCCommonFunctionality checkTrialOrIntroductoryPriceEligibility:products
|
|
206
|
+
completionBlock:^(NSDictionary<NSString *,RCIntroEligibility *> * _Nonnull responseDictionary) {
|
|
207
|
+
resolve([NSDictionary dictionaryWithDictionary:responseDictionary]);
|
|
208
|
+
}];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
RCT_REMAP_METHOD(getPaymentDiscount,
|
|
212
|
+
getPaymentDiscountForProductIdentifier:(NSString *)productIdentifier
|
|
213
|
+
discountIdentifier:(nullable NSString *)discountIdentifier
|
|
214
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
215
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
216
|
+
[RCCommonFunctionality paymentDiscountForProductIdentifier:productIdentifier
|
|
217
|
+
discount:discountIdentifier
|
|
218
|
+
completionBlock:[self getResponseCompletionBlockWithResolve:resolve
|
|
219
|
+
reject:reject]];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
RCT_EXPORT_METHOD(invalidatePurchaserInfoCache) {
|
|
223
|
+
[RCCommonFunctionality invalidatePurchaserInfoCache];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
RCT_EXPORT_METHOD(presentCodeRedemptionSheet) {
|
|
227
|
+
if (@available(iOS 14.0, *)) {
|
|
228
|
+
[RCCommonFunctionality presentCodeRedemptionSheet];
|
|
229
|
+
} else {
|
|
230
|
+
NSLog(@"[Purchases] Warning: tried to present codeRedemptionSheet, but it's only available on iOS 14.0 or greater.");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
#pragma mark - Subscriber Attributes
|
|
235
|
+
|
|
236
|
+
RCT_EXPORT_METHOD(setProxyURLString:(nullable NSString *)proxyURLString) {
|
|
237
|
+
[RCCommonFunctionality setProxyURLString:proxyURLString];
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
RCT_EXPORT_METHOD(setAttributes:(NSDictionary *)attributes) {
|
|
241
|
+
[RCCommonFunctionality setAttributes:attributes];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
RCT_EXPORT_METHOD(setEmail:(NSString *)email) {
|
|
245
|
+
[RCCommonFunctionality setEmail:email];
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
RCT_EXPORT_METHOD(setPhoneNumber:(NSString *)phoneNumber) {
|
|
249
|
+
[RCCommonFunctionality setPhoneNumber:phoneNumber];
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
RCT_EXPORT_METHOD(setDisplayName:(NSString *)displayName) {
|
|
253
|
+
[RCCommonFunctionality setDisplayName:displayName];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
RCT_EXPORT_METHOD(setPushToken:(NSString *)pushToken) {
|
|
257
|
+
[RCCommonFunctionality setPushToken:pushToken];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
# pragma mark Attribution IDs
|
|
261
|
+
|
|
262
|
+
RCT_EXPORT_METHOD(collectDeviceIdentifiers) {
|
|
263
|
+
[RCCommonFunctionality collectDeviceIdentifiers];
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
RCT_EXPORT_METHOD(setAdjustID:(NSString *)adjustID) {
|
|
267
|
+
[RCCommonFunctionality setAdjustID:adjustID];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
RCT_EXPORT_METHOD(setAppsflyerID:(NSString *)appsflyerID) {
|
|
271
|
+
[RCCommonFunctionality setAppsflyerID:appsflyerID];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
RCT_EXPORT_METHOD(setFBAnonymousID:(NSString *)fbAnonymousID) {
|
|
275
|
+
[RCCommonFunctionality setFBAnonymousID:fbAnonymousID];
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
RCT_EXPORT_METHOD(setMparticleID:(NSString *)mparticleID) {
|
|
279
|
+
[RCCommonFunctionality setMparticleID:mparticleID];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
RCT_EXPORT_METHOD(setOnesignalID:(NSString *)onesignalID) {
|
|
283
|
+
[RCCommonFunctionality setOnesignalID:onesignalID];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
RCT_EXPORT_METHOD(setAirshipChannelID:(NSString *)airshipChannelID) {
|
|
287
|
+
[RCCommonFunctionality setAirshipChannelID:airshipChannelID];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
# pragma mark Campaign parameters
|
|
291
|
+
|
|
292
|
+
RCT_EXPORT_METHOD(setMediaSource:(NSString *)mediaSource) {
|
|
293
|
+
[RCCommonFunctionality setMediaSource:mediaSource];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
RCT_EXPORT_METHOD(setCampaign:(NSString *)campaign) {
|
|
297
|
+
[RCCommonFunctionality setCampaign:campaign];
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
RCT_EXPORT_METHOD(setAdGroup:(NSString *)adGroup) {
|
|
301
|
+
[RCCommonFunctionality setAdGroup:adGroup];
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
RCT_EXPORT_METHOD(setAd:(NSString *)ad) {
|
|
305
|
+
[RCCommonFunctionality setAd:ad];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
RCT_EXPORT_METHOD(setKeyword:(NSString *)keyword) {
|
|
309
|
+
[RCCommonFunctionality setKeyword:keyword];
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
RCT_EXPORT_METHOD(setCreative:(NSString *)creative) {
|
|
313
|
+
[RCCommonFunctionality setCreative:creative];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
RCT_REMAP_METHOD(canMakePayments,
|
|
317
|
+
canMakePaymentsWithFeatures:(NSArray<NSNumber *> *)features
|
|
318
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
319
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
320
|
+
resolve(@([RCCommonFunctionality canMakePaymentsWithFeatures:features]));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
RCT_REMAP_METHOD(isConfigured,
|
|
324
|
+
isConfiguredWithResolve:(RCTPromiseResolveBlock)resolve
|
|
325
|
+
reject:(RCTPromiseRejectBlock)reject) {
|
|
326
|
+
resolve(@(RCPurchases.isConfigured));
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
#pragma mark -
|
|
330
|
+
#pragma mark Delegate Methods
|
|
331
|
+
- (void)purchases:(RCPurchases *)purchases didReceiveUpdatedPurchaserInfo:(RCPurchaserInfo *)purchaserInfo {
|
|
332
|
+
[self sendEventWithName:RNPurchasesPurchaserInfoUpdatedEvent body:purchaserInfo.dictionary];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
- (void) purchases:(RCPurchases *)purchases
|
|
336
|
+
shouldPurchasePromoProduct:(SKProduct *)product
|
|
337
|
+
defermentBlock:(RCDeferredPromotionalPurchaseBlock)makeDeferredPurchase {
|
|
338
|
+
if (!self.defermentBlocks) {
|
|
339
|
+
self.defermentBlocks = [NSMutableArray array];
|
|
340
|
+
}
|
|
341
|
+
[self.defermentBlocks addObject:makeDeferredPurchase];
|
|
342
|
+
NSInteger position = [self.defermentBlocks count] - 1;
|
|
343
|
+
[self sendEventWithName:RNPurchasesShouldPurchasePromoProductEvent body:@{@"callbackID": @(position)}];
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
#pragma mark -
|
|
347
|
+
#pragma mark Helper Methods
|
|
348
|
+
|
|
349
|
+
- (void)rejectPromiseWithBlock:(RCTPromiseRejectBlock)reject error:(NSError *)error {
|
|
350
|
+
reject([NSString stringWithFormat: @"%ld", (long)error.code], error.localizedDescription, error);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
- (void (^)(NSDictionary *, RCErrorContainer *))getResponseCompletionBlockWithResolve:(RCTPromiseResolveBlock)resolve
|
|
354
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
355
|
+
return ^(NSDictionary *_Nullable responseDictionary, RCErrorContainer *_Nullable error) {
|
|
356
|
+
if (error) {
|
|
357
|
+
reject([NSString stringWithFormat:@"%ld", (long) error.code], error.message, error.error);
|
|
358
|
+
} else if (responseDictionary) {
|
|
359
|
+
resolve([NSDictionary dictionaryWithDictionary:responseDictionary]);
|
|
360
|
+
} else {
|
|
361
|
+
resolve(nil);
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
- (NSString *)platformFlavor {
|
|
367
|
+
return @"react-native";
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
- (NSString *)platformFlavorVersion {
|
|
371
|
+
return @"4.5.0";
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
@end
|
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.
|
|
4
|
+
"version": "4.5.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/build.js
CHANGED
|
@@ -5,11 +5,11 @@ if (os.type() === "Linux") {
|
|
|
5
5
|
console.log("Skipping iOS Dependencies");
|
|
6
6
|
} else if (os.type() === "Darwin") {
|
|
7
7
|
const downloadProcess = exec(
|
|
8
|
-
"./scripts/download-purchases-framework.sh 3.
|
|
8
|
+
"./scripts/download-purchases-framework.sh 3.13.1"
|
|
9
9
|
);
|
|
10
10
|
downloadProcess.stdout.pipe(process.stdout);
|
|
11
11
|
const downloadProcessCommon = exec(
|
|
12
|
-
"./scripts/download-purchases-common.sh 1.
|
|
12
|
+
"./scripts/download-purchases-common.sh 1.11.1"
|
|
13
13
|
);
|
|
14
14
|
downloadProcessCommon.stdout.pipe(process.stdout);
|
|
15
15
|
} else if (os.type() === "Windows_NT") {
|
package/scripts/setupJest.js
CHANGED
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>android</name>
|
|
4
|
-
<comment>Project ReactNativeSample-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>0</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(WRAPPER)
|
|
5
|
-
connection.project.dir=
|
|
6
|
-
eclipse.preferences.version=1
|
|
7
|
-
gradle.user.home=
|
|
8
|
-
java.home=/Users/cesardelavega/.sdkman/candidates/java/current
|
|
9
|
-
jvm.arguments=
|
|
10
|
-
offline.mode=false
|
|
11
|
-
override.workspace.settings=true
|
|
12
|
-
show.console.view=true
|
|
13
|
-
show.executions.view=true
|