react-native-purchases 8.11.7 → 8.11.9

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.
@@ -25,6 +25,6 @@ Pod::Spec.new do |spec|
25
25
  ]
26
26
 
27
27
  spec.dependency "React-Core"
28
- spec.dependency "PurchasesHybridCommon", '13.38.1'
28
+ spec.dependency "PurchasesHybridCommon", '14.2.0'
29
29
  spec.swift_version = '5.7'
30
30
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '8.11.7'
32
+ versionName '8.11.9'
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:13.38.1'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:14.2.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -19,7 +19,6 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
19
19
  import com.revenuecat.purchases.CustomerInfo;
20
20
  import com.revenuecat.purchases.DangerousSettings;
21
21
  import com.revenuecat.purchases.Purchases;
22
- import com.revenuecat.purchases.PurchasesAreCompletedBy;
23
22
  import com.revenuecat.purchases.Store;
24
23
  import com.revenuecat.purchases.common.PlatformInfo;
25
24
  import com.revenuecat.purchases.hybridcommon.CommonKt;
@@ -41,13 +40,14 @@ import java.util.List;
41
40
  import java.util.Map;
42
41
 
43
42
  import kotlin.UninitializedPropertyAccessException;
43
+ import kotlin.Unit;
44
44
 
45
45
  public class RNPurchasesModule extends ReactContextBaseJavaModule implements UpdatedCustomerInfoListener {
46
46
 
47
47
  private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
48
48
  private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
49
49
  public static final String PLATFORM_NAME = "react-native";
50
- public static final String PLUGIN_VERSION = "8.11.7";
50
+ public static final String PLUGIN_VERSION = "8.11.9";
51
51
 
52
52
  private final ReactApplicationContext reactContext;
53
53
 
@@ -312,9 +312,14 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
312
312
 
313
313
  @Override
314
314
  public void onReceived(@NonNull CustomerInfo customerInfo) {
315
- reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
316
- .emit(RNPurchasesModule.CUSTOMER_INFO_UPDATED,
317
- convertMapToWriteableMap(CustomerInfoMapperKt.map(customerInfo)));
315
+ CustomerInfoMapperKt.mapAsync(
316
+ customerInfo,
317
+ map -> {
318
+ reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
319
+ .emit(RNPurchasesModule.CUSTOMER_INFO_UPDATED, convertMapToWriteableMap(map));
320
+ return Unit.INSTANCE;
321
+ }
322
+ );
318
323
  }
319
324
 
320
325
  @ReactMethod
package/ios/RNPurchases.m CHANGED
@@ -42,6 +42,14 @@ NSString *RNPurchasesLogHandlerEvent = @"Purchases-LogHandlerEvent";
42
42
  RNPurchasesLogHandlerEvent];
43
43
  }
44
44
 
45
+ - (void)sendEventWithName:(NSString *)name body:(id)body {
46
+ /// This prevents a potential crash that can occur when the JS modules are not set up yet.
47
+ /// See https://github.com/RevenueCat/react-native-purchases/issues/1305
48
+ if (self.callableJSModules != nil) {
49
+ [super sendEventWithName:name body:body];
50
+ }
51
+ }
52
+
45
53
  RCT_EXPORT_MODULE();
46
54
 
47
55
  RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
@@ -631,7 +639,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
631
639
  }
632
640
 
633
641
  - (NSString *)platformFlavorVersion {
634
- return @"8.11.7";
642
+ return @"8.11.9";
635
643
  }
636
644
 
637
645
  @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": "8.11.7",
4
+ "version": "8.11.9",
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",
@@ -100,6 +100,6 @@
100
100
  ]
101
101
  },
102
102
  "dependencies": {
103
- "@revenuecat/purchases-typescript-internal": "13.38.1"
103
+ "@revenuecat/purchases-typescript-internal": "14.2.0"
104
104
  }
105
105
  }