react-native-purchases 5.0.0-beta.3 → 5.0.0-beta.4

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.
@@ -24,6 +24,6 @@ Pod::Spec.new do |spec|
24
24
  ]
25
25
 
26
26
  spec.dependency "React-Core"
27
- spec.dependency "PurchasesHybridCommon", '4.0.0'
27
+ spec.dependency "PurchasesHybridCommon", '4.1.0'
28
28
  spec.swift_version = '5.0'
29
29
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '5.0.0-beta.3'
32
+ versionName '5.0.0-beta.4'
33
33
  }
34
34
 
35
35
  buildTypes {
@@ -121,6 +121,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
121
121
  dependencies {
122
122
  //noinspection GradleDynamicVersion
123
123
  api 'com.facebook.react:react-native:+'
124
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.0.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.1.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '5.0.0-beta.2'
32
+ versionName '5.0.0-beta.3'
33
33
  }
34
34
 
35
35
  buildTypes {
@@ -121,6 +121,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
121
121
  dependencies {
122
122
  //noinspection GradleDynamicVersion
123
123
  api 'com.facebook.react:react-native:+'
124
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.0.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:4.1.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -1,5 +1,5 @@
1
1
  android.useAndroidX=true
2
- Purchases_kotlinVersion=1.5.31
2
+ Purchases_kotlinVersion=1.6.21
3
3
  Purchases_compileSdkVersion=28
4
4
  Purchases_targetSdkVersion=28
5
5
  Purchases_minSdkVersion=16
@@ -53,6 +53,7 @@ internal object RNPurchasesConverters {
53
53
  return array
54
54
  }
55
55
 
56
+ @Suppress("UNCHECKED_CAST")
56
57
  private fun convertArrayToWritableArray(array: Array<Any?>): WritableArray {
57
58
  val writableArray: WritableArray = WritableNativeArray()
58
59
  for (item in array) {
@@ -71,6 +72,7 @@ internal object RNPurchasesConverters {
71
72
  }
72
73
 
73
74
  @JvmStatic
75
+ @Suppress("UNCHECKED_CAST")
74
76
  fun convertMapToWriteableMap(map: Map<String, *>): WritableMap {
75
77
  val writableMap: WritableMap = WritableNativeMap()
76
78
  for ((key, value) in map) {
@@ -87,4 +89,4 @@ internal object RNPurchasesConverters {
87
89
  }
88
90
  return writableMap
89
91
  }
90
- }
92
+ }
@@ -80,14 +80,14 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
80
80
  @ReactMethod
81
81
  public void setupPurchases(String apiKey, @Nullable String appUserID,
82
82
  boolean observerMode, @Nullable String userDefaultsSuiteName,
83
- @Nullable Boolean usesStoreKit2IfAvailable, boolean useAmazon) {
83
+ @Nullable Boolean usesStoreKit2IfAvailable, boolean useAmazon) {
84
84
  PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
85
85
  Store store = Store.PLAY_STORE;
86
86
  if (useAmazon) {
87
87
  store = Store.AMAZON;
88
88
  }
89
89
  CommonKt.configure(reactContext, apiKey, appUserID, observerMode, platformInfo, store);
90
- Purchases.getSharedInstance().setUpdatedPurchaserInfoListener(this);
90
+ Purchases.getSharedInstance().setUpdatedCustomerInfoListener(this);
91
91
  }
92
92
 
93
93
  @ReactMethod
@@ -290,11 +290,17 @@ export default class Purchases {
290
290
  */
291
291
  static syncPurchases(): Promise<void>;
292
292
  /**
293
+ * @deprecated, use enableAdServicesAttributionTokenCollection instead.
293
294
  * Enable automatic collection of Apple Search Ad attribution. Disabled by default
294
295
  * @param {boolean} enabled Enable or not automatic apple search ads attribution collection
295
296
  * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
296
297
  */
297
298
  static setAutomaticAppleSearchAdsAttributionCollection(enabled: boolean): Promise<void>;
299
+ /**
300
+ * Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default
301
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
302
+ */
303
+ static enableAdServicesAttributionTokenCollection(): Promise<void>;
298
304
  /**
299
305
  * @returns { Promise<boolean> } If the `appUserID` has been generated by RevenueCat or not.
300
306
  * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
package/dist/purchases.js CHANGED
@@ -498,6 +498,7 @@ var Purchases = /** @class */ (function () {
498
498
  });
499
499
  };
500
500
  /**
501
+ * @deprecated, use enableAdServicesAttributionTokenCollection instead.
501
502
  * Enable automatic collection of Apple Search Ad attribution. Disabled by default
502
503
  * @param {boolean} enabled Enable or not automatic apple search ads attribution collection
503
504
  * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
@@ -512,6 +513,26 @@ var Purchases = /** @class */ (function () {
512
513
  });
513
514
  });
514
515
  };
516
+ /**
517
+ * Enable automatic collection of Apple Search Ad attribution on iOS. Disabled by default
518
+ * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
519
+ */
520
+ Purchases.enableAdServicesAttributionTokenCollection = function () {
521
+ return __awaiter(this, void 0, void 0, function () {
522
+ return __generator(this, function (_a) {
523
+ switch (_a.label) {
524
+ case 0:
525
+ if (!(react_native_2.Platform.OS === "ios")) return [3 /*break*/, 2];
526
+ return [4 /*yield*/, Purchases.throwIfNotConfigured()];
527
+ case 1:
528
+ _a.sent();
529
+ RNPurchases.enableAdServicesAttributionTokenCollection();
530
+ _a.label = 2;
531
+ case 2: return [2 /*return*/];
532
+ }
533
+ });
534
+ });
535
+ };
515
536
  /**
516
537
  * @returns { Promise<boolean> } If the `appUserID` has been generated by RevenueCat or not.
517
538
  * @returns {Promise<void>} The promise will be rejected if setup has not been called yet.
package/ios/RNPurchases.m CHANGED
@@ -155,6 +155,15 @@ RCT_EXPORT_METHOD(setAutomaticAppleSearchAdsAttributionCollection:(BOOL)automati
155
155
  [RCCommonFunctionality setAutomaticAppleSearchAdsAttributionCollection:automaticAppleSearchAdsAttributionCollection];
156
156
  }
157
157
 
158
+ RCT_EXPORT_METHOD(enableAdServicesAttributionTokenCollection)
159
+ {
160
+ if (@available(iOS 14.3, macOS 11.1, macCatalyst 14.3, *)) {
161
+ [RCCommonFunctionality enableAdServicesAttributionTokenCollection];
162
+ } else {
163
+ NSLog(@"[Purchases] Warning: tried to enable AdServices attribution token collection, but it's only available on iOS 14.3 or greater or macOS 11.1 or greater.");
164
+ }
165
+ }
166
+
158
167
  RCT_REMAP_METHOD(isAnonymous,
159
168
  isAnonymousWithResolve:(RCTPromiseResolveBlock)resolve
160
169
  reject:(RCTPromiseRejectBlock)reject) {
@@ -337,7 +346,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
337
346
  }
338
347
 
339
348
  - (NSString *)platformFlavorVersion {
340
- return @"5.0.0-beta.3";
349
+ return @"5.0.0-beta.4";
341
350
  }
342
351
 
343
352
  @end
@@ -155,6 +155,15 @@ RCT_EXPORT_METHOD(setAutomaticAppleSearchAdsAttributionCollection:(BOOL)automati
155
155
  [RCCommonFunctionality setAutomaticAppleSearchAdsAttributionCollection:automaticAppleSearchAdsAttributionCollection];
156
156
  }
157
157
 
158
+ RCT_EXPORT_METHOD(enableAdServicesAttributionTokenCollection)
159
+ {
160
+ if (@available(iOS 14.3, macOS 11.1, macCatalyst 14.3, *)) {
161
+ [RCCommonFunctionality enableAdServicesAttributionTokenCollection];
162
+ } else {
163
+ NSLog(@"[Purchases] Warning: tried to enable AdServices attribution token collection, but it's only available on iOS 14.3 or greater or macOS 11.1 or greater.");
164
+ }
165
+ }
166
+
158
167
  RCT_REMAP_METHOD(isAnonymous,
159
168
  isAnonymousWithResolve:(RCTPromiseResolveBlock)resolve
160
169
  reject:(RCTPromiseRejectBlock)reject) {
@@ -337,7 +346,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
337
346
  }
338
347
 
339
348
  - (NSString *)platformFlavorVersion {
340
- return @"5.0.0-beta.2";
349
+ return @"5.0.0-beta.3";
341
350
  }
342
351
 
343
352
  @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": "5.0.0-beta.3",
4
+ "version": "5.0.0-beta.4",
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",
@@ -2,7 +2,7 @@
2
2
  <!DOCTYPE html>
3
3
  <html>
4
4
  <head>
5
- <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.0.0-beta.3/" />
5
+ <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.0.0-beta.4/" />
6
6
  </head>
7
7
  <body>
8
8
  </body>
@@ -2,7 +2,7 @@
2
2
  <!DOCTYPE html>
3
3
  <html>
4
4
  <head>
5
- <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.0.0-beta.2/" />
5
+ <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/5.0.0-beta.3/" />
6
6
  </head>
7
7
  <body>
8
8
  </body>
@@ -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
- }