@momo-kits/native-kits 0.89.9 → 0.89.10

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.
@@ -22,6 +22,7 @@ import androidx.compose.ui.graphics.Color
22
22
  import androidx.compose.ui.layout.ContentScale
23
23
  import androidx.compose.ui.unit.dp
24
24
  import androidx.compose.ui.unit.sp
25
+ import vn.momo.kits.modifier.noFeedbackClickable
25
26
 
26
27
  val defaultBanner = TrustBannerData(
27
28
  content = mapOf(
@@ -50,7 +51,7 @@ data class TrustBannerClass(
50
51
  val trustBanner: TrustBannerData
51
52
  )
52
53
 
53
- data class TrustBannerData (
54
+ data class TrustBannerData(
54
55
  val content: Map<String, String>,
55
56
  val pciImage: String,
56
57
  val sslImage: String,
@@ -58,6 +59,7 @@ data class TrustBannerData (
58
59
  val momoImage: String,
59
60
  val urlConfig: String
60
61
  )
62
+
61
63
  @Composable
62
64
  fun Avatar(iconURL: String) {
63
65
  Image(
@@ -76,31 +78,45 @@ fun TrustBanner(
76
78
  serviceName: String = "",
77
79
  screenName: String = "",
78
80
  onPress: ((Map<String, String>) -> Unit)? = null,
79
- trackEvent: ((String,Map<String, String>) -> Unit)? = null,
81
+ trackEvent: ((String, Map<String, String>) -> Unit)? = null,
80
82
  language: String = "vi"
81
83
  ) {
84
+ val trackParams = mapOf(
85
+ "service_name" to serviceName,
86
+ "screen_name" to screenName,
87
+ "component_name" to "logo_trust",
88
+ "url_config" to trustBanner.urlConfig
89
+ )
90
+
82
91
  Row(
83
92
  modifier = Modifier
84
93
  .clip(RoundedCornerShape(12.dp))
85
94
  .background(color = Color(backgroundBlue))
86
95
  .padding(12.dp)
87
- .clickable {
88
- if (trackEvent != null) {
89
- trackEvent("service_component_clicked",mapOf(
90
- "service_name" to serviceName,
91
- "screen_name" to screenName,
92
- "component_name" to "logo_trust",
93
- "url_config" to trustBanner.urlConfig
94
- ))
95
- }
96
+ .then(
96
97
  if (onPress != null) {
97
- onPress(mapOf(
98
- "service_name" to serviceName,
99
- "screen_name" to screenName,
100
- "url_config" to trustBanner.urlConfig,
101
- ))
98
+ Modifier.clickable {
99
+ trackEvent?.invoke(
100
+ "service_component_clicked", trackParams
101
+ )
102
+
103
+ onPress(
104
+ mapOf(
105
+ "service_name" to serviceName,
106
+ "screen_name" to screenName,
107
+ "url_config" to trustBanner.urlConfig,
108
+ )
109
+ )
110
+
111
+ }
112
+ } else {
113
+ Modifier.noFeedbackClickable {
114
+ trackEvent?.invoke(
115
+ "service_component_clicked", trackParams
116
+ )
117
+ }
102
118
  }
103
- }
119
+ )
104
120
  ) {
105
121
  Image(
106
122
  source = trustBanner.momoImage,
@@ -0,0 +1,21 @@
1
+ package vn.momo.kits.modifier
2
+
3
+ import androidx.compose.foundation.clickable
4
+ import androidx.compose.foundation.interaction.MutableInteractionSource
5
+ import androidx.compose.runtime.remember
6
+ import androidx.compose.ui.Modifier
7
+ import androidx.compose.ui.composed
8
+ import androidx.compose.ui.semantics.Role
9
+
10
+ fun Modifier.noFeedbackClickable(
11
+ enabled: Boolean = true, onClickLabel: String? = null, role: Role? = null, onClick: () -> Unit
12
+ ): Modifier = composed {
13
+ clickable(
14
+ interactionSource = remember { MutableInteractionSource() },
15
+ indication = null,
16
+ enabled,
17
+ onClickLabel,
18
+ role,
19
+ onClick
20
+ )
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.89.9",
3
+ "version": "0.89.10",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},