react-native-purchases 4.6.1 → 5.0.0-beta.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.
@@ -0,0 +1,342 @@
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
+ typedef void (^PurchaseCompletedBlock)(RCStoreTransaction *, RCCustomerInfo *, NSError *, BOOL);
12
+ typedef void (^StartPurchaseBlock)(PurchaseCompletedBlock);
13
+
14
+ @interface RNPurchases () <RCPurchasesDelegate>
15
+
16
+ @property (nonatomic, retain) NSMutableArray<StartPurchaseBlock> *defermentBlocks;
17
+
18
+ @end
19
+
20
+
21
+ NSString *RNPurchasesCustomerInfoUpdatedEvent = @"Purchases-CustomerInfoUpdated";
22
+ NSString *RNPurchasesShouldPurchasePromoProductEvent = @"Purchases-ShouldPurchasePromoProduct";
23
+
24
+
25
+ @implementation RNPurchases
26
+
27
+ - (dispatch_queue_t)methodQueue {
28
+ return dispatch_get_main_queue();
29
+ }
30
+
31
+ - (NSArray<NSString *> *)supportedEvents {
32
+ return @[RNPurchasesCustomerInfoUpdatedEvent, RNPurchasesShouldPurchasePromoProductEvent];
33
+ }
34
+
35
+ RCT_EXPORT_MODULE();
36
+
37
+ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
38
+ appUserID:(nullable NSString *)appUserID
39
+ observerMode:(BOOL)observerMode
40
+ userDefaultsSuiteName:(nullable NSString *)userDefaultsSuiteName
41
+ usesStoreKit2IfAvailable:(BOOL)usesStoreKit2IfAvailable) {
42
+ RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey
43
+ appUserID:appUserID
44
+ observerMode:observerMode
45
+ userDefaultsSuiteName:userDefaultsSuiteName
46
+ platformFlavor:self.platformFlavor
47
+ platformFlavorVersion:self.platformFlavorVersion
48
+ usesStoreKit2IfAvailable:usesStoreKit2IfAvailable
49
+ dangerousSettings:nil];
50
+ purchases.delegate = self;
51
+ }
52
+
53
+ RCT_EXPORT_METHOD(setAllowSharingStoreAccount:(BOOL)allowSharingStoreAccount) {
54
+ #pragma GCC diagnostic push
55
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
56
+ [RCCommonFunctionality setAllowSharingStoreAccount:allowSharingStoreAccount];
57
+ #pragma GCC diagnostic pop
58
+ }
59
+
60
+ RCT_EXPORT_METHOD(setFinishTransactions:(BOOL)finishTransactions) {
61
+ [RCCommonFunctionality setFinishTransactions:finishTransactions];
62
+ }
63
+
64
+ RCT_REMAP_METHOD(getOfferings,
65
+ getOfferingsWithResolve:(RCTPromiseResolveBlock)resolve
66
+ reject:(RCTPromiseRejectBlock)reject) {
67
+ [RCCommonFunctionality getOfferingsWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
68
+ reject:reject]];
69
+ }
70
+
71
+ RCT_EXPORT_METHOD(getProductInfo:(NSArray *)products
72
+ type:(NSString *)type
73
+ resolve:(RCTPromiseResolveBlock)resolve
74
+ reject:(RCTPromiseRejectBlock)reject) {
75
+ [RCCommonFunctionality getProductInfo:products completionBlock:^(NSArray<NSDictionary *> *productObjects) {
76
+ resolve(productObjects);
77
+ }];
78
+ }
79
+
80
+ RCT_REMAP_METHOD(purchaseProduct,
81
+ purchaseProduct:(NSString *)productIdentifier
82
+ upgradeInfo:(NSDictionary *)upgradeInfo
83
+ type:(NSString *)type
84
+ signedDiscountTimestamp:(NSString *)signedDiscountTimestamp
85
+ resolve:(RCTPromiseResolveBlock)resolve
86
+ reject:(RCTPromiseRejectBlock)reject) {
87
+ [RCCommonFunctionality purchaseProduct:productIdentifier
88
+ signedDiscountTimestamp:signedDiscountTimestamp
89
+ completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
90
+ }
91
+
92
+
93
+ RCT_REMAP_METHOD(purchasePackage,
94
+ purchasePackage:(NSString *)packageIdentifier
95
+ offeringIdentifier:(NSString *)offeringIdentifier
96
+ upgradeInfo:(NSDictionary *)upgradeInfo
97
+ signedDiscountTimestamp:(NSString *)signedDiscountTimestamp
98
+ resolve:(RCTPromiseResolveBlock)resolve
99
+ reject:(RCTPromiseRejectBlock)reject) {
100
+ [RCCommonFunctionality purchasePackage:packageIdentifier
101
+ offering:offeringIdentifier
102
+ signedDiscountTimestamp:signedDiscountTimestamp
103
+ completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
104
+ }
105
+
106
+ RCT_REMAP_METHOD(restoreTransactions,
107
+ restoreTransactionsWithResolve:(RCTPromiseResolveBlock)resolve
108
+ reject:(RCTPromiseRejectBlock)reject) {
109
+ [RCCommonFunctionality restorePurchasesWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve
110
+ reject:reject]];
111
+ }
112
+
113
+ RCT_EXPORT_METHOD(syncPurchases) {
114
+ [RCCommonFunctionality syncPurchasesWithCompletionBlock:nil];
115
+ }
116
+
117
+ RCT_REMAP_METHOD(getAppUserID,
118
+ getAppUserIDWithResolve:(RCTPromiseResolveBlock)resolve
119
+ reject:(RCTPromiseRejectBlock)reject) {
120
+ resolve([RCCommonFunctionality appUserID]);
121
+ }
122
+
123
+ RCT_EXPORT_METHOD(logIn:(nonnull NSString *)appUserID
124
+ resolve:(RCTPromiseResolveBlock)resolve
125
+ reject:(RCTPromiseRejectBlock)reject) {
126
+ [RCCommonFunctionality logInWithAppUserID:appUserID
127
+ completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
128
+ }
129
+
130
+ RCT_REMAP_METHOD(logOut,
131
+ logOutWithResolve:(RCTPromiseResolveBlock)resolve
132
+ reject:(RCTPromiseRejectBlock)reject) {
133
+ [RCCommonFunctionality logOutWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
134
+ }
135
+
136
+ RCT_REMAP_METHOD(setDebugLogsEnabled,
137
+ debugLogsEnabled:(BOOL)enabled) {
138
+ [RCCommonFunctionality setDebugLogsEnabled:enabled];
139
+ }
140
+
141
+ RCT_EXPORT_METHOD(setSimulatesAskToBuyInSandbox:(BOOL)simulatesAskToBuyInSandbox)
142
+ {
143
+ [RCCommonFunctionality setSimulatesAskToBuyInSandbox:simulatesAskToBuyInSandbox];
144
+ }
145
+
146
+ RCT_REMAP_METHOD(getCustomerInfo,
147
+ customerInfoWithResolve:(RCTPromiseResolveBlock)resolve
148
+ reject:(RCTPromiseRejectBlock)reject) {
149
+ [RCCommonFunctionality getCustomerInfoWithCompletionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
150
+ }
151
+
152
+ RCT_EXPORT_METHOD(setAutomaticAppleSearchAdsAttributionCollection:(BOOL)automaticAppleSearchAdsAttributionCollection)
153
+ {
154
+ [RCCommonFunctionality setAutomaticAppleSearchAdsAttributionCollection:automaticAppleSearchAdsAttributionCollection];
155
+ }
156
+
157
+ RCT_REMAP_METHOD(isAnonymous,
158
+ isAnonymousWithResolve:(RCTPromiseResolveBlock)resolve
159
+ reject:(RCTPromiseRejectBlock)reject) {
160
+ resolve(@([RCCommonFunctionality isAnonymous]));
161
+ }
162
+
163
+ RCT_EXPORT_METHOD(makeDeferredPurchase:(nonnull NSNumber *)callbackID
164
+ resolve:(RCTPromiseResolveBlock)resolve
165
+ reject:(RCTPromiseRejectBlock)reject) {
166
+ StartPurchaseBlock defermentBlock = [self.defermentBlocks objectAtIndex:[callbackID integerValue]];
167
+ [RCCommonFunctionality makeDeferredPurchase:defermentBlock
168
+ completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
169
+ }
170
+
171
+ RCT_EXPORT_METHOD(checkTrialOrIntroductoryPriceEligibility:(NSArray *)products
172
+ resolve:(RCTPromiseResolveBlock)resolve
173
+ reject:(RCTPromiseRejectBlock)reject) {
174
+ [RCCommonFunctionality checkTrialOrIntroductoryPriceEligibility:products
175
+ completionBlock:^(NSDictionary<NSString *,RCIntroEligibility *> * _Nonnull responseDictionary) {
176
+ resolve([NSDictionary dictionaryWithDictionary:responseDictionary]);
177
+ }];
178
+ }
179
+
180
+ RCT_EXPORT_METHOD(invalidateCustomerInfoCache) {
181
+ [RCCommonFunctionality invalidateCustomerInfoCache];
182
+ }
183
+
184
+ RCT_REMAP_METHOD(getPromotionalOffer,
185
+ getPromotionalOfferForProductIdentifier:(NSString *)productIdentifier
186
+ discount:(NSString *)discount
187
+ resolve:(RCTPromiseResolveBlock)resolve
188
+ reject:(RCTPromiseRejectBlock)reject) {
189
+ [RCCommonFunctionality promotionalOfferForProductIdentifier:productIdentifier
190
+ discount:discount
191
+ completionBlock:[self getResponseCompletionBlockWithResolve:resolve reject:reject]];
192
+ }
193
+
194
+ RCT_EXPORT_METHOD(presentCodeRedemptionSheet) {
195
+ if (@available(iOS 14.0, *)) {
196
+ [RCCommonFunctionality presentCodeRedemptionSheet];
197
+ } else {
198
+ NSLog(@"[Purchases] Warning: tried to present codeRedemptionSheet, but it's only available on iOS 14.0 or greater.");
199
+ }
200
+ }
201
+
202
+ #pragma mark - Subscriber Attributes
203
+
204
+ RCT_EXPORT_METHOD(setProxyURLString:(nullable NSString *)proxyURLString) {
205
+ [RCCommonFunctionality setProxyURLString:proxyURLString];
206
+ }
207
+
208
+ RCT_EXPORT_METHOD(setAttributes:(NSDictionary *)attributes) {
209
+ [RCCommonFunctionality setAttributes:attributes];
210
+ }
211
+
212
+ RCT_EXPORT_METHOD(setEmail:(NSString *)email) {
213
+ [RCCommonFunctionality setEmail:email];
214
+ }
215
+
216
+ RCT_EXPORT_METHOD(setPhoneNumber:(NSString *)phoneNumber) {
217
+ [RCCommonFunctionality setPhoneNumber:phoneNumber];
218
+ }
219
+
220
+ RCT_EXPORT_METHOD(setDisplayName:(NSString *)displayName) {
221
+ [RCCommonFunctionality setDisplayName:displayName];
222
+ }
223
+
224
+ RCT_EXPORT_METHOD(setPushToken:(NSString *)pushToken) {
225
+ [RCCommonFunctionality setPushToken:pushToken];
226
+ }
227
+
228
+ # pragma mark Attribution IDs
229
+
230
+ RCT_EXPORT_METHOD(collectDeviceIdentifiers) {
231
+ [RCCommonFunctionality collectDeviceIdentifiers];
232
+ }
233
+
234
+ RCT_EXPORT_METHOD(setAdjustID:(NSString *)adjustID) {
235
+ [RCCommonFunctionality setAdjustID:adjustID];
236
+ }
237
+
238
+ RCT_EXPORT_METHOD(setAppsflyerID:(NSString *)appsflyerID) {
239
+ [RCCommonFunctionality setAppsflyerID:appsflyerID];
240
+ }
241
+
242
+ RCT_EXPORT_METHOD(setFBAnonymousID:(NSString *)fbAnonymousID) {
243
+ [RCCommonFunctionality setFBAnonymousID:fbAnonymousID];
244
+ }
245
+
246
+ RCT_EXPORT_METHOD(setMparticleID:(NSString *)mparticleID) {
247
+ [RCCommonFunctionality setMparticleID:mparticleID];
248
+ }
249
+
250
+ RCT_EXPORT_METHOD(setOnesignalID:(NSString *)onesignalID) {
251
+ [RCCommonFunctionality setOnesignalID:onesignalID];
252
+ }
253
+
254
+ RCT_EXPORT_METHOD(setAirshipChannelID:(NSString *)airshipChannelID) {
255
+ [RCCommonFunctionality setAirshipChannelID:airshipChannelID];
256
+ }
257
+
258
+ # pragma mark Campaign parameters
259
+
260
+ RCT_EXPORT_METHOD(setMediaSource:(NSString *)mediaSource) {
261
+ [RCCommonFunctionality setMediaSource:mediaSource];
262
+ }
263
+
264
+ RCT_EXPORT_METHOD(setCampaign:(NSString *)campaign) {
265
+ [RCCommonFunctionality setCampaign:campaign];
266
+ }
267
+
268
+ RCT_EXPORT_METHOD(setAdGroup:(NSString *)adGroup) {
269
+ [RCCommonFunctionality setAdGroup:adGroup];
270
+ }
271
+
272
+ RCT_EXPORT_METHOD(setAd:(NSString *)ad) {
273
+ [RCCommonFunctionality setAd:ad];
274
+ }
275
+
276
+ RCT_EXPORT_METHOD(setKeyword:(NSString *)keyword) {
277
+ [RCCommonFunctionality setKeyword:keyword];
278
+ }
279
+
280
+ RCT_EXPORT_METHOD(setCreative:(NSString *)creative) {
281
+ [RCCommonFunctionality setCreative:creative];
282
+ }
283
+
284
+ RCT_REMAP_METHOD(canMakePayments,
285
+ canMakePaymentsWithFeatures:(NSArray<NSNumber *> *)features
286
+ resolve:(RCTPromiseResolveBlock)resolve
287
+ reject:(RCTPromiseRejectBlock)reject) {
288
+ resolve(@([RCCommonFunctionality canMakePaymentsWithFeatures:features]));
289
+ }
290
+
291
+ RCT_REMAP_METHOD(isConfigured,
292
+ isConfiguredWithResolve:(RCTPromiseResolveBlock)resolve
293
+ reject:(RCTPromiseRejectBlock)reject) {
294
+ resolve(@(RCPurchases.isConfigured));
295
+ }
296
+
297
+ #pragma mark -
298
+ #pragma mark Delegate Methods
299
+ - (void)purchases:(RCPurchases *)purchases didReceiveUpdatedCustomerInfo:(RCCustomerInfo *)customerInfo {
300
+ [self sendEventWithName:RNPurchasesCustomerInfoUpdatedEvent body:customerInfo.dictionary];
301
+ }
302
+
303
+ - (void)purchases:(RCPurchases *)purchases
304
+ readyForPromotedProduct:(RCStoreProduct *)product
305
+ purchase:(void (^)(void (^ _Nonnull)(RCStoreTransaction * _Nullable, RCCustomerInfo * _Nullable, NSError * _Nullable, BOOL)))startPurchase {
306
+ if (!self.defermentBlocks) {
307
+ self.defermentBlocks = [NSMutableArray array];
308
+ }
309
+ [self.defermentBlocks addObject:startPurchase];
310
+ NSInteger position = [self.defermentBlocks count] - 1;
311
+ [self sendEventWithName:RNPurchasesShouldPurchasePromoProductEvent body:@{@"callbackID": @(position)}];
312
+ }
313
+
314
+ #pragma mark -
315
+ #pragma mark Helper Methods
316
+
317
+ - (void)rejectPromiseWithBlock:(RCTPromiseRejectBlock)reject error:(NSError *)error {
318
+ reject([NSString stringWithFormat: @"%ld", (long)error.code], error.localizedDescription, error);
319
+ }
320
+
321
+ - (void (^)(NSDictionary *, RCErrorContainer *))getResponseCompletionBlockWithResolve:(RCTPromiseResolveBlock)resolve
322
+ reject:(RCTPromiseRejectBlock)reject {
323
+ return ^(NSDictionary *_Nullable responseDictionary, RCErrorContainer *_Nullable error) {
324
+ if (error) {
325
+ reject([NSString stringWithFormat:@"%ld", (long) error.code], error.message, error.error);
326
+ } else if (responseDictionary) {
327
+ resolve([NSDictionary dictionaryWithDictionary:responseDictionary]);
328
+ } else {
329
+ resolve(nil);
330
+ }
331
+ };
332
+ }
333
+
334
+ - (NSString *)platformFlavor {
335
+ return @"react-native";
336
+ }
337
+
338
+ - (NSString *)platformFlavorVersion {
339
+ return @"4.6.1";
340
+ }
341
+
342
+ @end
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "react-native-purchases",
3
3
  "title": "React Native Purchases",
4
- "version": "4.6.1",
4
+ "version": "5.0.0-beta.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",
8
8
  "source": "src/index",
9
9
  "files": [
10
- "scripts/build.js",
11
10
  "dist",
12
11
  "android",
13
12
  "!android/gradlew*",
@@ -30,12 +29,11 @@
30
29
  "scripts": {
31
30
  "build": "tsc",
32
31
  "build-watch": "tsc --watch",
33
- "preinstall": "node scripts/build.js",
34
32
  "test": "jest",
35
33
  "tslint": "tslint -c tslint.json 'src/*.ts'",
36
34
  "prepublish": "tsc",
37
- "example": "(yarn --cwd examples/purchaseTester) && (yarn --cwd examples/purchaseTesterTypescript)",
38
- "pods": "(cd examples/purchaseTester && npx pod-install --quiet) && (cd examples/purchaseTesterTypescript && npx pod-install --quiet)",
35
+ "example": "yarn --cwd examples/MagicWeather && yarn --cwd examples/purchaseTesterTypescript",
36
+ "pods": "(cd examples/MagicWeather && npx pod-install --quiet) && (cd examples/purchaseTesterTypescript && npx pod-install --quiet)",
39
37
  "bootstrap": "yarn example && yarn && yarn pods"
40
38
  },
41
39
  "repository": {
@@ -77,7 +75,7 @@
77
75
  "jest": {
78
76
  "preset": "react-native",
79
77
  "modulePathIgnorePatterns": [
80
- "<rootDir>/examples/purchaseTester/node_modules",
78
+ "<rootDir>/examples/purchaseTesterTypescript/node_modules",
81
79
  "<rootDir>/lib/"
82
80
  ],
83
81
  "moduleFileExtensions": [
File without changes
@@ -1,6 +1,6 @@
1
1
  const {NativeModules} = require("react-native");
2
2
 
3
- global.purchaserInfoStub = {
3
+ global.customerInfoStub = {
4
4
  activeSubscriptions: ["annual_freetrial"],
5
5
  allExpirationDates: {
6
6
  onetime_purchase: null,
@@ -663,7 +663,7 @@ global.discountStub = {
663
663
  periodNumberOfUnits: 1,
664
664
  };
665
665
 
666
- global.paymentDiscountStub = {
666
+ global.promotionalOfferStub = {
667
667
  identifier: "promo_cat",
668
668
  keyIdentifier: "keyID",
669
669
  nonce: "nonce",
@@ -680,13 +680,10 @@ NativeModules.RNPurchases = {
680
680
  makePurchase: jest.fn(),
681
681
  restoreTransactions: jest.fn(),
682
682
  getAppUserID: jest.fn(),
683
- createAlias: jest.fn(),
684
- identify: jest.fn(),
685
683
  setDebugLogsEnabled: jest.fn(),
686
- getPurchaserInfo: jest.fn(),
684
+ getCustomerInfo: jest.fn(),
687
685
  logIn: jest.fn(),
688
686
  logOut: jest.fn(),
689
- reset: jest.fn(),
690
687
  syncPurchases: jest.fn(),
691
688
  setFinishTransactions: jest.fn(),
692
689
  purchaseProduct: jest.fn(),
@@ -696,8 +693,8 @@ NativeModules.RNPurchases = {
696
693
  checkTrialOrIntroductoryPriceEligibility: jest.fn(),
697
694
  purchaseDiscountedPackage: jest.fn(),
698
695
  purchaseDiscountedProduct: jest.fn(),
699
- getPaymentDiscount: jest.fn(),
700
- invalidatePurchaserInfoCache: jest.fn(),
696
+ getPromotionalOffer: jest.fn(),
697
+ invalidateCustomerInfoCache: jest.fn(),
701
698
  setAttributes: jest.fn(),
702
699
  setEmail: jest.fn(),
703
700
  setPhoneNumber: jest.fn(),
@@ -710,4 +707,3 @@ NativeModules.RNPurchases = {
710
707
  jest.mock(
711
708
  'react-native/Libraries/EventEmitter/NativeEventEmitter',
712
709
  );
713
-
@@ -1,39 +0,0 @@
1
- #!/bin/sh
2
-
3
- cd ios/
4
-
5
- VERSION=$1
6
- CURRENT_VERSION=$(cat .common_version)
7
-
8
- if [ "$VERSION" == "$CURRENT_VERSION" ]; then
9
- echo "The newest version is already installed. Exiting."
10
- exit 0
11
- fi
12
-
13
- pwd
14
-
15
- URL=https://github.com/RevenueCat/purchases-hybrid-common/releases/download/$VERSION/PurchasesHybridCommon.framework.zip
16
-
17
- echo "Downloading Purchases common hybrid SDKs classes $VERSION from $URL, this may take a minute."
18
-
19
- if ! which curl > /dev/null; then echo "curl command not found. Please install curl"; exit 1; fi;
20
- if ! which unzip > /dev/null; then echo "unzip command not found. Please install unzip"; exit 1; fi;
21
-
22
- if [ -d ./PurchasesHybridCommon.framework ]; then
23
- echo "Old classes found. Removing them and installing version $VERSION"
24
- rm -rf ./PurchasesHybridCommon.framework
25
- fi
26
-
27
- curl -sSL $URL > tempCommon.zip
28
- # In some cases the temp folder can not be created by unzip, https://github.com/RevenueCat/react-native-purchases/issues/26
29
- mkdir -p tempCommon
30
- unzip -o tempCommon.zip -d tempCommon
31
- mv tempCommon/Carthage/Build/iOS/PurchasesHybridCommon.framework ./PurchasesHybridCommon.framework
32
- rm -r tempCommon
33
- rm tempCommon.zip
34
-
35
- if ! [ -d ./PurchasesHybridCommon.framework ]; then
36
- echo "Common files not found. Please reinstall react-native-purchases"; exit 1;
37
- fi;
38
-
39
- echo "$VERSION" > .common_version
@@ -1,39 +0,0 @@
1
- #!/bin/sh
2
-
3
- cd ios/
4
-
5
- VERSION=$1
6
- CURRENT_VERSION=$(cat .framework_version)
7
-
8
- if [ "$VERSION" == "$CURRENT_VERSION" ]; then
9
- echo "The newest version is already installed. Exiting."
10
- exit 0
11
- fi
12
-
13
- pwd
14
-
15
- URL=https://github.com/RevenueCat/purchases-ios/releases/download/$VERSION/Purchases.framework.zip
16
-
17
- echo "Downloading Purchases iOS $VERSION from $URL, this may take a minute."
18
-
19
- if ! which curl > /dev/null; then echo "curl command not found. Please install curl"; exit 1; fi;
20
- if ! which unzip > /dev/null; then echo "unzip command not found. Please install unzip"; exit 1; fi;
21
-
22
- if [ -d ./Purchases.framework ]; then
23
- echo "Old Purchases.framework found. Removing it and installing a $VERSION"
24
- rm -rf ./Purchases.framework
25
- fi
26
-
27
- curl -sSL $URL > temp.zip
28
- # In some cases the temp folder can not be created by unzip, https://github.com/RevenueCat/react-native-purchases/issues/26
29
- mkdir -p temp
30
- unzip -o temp.zip -d temp
31
- mv temp/Carthage/Build/iOS/Purchases.framework ./Purchases.framework
32
- rm -r temp
33
- rm temp.zip
34
-
35
- if ! [ -d ./Purchases.framework ]; then
36
- echo "Purchases.framework not found. Please reinstall react-native-purchases"; exit 1;
37
- fi;
38
-
39
- echo "$VERSION" > .framework_version