react-native-purchases-ui 8.9.1 → 8.9.2
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
@@ -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
|
56
|
-
setOfferingIdProp(view,
|
57
|
-
setFontFamilyProp(view,
|
58
|
-
setDisplayCloseButton(view,
|
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,
|
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
|
-
|
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,
|
71
|
-
|
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(
|
80
|
-
setDisplayDismissButton(view, it.getBoolean(
|
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.
|
4
|
+
"version": "8.9.2",
|
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",
|
@@ -115,6 +115,6 @@
|
|
115
115
|
},
|
116
116
|
"dependencies": {
|
117
117
|
"@revenuecat/purchases-typescript-internal": "13.26.0",
|
118
|
-
"react-native-purchases": "8.9.
|
118
|
+
"react-native-purchases": "8.9.2"
|
119
119
|
}
|
120
120
|
}
|