react-native-purchases 4.5.2 → 4.5.3
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
CHANGED
package/android/build.gradle.bck
CHANGED
|
@@ -67,6 +67,16 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
@ReactMethod
|
|
71
|
+
public void addListener(String eventName) {
|
|
72
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@ReactMethod
|
|
76
|
+
public void removeListeners(Integer count) {
|
|
77
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
78
|
+
}
|
|
79
|
+
|
|
70
80
|
@ReactMethod
|
|
71
81
|
public void setupPurchases(String apiKey, @Nullable String appUserID,
|
|
72
82
|
boolean observerMode, @Nullable String userDefaultsSuiteName) {
|
package/ios/RNPurchases.m
CHANGED
|
@@ -0,0 +1,375 @@
|
|
|
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.2";
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
@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.5.
|
|
4
|
+
"version": "4.5.3",
|
|
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.bck
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const {exec} = require("child_process");
|
|
2
|
-
const os = require("os");
|
|
3
|
-
|
|
4
|
-
if (os.type() === "Linux") {
|
|
5
|
-
console.log("Skipping iOS Dependencies");
|
|
6
|
-
} else if (os.type() === "Darwin") {
|
|
7
|
-
const downloadProcess = exec(
|
|
8
|
-
"./scripts/download-purchases-framework.sh 3.14.1"
|
|
9
|
-
);
|
|
10
|
-
downloadProcess.stdout.pipe(process.stdout);
|
|
11
|
-
const downloadProcessCommon = exec(
|
|
12
|
-
"./scripts/download-purchases-common.sh 1.11.1"
|
|
13
|
-
);
|
|
14
|
-
downloadProcessCommon.stdout.pipe(process.stdout);
|
|
15
|
-
} else if (os.type() === "Windows_NT") {
|
|
16
|
-
console.log("Skipping iOS Dependencies");
|
|
17
|
-
} else {
|
|
18
|
-
throw new Error(`Unsupported OS found: ${os.type()}`);
|
|
19
|
-
}
|