@momo-kits/native-kits 0.89.8 → 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.
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +33 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +21 -0
- package/package.json +1 -1
|
@@ -88,7 +88,6 @@ fun Header(
|
|
|
88
88
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
89
89
|
titlePosition: TitlePosition,
|
|
90
90
|
title: String,
|
|
91
|
-
backgroundColor: Color,
|
|
92
91
|
isBack: Boolean,
|
|
93
92
|
headerRight: @Composable (() -> Unit)? = null,
|
|
94
93
|
goBack: (() -> Unit) = { },
|
|
@@ -108,7 +107,6 @@ fun Header(
|
|
|
108
107
|
if (headerType != HeaderType.NONE) {
|
|
109
108
|
BoxWithConstraints(
|
|
110
109
|
Modifier.height(statusBarHeight + 52.dp)
|
|
111
|
-
.background(backgroundColor)
|
|
112
110
|
.fillMaxWidth()
|
|
113
111
|
.bottomBorder(
|
|
114
112
|
strokeWidth = if (headerType == HeaderType.SURFACE) 2.dp else 0.dp,
|
|
@@ -38,7 +38,7 @@ enum class HeaderType {
|
|
|
38
38
|
|
|
39
39
|
@Composable
|
|
40
40
|
fun Screen(
|
|
41
|
-
backgroundColor: Color =
|
|
41
|
+
backgroundColor: Color? = null,
|
|
42
42
|
headerBackground: String? = null,
|
|
43
43
|
isBack: Boolean = true,
|
|
44
44
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
@@ -63,7 +63,7 @@ fun Screen(
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
Box(
|
|
66
|
-
Modifier.fillMaxSize().background(AppTheme.current.colors.background.default)
|
|
66
|
+
Modifier.fillMaxSize().background(backgroundColor ?: AppTheme.current.colors.background.default)
|
|
67
67
|
) {
|
|
68
68
|
HeaderImage(headerType, headerBackground ?: AppTheme.current.assets.headerBackground)
|
|
69
69
|
Column(
|
|
@@ -77,7 +77,6 @@ fun Screen(
|
|
|
77
77
|
headerType = headerType,
|
|
78
78
|
title = title,
|
|
79
79
|
titlePosition = titlePosition,
|
|
80
|
-
backgroundColor = backgroundColor,
|
|
81
80
|
headerRight = headerRight,
|
|
82
81
|
isBack = isBack,
|
|
83
82
|
goBack = goBack,
|
|
@@ -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
|
-
.
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
}
|