react-native-purchases-ui 8.9.1 → 8.9.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.
@@ -17,6 +17,6 @@ Pod::Spec.new do |spec|
17
17
  spec.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
18
18
 
19
19
  spec.dependency "React-Core"
20
- spec.dependency "PurchasesHybridCommonUI", '13.26.0'
20
+ spec.dependency "PurchasesHybridCommonUI", '13.26.1'
21
21
  spec.swift_version = '5.7'
22
22
  end
@@ -59,7 +59,7 @@ android {
59
59
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
60
60
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
61
61
  versionCode 1
62
- versionName '8.9.1'
62
+ versionName '8.9.3'
63
63
  }
64
64
 
65
65
  buildTypes {
@@ -91,7 +91,7 @@ dependencies {
91
91
  //noinspection GradleDynamicVersion
92
92
  implementation "com.facebook.react:react-native:+"
93
93
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
94
- implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:13.26.0'
94
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:13.26.1'
95
95
  implementation 'androidx.compose.ui:ui-android:1.5.4'
96
96
  implementation "androidx.appcompat:appcompat:1.6.1"
97
97
  }
@@ -28,6 +28,7 @@ internal abstract class BasePaywallViewManager<T : View> : SimpleViewManager<T>(
28
28
  private const val OPTION_OFFERING = "offering"
29
29
  private const val OFFERING_IDENTIFIER = "identifier"
30
30
  private const val OPTION_FONT_FAMILY = "fontFamily"
31
+ private const val OPTION_DISPLAY_CLOSE_BUTTON = "displayCloseButton"
31
32
  }
32
33
 
33
34
  abstract fun setOfferingId(view: T, identifier: String)
@@ -52,23 +53,32 @@ internal abstract class BasePaywallViewManager<T : View> : SimpleViewManager<T>(
52
53
 
53
54
  @ReactProp(name = PROP_OPTIONS)
54
55
  fun setOptions(view: T, options: ReadableMap?) {
55
- options?.let { props ->
56
- setOfferingIdProp(view, props)
57
- setFontFamilyProp(view, props)
58
- setDisplayCloseButton(view, props)
56
+ if (options != null) {
57
+ setOfferingIdProp(view, options)
58
+ setFontFamilyProp(view, options)
59
+ setDisplayCloseButton(view, options)
59
60
  }
60
61
  }
61
62
 
62
- private fun setOfferingIdProp(view: T, props: ReadableMap?) {
63
+ private fun setOfferingIdProp(view: T, options: ReadableMap?) {
64
+ val optionsMap = options?.toHashMap()
65
+ if (optionsMap == null || !optionsMap.containsKey(OPTION_OFFERING)) {
66
+ return
67
+ }
68
+ if (optionsMap[OPTION_OFFERING] == null) {
69
+ // getDynamic crashes if the value is null, that's why we use props?.toHashMap
70
+ return
71
+ }
72
+ // this is a workaround for the fact that getDynamic doesn't work with null values
63
73
  val offeringIdentifier =
64
- props?.getDynamic(OPTION_OFFERING)?.asMap()?.getString(OFFERING_IDENTIFIER)
74
+ options.getDynamic(OPTION_OFFERING)?.asMap()?.getString(OFFERING_IDENTIFIER)
65
75
  offeringIdentifier?.let {
66
76
  setOfferingId(view, it)
67
77
  }
68
78
  }
69
79
 
70
- private fun setFontFamilyProp(view: T, props: ReadableMap?) {
71
- props?.getString(OPTION_FONT_FAMILY)?.let {
80
+ private fun setFontFamilyProp(view: T, options: ReadableMap?) {
81
+ options?.getString(OPTION_FONT_FAMILY)?.let {
72
82
  FontAssetManager.getFontFamily(fontFamilyName = it, view.resources.assets)?.let {
73
83
  setFontFamily(view, CustomFontProvider(it))
74
84
  }
@@ -76,8 +86,8 @@ internal abstract class BasePaywallViewManager<T : View> : SimpleViewManager<T>(
76
86
  }
77
87
 
78
88
  private fun setDisplayCloseButton(view: T, options: ReadableMap) {
79
- options.takeIf { it.hasKey("displayCloseButton") }?.let {
80
- setDisplayDismissButton(view, it.getBoolean("displayCloseButton"))
89
+ options.takeIf { it.hasKey(OPTION_DISPLAY_CLOSE_BUTTON) }?.let {
90
+ setDisplayDismissButton(view, it.getBoolean(OPTION_DISPLAY_CLOSE_BUTTON))
81
91
  }
82
92
  }
83
93
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-purchases-ui",
3
3
  "title": "React Native Purchases UI",
4
- "version": "8.9.1",
4
+ "version": "8.9.3",
5
5
  "description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android.",
6
6
  "main": "lib/commonjs/index",
7
7
  "module": "lib/module/index",
@@ -114,7 +114,7 @@
114
114
  ]
115
115
  },
116
116
  "dependencies": {
117
- "@revenuecat/purchases-typescript-internal": "13.26.0",
118
- "react-native-purchases": "8.9.1"
117
+ "@revenuecat/purchases-typescript-internal": "13.26.1",
118
+ "react-native-purchases": "8.9.3"
119
119
  }
120
120
  }