@momo-kits/native-kits 0.112.1-beta.16 → 0.112.1-beta.18
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.
|
@@ -9,6 +9,7 @@ import androidx.compose.runtime.remember
|
|
|
9
9
|
import androidx.compose.runtime.setValue
|
|
10
10
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
11
11
|
import androidx.compose.ui.unit.Dp
|
|
12
|
+
import vn.momo.kits.components.TrustBannerData
|
|
12
13
|
import vn.momo.kits.const.AppStatusBar
|
|
13
14
|
import vn.momo.kits.const.AppTheme
|
|
14
15
|
import vn.momo.kits.const.Theme
|
|
@@ -59,20 +60,30 @@ val ApplicationContext = staticCompositionLocalOf<MiniAppContext?> {
|
|
|
59
60
|
error("no context provided!")
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
val AppConfig = staticCompositionLocalOf<KitConfig?> {
|
|
64
|
+
error("no config provided!")
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
data class KitConfig(
|
|
68
|
+
val trustBanner: TrustBannerData? = null,
|
|
69
|
+
val headerBar: String? = null,
|
|
70
|
+
val headerGradient: String? = null
|
|
71
|
+
)
|
|
72
|
+
|
|
62
73
|
@Composable
|
|
63
74
|
fun ApplicationContainer(
|
|
64
75
|
theme: Theme = defaultTheme,
|
|
65
76
|
composeApi: ComposeApi? = null,
|
|
66
77
|
statusBarHeight: Dp? = null,
|
|
67
78
|
applicationContext: MiniAppContext? = null,
|
|
68
|
-
config:
|
|
79
|
+
config: KitConfig? = null,
|
|
69
80
|
content: @Composable () -> Unit,
|
|
70
81
|
) {
|
|
71
82
|
var appTheme by remember { mutableStateOf(theme) }
|
|
72
83
|
|
|
73
84
|
LaunchedEffect(Unit) {
|
|
74
85
|
try {
|
|
75
|
-
val headerBar = config?.
|
|
86
|
+
val headerBar = config?.headerBar
|
|
76
87
|
if (headerBar != null && appTheme.assets.headerBackground == null) {
|
|
77
88
|
appTheme = appTheme.copy(
|
|
78
89
|
assets = ThemeAssets(
|
|
@@ -94,6 +105,7 @@ fun ApplicationContainer(
|
|
|
94
105
|
AppNavigator provides Navigator(),
|
|
95
106
|
AppStatusBar provides appStatusBarHeight,
|
|
96
107
|
ApplicationContext provides applicationContext,
|
|
108
|
+
AppConfig provides config
|
|
97
109
|
) {
|
|
98
110
|
content()
|
|
99
111
|
}
|
|
@@ -19,6 +19,7 @@ import androidx.compose.ui.graphics.Color
|
|
|
19
19
|
import androidx.compose.ui.layout.ContentScale
|
|
20
20
|
import androidx.compose.ui.unit.dp
|
|
21
21
|
import androidx.compose.ui.unit.sp
|
|
22
|
+
import vn.momo.kits.application.AppConfig
|
|
22
23
|
import vn.momo.kits.modifier.noFeedbackClickable
|
|
23
24
|
|
|
24
25
|
val defaultBanner = TrustBannerData(
|
|
@@ -47,25 +48,25 @@ const val contentColor = 0xFF484848
|
|
|
47
48
|
const val subContentColor = 0xFFEB2F96
|
|
48
49
|
|
|
49
50
|
data class TrustBannerData(
|
|
50
|
-
val content: Map<String, String
|
|
51
|
-
val subContent: Map<String, String
|
|
52
|
-
val pciImage: String,
|
|
53
|
-
val momoImage: String,
|
|
54
|
-
val sslImage: String,
|
|
55
|
-
val icons: List<String
|
|
56
|
-
val urlConfig: String
|
|
51
|
+
val content: Map<String, String> = mapOf("vi" to "", "en" to ""),
|
|
52
|
+
val subContent: Map<String, String> = mapOf("vi" to "", "en" to ""),
|
|
53
|
+
val pciImage: String? = null,
|
|
54
|
+
val momoImage: String? = null,
|
|
55
|
+
val sslImage: String? = null,
|
|
56
|
+
val icons: List<String>? = null,
|
|
57
|
+
val urlConfig: String = ""
|
|
57
58
|
)
|
|
58
59
|
|
|
59
60
|
@Composable
|
|
60
61
|
fun TrustBanner(
|
|
61
|
-
trustBanner: TrustBannerData = defaultBanner,
|
|
62
62
|
serviceName: String = "",
|
|
63
63
|
screenName: String = "",
|
|
64
64
|
onPress: ((Map<String, String>) -> Unit)? = null,
|
|
65
65
|
trackEvent: ((String, Map<String, String>) -> Unit)? = null,
|
|
66
66
|
language: String = "vi"
|
|
67
|
-
|
|
68
67
|
) {
|
|
68
|
+
val appConfig = AppConfig.current
|
|
69
|
+
val trustBanner = appConfig?.trustBanner ?: defaultBanner
|
|
69
70
|
val trackParams = mapOf(
|
|
70
71
|
"service_name" to serviceName,
|
|
71
72
|
"screen_name" to screenName,
|
|
@@ -103,15 +104,17 @@ fun TrustBanner(
|
|
|
103
104
|
}
|
|
104
105
|
)
|
|
105
106
|
) {
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
if (trustBanner.momoImage != null) {
|
|
108
|
+
Image(
|
|
109
|
+
source = trustBanner.momoImage,
|
|
110
|
+
modifier = Modifier
|
|
111
|
+
.width(64.dp)
|
|
112
|
+
.height(64.dp)
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
Column(
|
|
108
116
|
modifier = Modifier
|
|
109
|
-
.
|
|
110
|
-
.height(64.dp)
|
|
111
|
-
)
|
|
112
|
-
Column (
|
|
113
|
-
modifier = Modifier
|
|
114
|
-
.padding(start = 10.dp)
|
|
117
|
+
.padding(start = 10.dp)
|
|
115
118
|
) {
|
|
116
119
|
Text(
|
|
117
120
|
text = trustBanner.content[language] ?: "",
|
|
@@ -121,10 +124,13 @@ fun TrustBanner(
|
|
|
121
124
|
color = Color(contentColor),
|
|
122
125
|
maxLines = 2
|
|
123
126
|
)
|
|
124
|
-
Row(
|
|
125
|
-
|
|
127
|
+
Row(
|
|
128
|
+
modifier = Modifier.fillMaxWidth(),
|
|
129
|
+
horizontalArrangement = Arrangement.SpaceBetween
|
|
130
|
+
) {
|
|
131
|
+
Row(
|
|
126
132
|
verticalAlignment = Alignment.CenterVertically,
|
|
127
|
-
)
|
|
133
|
+
) {
|
|
128
134
|
Text(
|
|
129
135
|
text = trustBanner.subContent[language] ?: "",
|
|
130
136
|
lineHeight = 16.sp,
|
|
@@ -138,23 +144,27 @@ fun TrustBanner(
|
|
|
138
144
|
)
|
|
139
145
|
}
|
|
140
146
|
Row {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
if (trustBanner.pciImage != null) {
|
|
148
|
+
Image(
|
|
149
|
+
source = trustBanner.pciImage, modifier = Modifier
|
|
150
|
+
.padding(end = 4.dp)
|
|
151
|
+
.width(27.dp)
|
|
152
|
+
.height(20.dp), options = Options(
|
|
153
|
+
contentScale = ContentScale.Fit,
|
|
154
|
+
)
|
|
148
155
|
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
}
|
|
157
|
+
if (trustBanner.sslImage != null) {
|
|
158
|
+
Image(
|
|
159
|
+
source = trustBanner.sslImage, modifier = Modifier
|
|
160
|
+
.width(52.dp)
|
|
161
|
+
.height(20.dp),
|
|
162
|
+
options = Options(
|
|
163
|
+
contentScale = ContentScale.Fit,
|
|
164
|
+
)
|
|
156
165
|
)
|
|
157
|
-
|
|
166
|
+
}
|
|
167
|
+
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
170
|
}
|