@momo-kits/native-kits 0.157.8-debug → 0.157.8
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/package.json +1 -1
- package/build.gradle.kts +0 -11
- package/compose/build.gradle.kts +0 -180
- package/compose/build.gradle.kts.backup +0 -180
- package/compose/compose.podspec +0 -54
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -117
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -107
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -305
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -720
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -121
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -405
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -85
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -340
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -198
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -123
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -94
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -136
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -224
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -116
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -448
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -172
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -255
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -231
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -233
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -254
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -241
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -352
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -103
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -70
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -348
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -256
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -494
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -131
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -215
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -531
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -130
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -214
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -590
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -177
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -192
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -239
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -253
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -133
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -99
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -164
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -333
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -552
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -162
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -243
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -187
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -279
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -370
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -167
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -46
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -88
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -161
- package/gradle/libs.versions.toml +0 -57
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/gradle.properties +0 -26
- package/gradlew +0 -252
- package/gradlew.bat +0 -94
- package/settings.gradle.kts +0 -52
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.navigation.component
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.background
|
|
4
|
-
import androidx.compose.foundation.border
|
|
5
|
-
import androidx.compose.foundation.layout.Arrangement
|
|
6
|
-
import androidx.compose.foundation.layout.Box
|
|
7
|
-
import androidx.compose.foundation.layout.Column
|
|
8
|
-
import androidx.compose.foundation.layout.Row
|
|
9
|
-
import androidx.compose.foundation.layout.Spacer
|
|
10
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
11
|
-
import androidx.compose.foundation.layout.height
|
|
12
|
-
import androidx.compose.foundation.layout.padding
|
|
13
|
-
import androidx.compose.foundation.layout.size
|
|
14
|
-
import androidx.compose.foundation.layout.width
|
|
15
|
-
import androidx.compose.foundation.layout.widthIn
|
|
16
|
-
import androidx.compose.foundation.shape.CircleShape
|
|
17
|
-
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
18
|
-
import androidx.compose.foundation.text.BasicText
|
|
19
|
-
import androidx.compose.foundation.text.TextAutoSize
|
|
20
|
-
import androidx.compose.runtime.Composable
|
|
21
|
-
import androidx.compose.runtime.Immutable
|
|
22
|
-
import androidx.compose.runtime.remember
|
|
23
|
-
import androidx.compose.ui.Alignment
|
|
24
|
-
import androidx.compose.ui.Modifier
|
|
25
|
-
import androidx.compose.ui.draw.clip
|
|
26
|
-
import androidx.compose.ui.draw.clipToBounds
|
|
27
|
-
import androidx.compose.ui.layout.ContentScale
|
|
28
|
-
import androidx.compose.ui.text.TextStyle
|
|
29
|
-
import androidx.compose.ui.text.style.TextOverflow
|
|
30
|
-
import androidx.compose.ui.unit.Dp
|
|
31
|
-
import androidx.compose.ui.unit.dp
|
|
32
|
-
import androidx.compose.ui.unit.sp
|
|
33
|
-
import vn.momo.kits.components.Image
|
|
34
|
-
import vn.momo.kits.components.Options
|
|
35
|
-
import vn.momo.kits.components.Skeleton
|
|
36
|
-
import vn.momo.kits.components.Text
|
|
37
|
-
import vn.momo.kits.const.AppTheme
|
|
38
|
-
import vn.momo.kits.const.Colors
|
|
39
|
-
import vn.momo.kits.const.Spacing
|
|
40
|
-
import vn.momo.kits.const.Typography
|
|
41
|
-
import vn.momo.kits.modifier.activeOpacityClickable
|
|
42
|
-
import vn.momo.kits.navigation.component.HeaderTitle.User
|
|
43
|
-
import vn.momo.kits.platform.getScreenDimensions
|
|
44
|
-
|
|
45
|
-
@Composable
|
|
46
|
-
fun HeaderUser(
|
|
47
|
-
data: HeaderTitle
|
|
48
|
-
) {
|
|
49
|
-
if (data !is User) return
|
|
50
|
-
|
|
51
|
-
if (data.isLoading) {
|
|
52
|
-
return TitleUserShimmer()
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
val maxWidth = getScreenDimensions().width.dp - 172.dp
|
|
56
|
-
|
|
57
|
-
Row(
|
|
58
|
-
modifier = Modifier
|
|
59
|
-
.fillMaxWidth()
|
|
60
|
-
.padding(vertical = Spacing.XS)
|
|
61
|
-
.activeOpacityClickable(enabled = data.onPress != null, onClick = { data.onPress?.invoke() }),
|
|
62
|
-
horizontalArrangement = Arrangement.SpaceBetween,
|
|
63
|
-
verticalAlignment = Alignment.CenterVertically
|
|
64
|
-
) {
|
|
65
|
-
Row(
|
|
66
|
-
modifier = Modifier.widthIn(max = maxWidth),
|
|
67
|
-
verticalAlignment = Alignment.CenterVertically
|
|
68
|
-
) {
|
|
69
|
-
Box(modifier = Modifier.size(Spacing.XXL)) {
|
|
70
|
-
AvatarGroup(urls = AvatarUrls(data.image ?: listOf()), title = data.title)
|
|
71
|
-
if (data.dotColor != null) {
|
|
72
|
-
Box(
|
|
73
|
-
modifier = Modifier
|
|
74
|
-
.align(Alignment.BottomEnd)
|
|
75
|
-
.size(10.dp)
|
|
76
|
-
.clip(CircleShape)
|
|
77
|
-
.background(data.dotColor)
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
Spacer(Modifier.width(6.dp))
|
|
83
|
-
|
|
84
|
-
Column(modifier = Modifier.weight(1f, fill = false)) {
|
|
85
|
-
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
86
|
-
Text(
|
|
87
|
-
text = data.title,
|
|
88
|
-
color = data.tintColor,
|
|
89
|
-
style = Typography.actionXsBold,
|
|
90
|
-
maxLines = 1,
|
|
91
|
-
overflow = TextOverflow.Ellipsis
|
|
92
|
-
)
|
|
93
|
-
if (data.icons.isNotEmpty()) {
|
|
94
|
-
Spacer(Modifier.width(6.dp))
|
|
95
|
-
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
96
|
-
data.icons.forEach { icon ->
|
|
97
|
-
RemoteIcon16(url = icon)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (!data.subTitle.isNullOrEmpty()) {
|
|
104
|
-
Spacer(Modifier.height(2.dp))
|
|
105
|
-
Text(
|
|
106
|
-
text = data.subTitle,
|
|
107
|
-
color = data.tintColor,
|
|
108
|
-
style = Typography.descriptionXsRegular,
|
|
109
|
-
maxLines = 1,
|
|
110
|
-
overflow = TextOverflow.Ellipsis
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
@Composable
|
|
119
|
-
private fun TitleUserShimmer() {
|
|
120
|
-
val theme = AppTheme.current
|
|
121
|
-
Row(
|
|
122
|
-
modifier = Modifier
|
|
123
|
-
.fillMaxWidth()
|
|
124
|
-
.padding(vertical = Spacing.XS),
|
|
125
|
-
verticalAlignment = Alignment.CenterVertically
|
|
126
|
-
) {
|
|
127
|
-
Box(
|
|
128
|
-
modifier = Modifier
|
|
129
|
-
.size(Spacing.XXL)
|
|
130
|
-
.clip(CircleShape)
|
|
131
|
-
.background(theme.colors.border.default)
|
|
132
|
-
) {
|
|
133
|
-
Skeleton()
|
|
134
|
-
}
|
|
135
|
-
Spacer(Modifier.width(Spacing.M / 2))
|
|
136
|
-
Column(modifier = Modifier.fillMaxWidth()) {
|
|
137
|
-
Box(
|
|
138
|
-
modifier = Modifier
|
|
139
|
-
.height(18.dp)
|
|
140
|
-
.width(120.dp)
|
|
141
|
-
.clip(RoundedCornerShape(8.dp))
|
|
142
|
-
) { Skeleton() }
|
|
143
|
-
Spacer(Modifier.height(Spacing.XXS))
|
|
144
|
-
Box(
|
|
145
|
-
modifier = Modifier
|
|
146
|
-
.height(12.dp)
|
|
147
|
-
.width(120.dp)
|
|
148
|
-
.clip(RoundedCornerShape(8.dp))
|
|
149
|
-
) { Skeleton() }
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
@Composable
|
|
155
|
-
private fun AvatarGroup(
|
|
156
|
-
urls: AvatarUrls?,
|
|
157
|
-
title: String? = null,
|
|
158
|
-
size: Dp = Spacing.XXL
|
|
159
|
-
) {
|
|
160
|
-
val theme = AppTheme.current
|
|
161
|
-
val modifierBorder = remember {
|
|
162
|
-
Modifier.clip(CircleShape).border(width = (0.5).dp, color = theme.colors.border.default, shape = CircleShape)
|
|
163
|
-
}
|
|
164
|
-
val options = Options(
|
|
165
|
-
contentScale = ContentScale.Crop,
|
|
166
|
-
alignment = Alignment.Center
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
when (urls?.items?.size) {
|
|
170
|
-
0 -> InitialsAvatar(
|
|
171
|
-
modifier = modifierBorder,
|
|
172
|
-
name = title ?: "",
|
|
173
|
-
fallbackInitials = null,
|
|
174
|
-
size = size
|
|
175
|
-
)
|
|
176
|
-
1 -> SingleAvatar(options = options, modifier = modifierBorder, urls.items[0], size)
|
|
177
|
-
2 -> TwoAvatar(options = options, modifier = modifierBorder, urls, size)
|
|
178
|
-
3 -> ThreeAvatar(options = options, modifier = modifierBorder, urls, size)
|
|
179
|
-
4 -> FourAvatar(options = options, modifier = modifierBorder, urls, size)
|
|
180
|
-
else -> ManyAvatar(options = options, modifier = modifierBorder, urls!!, size)
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
@Composable
|
|
185
|
-
private fun SingleAvatar(options: Options, modifier: Modifier = Modifier, url: String, size: Dp) {
|
|
186
|
-
Image(
|
|
187
|
-
source = url,
|
|
188
|
-
options = options,
|
|
189
|
-
modifier = modifier
|
|
190
|
-
.size(size)
|
|
191
|
-
)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
@Composable
|
|
195
|
-
private fun TwoAvatar(options: Options, modifier: Modifier = Modifier, urls: AvatarUrls, size: Dp) {
|
|
196
|
-
val child = 24.dp
|
|
197
|
-
Box(modifier = Modifier.size(size)) {
|
|
198
|
-
Image(
|
|
199
|
-
source = urls.items[0],
|
|
200
|
-
options = options,
|
|
201
|
-
modifier = modifier
|
|
202
|
-
.size(child)
|
|
203
|
-
.align(Alignment.TopEnd)
|
|
204
|
-
)
|
|
205
|
-
Image(
|
|
206
|
-
source = urls.items[1],
|
|
207
|
-
options = options,
|
|
208
|
-
modifier = modifier
|
|
209
|
-
.size(child)
|
|
210
|
-
.align(Alignment.BottomStart)
|
|
211
|
-
)
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
@Composable
|
|
216
|
-
private fun ThreeAvatar(options: Options, modifier: Modifier = Modifier, urls: AvatarUrls, size: Dp) {
|
|
217
|
-
val child = 16.dp
|
|
218
|
-
Box(modifier = Modifier.size(size).padding(2.dp)) {
|
|
219
|
-
Image(
|
|
220
|
-
source = urls.items[0],
|
|
221
|
-
options = options,
|
|
222
|
-
modifier = modifier
|
|
223
|
-
.size(child)
|
|
224
|
-
.align(Alignment.BottomEnd)
|
|
225
|
-
)
|
|
226
|
-
Image(
|
|
227
|
-
source = urls.items[1],
|
|
228
|
-
options = options,
|
|
229
|
-
modifier = modifier
|
|
230
|
-
.size(child)
|
|
231
|
-
.align(Alignment.TopCenter)
|
|
232
|
-
)
|
|
233
|
-
Image(
|
|
234
|
-
source = urls.items[2],
|
|
235
|
-
options = options,
|
|
236
|
-
modifier = modifier
|
|
237
|
-
.size(child)
|
|
238
|
-
.align(Alignment.BottomStart)
|
|
239
|
-
)
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
@Composable
|
|
244
|
-
private fun FourAvatar(options: Options, modifier: Modifier = Modifier, urls: AvatarUrls, size: Dp) {
|
|
245
|
-
val child = 16.dp
|
|
246
|
-
Box(modifier = Modifier.size(size).padding(1.dp)) {
|
|
247
|
-
Image(
|
|
248
|
-
source = urls.items[0],
|
|
249
|
-
options = options,
|
|
250
|
-
modifier = modifier
|
|
251
|
-
.size(child)
|
|
252
|
-
.align(Alignment.BottomStart)
|
|
253
|
-
)
|
|
254
|
-
Image(
|
|
255
|
-
source = urls.items[1],
|
|
256
|
-
options = options,
|
|
257
|
-
modifier = modifier
|
|
258
|
-
.size(child)
|
|
259
|
-
.align(Alignment.BottomEnd)
|
|
260
|
-
)
|
|
261
|
-
Image(
|
|
262
|
-
source = urls.items[2],
|
|
263
|
-
options = options,
|
|
264
|
-
modifier = modifier
|
|
265
|
-
.size(child)
|
|
266
|
-
.align(Alignment.TopEnd)
|
|
267
|
-
)
|
|
268
|
-
Image(
|
|
269
|
-
source = urls.items[3],
|
|
270
|
-
options = options,
|
|
271
|
-
modifier = modifier
|
|
272
|
-
.size(child)
|
|
273
|
-
.align(Alignment.TopStart)
|
|
274
|
-
)
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
@Composable
|
|
279
|
-
private fun ManyAvatar(options: Options, modifier: Modifier = Modifier, urls: AvatarUrls, size: Dp) {
|
|
280
|
-
val child = 16.dp
|
|
281
|
-
val more = urls.items.size - 3
|
|
282
|
-
Box(modifier = Modifier.size(size).padding(1.dp)) {
|
|
283
|
-
Image(
|
|
284
|
-
source = urls.items[0],
|
|
285
|
-
options = options,
|
|
286
|
-
modifier = modifier
|
|
287
|
-
.size(child)
|
|
288
|
-
.align(Alignment.BottomStart)
|
|
289
|
-
)
|
|
290
|
-
Image(
|
|
291
|
-
source = urls.items[1],
|
|
292
|
-
options = options,
|
|
293
|
-
modifier = modifier
|
|
294
|
-
.size(child)
|
|
295
|
-
.align(Alignment.TopEnd)
|
|
296
|
-
)
|
|
297
|
-
Image(
|
|
298
|
-
source = urls.items[2],
|
|
299
|
-
options = options,
|
|
300
|
-
modifier = modifier
|
|
301
|
-
.size(child)
|
|
302
|
-
.align(Alignment.TopStart)
|
|
303
|
-
)
|
|
304
|
-
Box(
|
|
305
|
-
modifier = modifier
|
|
306
|
-
.size(child)
|
|
307
|
-
.align(Alignment.BottomEnd)
|
|
308
|
-
.background(Colors.pink_09)
|
|
309
|
-
.padding(1.dp)
|
|
310
|
-
.clipToBounds(),
|
|
311
|
-
contentAlignment = Alignment.Center
|
|
312
|
-
) {
|
|
313
|
-
BasicText(
|
|
314
|
-
text = "+$more",
|
|
315
|
-
style = TextStyle(
|
|
316
|
-
color = Colors.pink_03
|
|
317
|
-
),
|
|
318
|
-
maxLines = 1,
|
|
319
|
-
autoSize = TextAutoSize.StepBased(
|
|
320
|
-
minFontSize = 1.sp,
|
|
321
|
-
maxFontSize = 10.sp,
|
|
322
|
-
stepSize = 1.sp
|
|
323
|
-
)
|
|
324
|
-
)
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
@Composable
|
|
330
|
-
private fun InitialsAvatar(
|
|
331
|
-
modifier: Modifier = Modifier,
|
|
332
|
-
name: String,
|
|
333
|
-
fallbackInitials: String? = null,
|
|
334
|
-
size: Dp = Spacing.XXL
|
|
335
|
-
) {
|
|
336
|
-
val initials = remember(name, fallbackInitials) {
|
|
337
|
-
fallbackInitials ?: run {
|
|
338
|
-
val words = name.trim().split(Regex("\\s+")).takeLast(2)
|
|
339
|
-
words.joinToString("") { it.firstOrNull()?.uppercase() ?: "" }
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
Box(
|
|
343
|
-
modifier = modifier
|
|
344
|
-
.size(size)
|
|
345
|
-
.background(Colors.pink_09),
|
|
346
|
-
contentAlignment = Alignment.Center
|
|
347
|
-
) {
|
|
348
|
-
Text(
|
|
349
|
-
text = initials,
|
|
350
|
-
color = Colors.pink_03,
|
|
351
|
-
style = Typography.descriptionXsRegular
|
|
352
|
-
)
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
@Composable
|
|
357
|
-
private fun RemoteIcon16(url: String) {
|
|
358
|
-
Image(
|
|
359
|
-
source = url,
|
|
360
|
-
options = Options(
|
|
361
|
-
contentScale = ContentScale.Crop
|
|
362
|
-
),
|
|
363
|
-
modifier = Modifier
|
|
364
|
-
.size(16.dp)
|
|
365
|
-
.clip(RoundedCornerShape(4.dp)),
|
|
366
|
-
)
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
@Immutable
|
|
370
|
-
data class AvatarUrls(val items: List<String>)
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.navigation.component
|
|
2
|
-
|
|
3
|
-
import androidx.compose.animation.core.Animatable
|
|
4
|
-
import androidx.compose.animation.core.tween
|
|
5
|
-
import androidx.compose.foundation.border
|
|
6
|
-
import androidx.compose.foundation.layout.Box
|
|
7
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
8
|
-
import androidx.compose.foundation.layout.offset
|
|
9
|
-
import androidx.compose.runtime.Composable
|
|
10
|
-
import androidx.compose.runtime.DisposableEffect
|
|
11
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
12
|
-
import androidx.compose.runtime.getValue
|
|
13
|
-
import androidx.compose.runtime.mutableStateOf
|
|
14
|
-
import androidx.compose.runtime.remember
|
|
15
|
-
import androidx.compose.runtime.rememberCoroutineScope
|
|
16
|
-
import androidx.compose.runtime.setValue
|
|
17
|
-
import androidx.compose.ui.Modifier
|
|
18
|
-
import androidx.compose.ui.layout.onGloballyPositioned
|
|
19
|
-
import androidx.compose.ui.platform.LocalDensity
|
|
20
|
-
import androidx.compose.ui.unit.IntOffset
|
|
21
|
-
import androidx.compose.ui.unit.dp
|
|
22
|
-
import androidx.compose.ui.unit.min
|
|
23
|
-
import kotlinx.coroutines.delay
|
|
24
|
-
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
25
|
-
import vn.momo.kits.const.Colors
|
|
26
|
-
import vn.momo.kits.modifier.conditional
|
|
27
|
-
import kotlinx.coroutines.launch
|
|
28
|
-
import vn.momo.kits.const.AppNavigationBar
|
|
29
|
-
import vn.momo.kits.navigation.LocalFooterHeightPx
|
|
30
|
-
import vn.momo.kits.navigation.LocalNavigator
|
|
31
|
-
import vn.momo.kits.navigation.LocalOptions
|
|
32
|
-
import vn.momo.kits.navigation.OverplayComponentRegistry
|
|
33
|
-
|
|
34
|
-
sealed class SnackBar(open val duration: Long? = null) {
|
|
35
|
-
data class Custom(
|
|
36
|
-
val content: @Composable () -> Unit,
|
|
37
|
-
override val duration: Long? = 3000L
|
|
38
|
-
) : SnackBar(duration)
|
|
39
|
-
|
|
40
|
-
data class Toast(
|
|
41
|
-
override val duration: Long? = 3000L
|
|
42
|
-
) : SnackBar(duration)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Composable
|
|
46
|
-
fun SnackBar(
|
|
47
|
-
data: SnackBar,
|
|
48
|
-
onDismiss: (() -> Unit)?
|
|
49
|
-
) {
|
|
50
|
-
val navigator = LocalNavigator.current
|
|
51
|
-
val options = LocalOptions.current
|
|
52
|
-
val density = LocalDensity.current
|
|
53
|
-
val footerHeightPxState = LocalFooterHeightPx.current
|
|
54
|
-
val navigationBar = AppNavigationBar.current
|
|
55
|
-
|
|
56
|
-
val footerHeight = if (options.footerComponent != null) {
|
|
57
|
-
footerHeightPxState.value
|
|
58
|
-
} else {
|
|
59
|
-
with(density){ min(navigationBar, 21.dp).toPx() }
|
|
60
|
-
}.toInt()
|
|
61
|
-
|
|
62
|
-
var startPosition by remember { mutableStateOf(Float.MAX_VALUE) }
|
|
63
|
-
val targetPosition = 0f
|
|
64
|
-
|
|
65
|
-
var offsetY by remember { mutableStateOf(Animatable(startPosition)) }
|
|
66
|
-
val coroutineScope = rememberCoroutineScope()
|
|
67
|
-
|
|
68
|
-
suspend fun openEvent() {
|
|
69
|
-
offsetY.snapTo(startPosition)
|
|
70
|
-
offsetY.animateTo(
|
|
71
|
-
targetValue = targetPosition,
|
|
72
|
-
animationSpec = tween(
|
|
73
|
-
durationMillis = 350,
|
|
74
|
-
)
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
fun closeEvent() {
|
|
79
|
-
coroutineScope.launch {
|
|
80
|
-
offsetY.animateTo(
|
|
81
|
-
targetValue = startPosition,
|
|
82
|
-
animationSpec = tween(
|
|
83
|
-
durationMillis = 200,
|
|
84
|
-
)
|
|
85
|
-
)
|
|
86
|
-
navigator.hideSnackBar()
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
LaunchedEffect(startPosition) {
|
|
91
|
-
if (startPosition != Float.MAX_VALUE){
|
|
92
|
-
openEvent()
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
LaunchedEffect(data.duration) {
|
|
97
|
-
val duration = data.duration
|
|
98
|
-
if (duration != null) {
|
|
99
|
-
delay(duration)
|
|
100
|
-
navigator.hideSnackBar()
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
DisposableEffect(Unit) {
|
|
105
|
-
OverplayComponentRegistry.bindClose {
|
|
106
|
-
closeEvent()
|
|
107
|
-
}
|
|
108
|
-
onDispose {
|
|
109
|
-
onDismiss?.invoke()
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
Box(
|
|
114
|
-
modifier = Modifier
|
|
115
|
-
.offset { IntOffset(0, offsetY.value.toInt() - footerHeight) }
|
|
116
|
-
.onGloballyPositioned {
|
|
117
|
-
if (startPosition != it.size.height.toFloat()) {
|
|
118
|
-
startPosition = it.size.height.toFloat()
|
|
119
|
-
offsetY = Animatable(startPosition)
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
.fillMaxWidth()
|
|
123
|
-
.conditional(IsShowBaseLineDebug) {
|
|
124
|
-
border(1.dp, Colors.blue_03)
|
|
125
|
-
}
|
|
126
|
-
) {
|
|
127
|
-
when (data) {
|
|
128
|
-
is SnackBar.Custom -> data.content()
|
|
129
|
-
is SnackBar.Toast -> {}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.navigation.tracking
|
|
2
|
-
|
|
3
|
-
import vn.momo.kits.application.MiniAppContext
|
|
4
|
-
import vn.momo.maxapi.IMaxApi
|
|
5
|
-
import kotlin.time.Clock
|
|
6
|
-
import kotlin.time.ExperimentalTime
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Screen tracking state holder
|
|
10
|
-
*/
|
|
11
|
-
class ScreenTrackingState {
|
|
12
|
-
@OptIn(ExperimentalTime::class)
|
|
13
|
-
var startTime: Long = Clock.System.now().toEpochMilliseconds()
|
|
14
|
-
var endTime: Long = startTime
|
|
15
|
-
var releaseNavigated: Boolean = false
|
|
16
|
-
var releaseLoad: Boolean = false
|
|
17
|
-
var releaseInteraction: Boolean = false
|
|
18
|
-
var previousScreenName: String? = null
|
|
19
|
-
var action: String = "push"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Screen tracker for auto tracking events
|
|
24
|
-
*
|
|
25
|
-
* Tracks 3 main events:
|
|
26
|
-
* - auto_screen_navigated: When screen is focused
|
|
27
|
-
* - auto_screen_displayed: When screen finished loading
|
|
28
|
-
* - auto_screen_interacted: When screen is ready for interaction
|
|
29
|
-
*/
|
|
30
|
-
object ScreenTracker {
|
|
31
|
-
|
|
32
|
-
private var lastScreenName: String? = null
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Track screen navigation event
|
|
36
|
-
* Called when screen is focused
|
|
37
|
-
*/
|
|
38
|
-
fun trackScreenNavigated(
|
|
39
|
-
maxApi: IMaxApi?,
|
|
40
|
-
context: MiniAppContext?,
|
|
41
|
-
screenName: String,
|
|
42
|
-
action: String,
|
|
43
|
-
state: ScreenTrackingState
|
|
44
|
-
) {
|
|
45
|
-
if (state.releaseNavigated) return
|
|
46
|
-
|
|
47
|
-
val previousScreen = lastScreenName
|
|
48
|
-
lastScreenName = screenName
|
|
49
|
-
|
|
50
|
-
println("Tracking screen navigated native kit: $screenName")
|
|
51
|
-
maxApi?.track(
|
|
52
|
-
eventName = "auto_screen_navigated",
|
|
53
|
-
params = buildBaseParams(context, screenName).apply {
|
|
54
|
-
put("pre_screen_name", previousScreen)
|
|
55
|
-
put("state", "navigated")
|
|
56
|
-
put("action", action)
|
|
57
|
-
}
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
state.releaseNavigated = true
|
|
61
|
-
state.previousScreenName = previousScreen
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Track screen displayed event
|
|
66
|
-
* Called when screen finished loading all elements
|
|
67
|
-
*/
|
|
68
|
-
fun trackScreenDisplayed(
|
|
69
|
-
maxApi: IMaxApi?,
|
|
70
|
-
context: MiniAppContext?,
|
|
71
|
-
screenName: String,
|
|
72
|
-
duration: Long,
|
|
73
|
-
state: ScreenTrackingState
|
|
74
|
-
) {
|
|
75
|
-
if (state.releaseLoad) return
|
|
76
|
-
|
|
77
|
-
maxApi?.track(
|
|
78
|
-
eventName = "auto_screen_displayed",
|
|
79
|
-
params = buildBaseParams(context, screenName).apply {
|
|
80
|
-
put("state", "load")
|
|
81
|
-
put("duration", duration)
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
state.releaseLoad = true
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Track screen interacted event
|
|
90
|
-
* Called when screen is ready for user interaction
|
|
91
|
-
*/
|
|
92
|
-
fun trackScreenInteracted(
|
|
93
|
-
maxApi: IMaxApi?,
|
|
94
|
-
context: MiniAppContext?,
|
|
95
|
-
screenName: String,
|
|
96
|
-
duration: Long,
|
|
97
|
-
totalDuration: Long,
|
|
98
|
-
state: ScreenTrackingState
|
|
99
|
-
) {
|
|
100
|
-
if (state.releaseInteraction) return
|
|
101
|
-
|
|
102
|
-
maxApi?.track(
|
|
103
|
-
eventName = "auto_screen_interacted",
|
|
104
|
-
params = buildBaseParams(context, screenName).apply {
|
|
105
|
-
put("state", "interaction")
|
|
106
|
-
put("duration", duration)
|
|
107
|
-
put("total_duration", totalDuration)
|
|
108
|
-
}
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
state.releaseInteraction = true
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Build base tracking params from MiniAppContext
|
|
116
|
-
*/
|
|
117
|
-
private fun buildBaseParams(
|
|
118
|
-
context: MiniAppContext?,
|
|
119
|
-
screenName: String,
|
|
120
|
-
componentName: String = "Screen"
|
|
121
|
-
): MutableMap<String, Any?> {
|
|
122
|
-
return mutableMapOf(
|
|
123
|
-
"app_id" to context?.appId,
|
|
124
|
-
"feature_code" to context?.appCode,
|
|
125
|
-
"screen_name" to screenName,
|
|
126
|
-
"component_name" to componentName,
|
|
127
|
-
"tracking_source" to 1
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Track popup/modal displayed event
|
|
133
|
-
*
|
|
134
|
-
* @param popupName name of the popup/modal
|
|
135
|
-
* @param parentScreenName the screen that shows the popup
|
|
136
|
-
*/
|
|
137
|
-
fun trackPopupDisplayed(
|
|
138
|
-
maxApi: IMaxApi?,
|
|
139
|
-
context: MiniAppContext?,
|
|
140
|
-
parentScreenName: String?
|
|
141
|
-
) {
|
|
142
|
-
maxApi?.track(
|
|
143
|
-
eventName = "auto_popup_displayed",
|
|
144
|
-
params = mutableMapOf<String, Any?>(
|
|
145
|
-
"screen_name" to parentScreenName,
|
|
146
|
-
"tracking_source" to 1,
|
|
147
|
-
"app_id" to context?.appId,
|
|
148
|
-
"feature_code" to context?.appCode,
|
|
149
|
-
"kits_version" to null,
|
|
150
|
-
"component_name" to "Modal"
|
|
151
|
-
)
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Get previous screen name for back navigation detection
|
|
157
|
-
*/
|
|
158
|
-
fun getLastScreenName(): String? = lastScreenName
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Reset tracker (for testing or cleanup)
|
|
162
|
-
*/
|
|
163
|
-
@Suppress("UNUSED")
|
|
164
|
-
fun reset() {
|
|
165
|
-
lastScreenName = null
|
|
166
|
-
}
|
|
167
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.platform
|
|
2
|
-
|
|
3
|
-
import androidx.compose.runtime.Composable
|
|
4
|
-
import androidx.compose.ui.Modifier
|
|
5
|
-
import androidx.compose.ui.graphics.Color
|
|
6
|
-
import androidx.compose.ui.graphics.NativePaint
|
|
7
|
-
import androidx.compose.ui.unit.Dp
|
|
8
|
-
|
|
9
|
-
data class ScreenDimension(
|
|
10
|
-
val width: Int,
|
|
11
|
-
val height: Int,
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
expect fun getPlatformName(): String
|
|
15
|
-
|
|
16
|
-
@Composable
|
|
17
|
-
expect fun getScreenDimensions(): ScreenDimension
|
|
18
|
-
|
|
19
|
-
expect fun NativePaint.setMaskFilter(blurRadius: Float)
|
|
20
|
-
|
|
21
|
-
@Composable
|
|
22
|
-
expect fun getStatusBarHeight(): Dp
|
|
23
|
-
|
|
24
|
-
@Composable
|
|
25
|
-
expect fun BackHandler(enabled: Boolean, onBack: () -> Unit)
|
|
26
|
-
|
|
27
|
-
@Composable
|
|
28
|
-
expect fun getScreenHeight(): Dp
|
|
29
|
-
|
|
30
|
-
expect fun getAndroidBuildVersion(): Int
|
|
31
|
-
|
|
32
|
-
@Composable
|
|
33
|
-
expect fun LottieAnimation(
|
|
34
|
-
path: String,
|
|
35
|
-
tintColor: Color? = null,
|
|
36
|
-
bgColor: Color? = null,
|
|
37
|
-
modifier: Modifier = Modifier
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
expect fun NativePaint.setColor(
|
|
41
|
-
color: Color = Color.Black
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
expect fun Modifier.semantics(
|
|
45
|
-
accessibilityId: String
|
|
46
|
-
) : Modifier
|