@momo-kits/native-kits 0.162.3-debug → 0.162.3-fontscale.1-debug
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/.codegraph/.gitignore +5 -0
- package/CLAUDE.md +78 -0
- package/compose/build.gradle.kts +12 -8
- package/compose/build.gradle.kts.backup +11 -7
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +2 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +6 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +4 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +6 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +6 -101
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +5 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +8 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +1 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +27 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +3 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +27 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +3 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +3 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +69 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +84 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +13 -71
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +10 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +6 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +16 -75
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +5 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +16 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -28
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +2 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +4 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -28
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +8 -47
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +4 -25
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +2 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +1 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +1 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +50 -111
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +4 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +5 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +2 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +9 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +9 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +8 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +3 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +94 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +3 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +5 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +42 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +58 -57
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +28 -25
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +13 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +6 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +11 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +9 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +3 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +1 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +2 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +2 -3
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -2
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -0
- package/gradle/libs.versions.toml +2 -0
- package/gradle.properties +1 -1
- package/ios/Application/Components.swift +1 -0
- package/ios/Application/FloatingButton.swift +1 -0
- package/ios/Badge/Badge.swift +1 -0
- package/ios/Badge/BadgeRibbon.swift +2 -0
- package/ios/Button/Button.swift +1 -1
- package/ios/Checkbox/Checkbox.swift +1 -0
- package/ios/Information/Information.swift +151 -0
- package/ios/Input/Input.swift +1 -0
- package/ios/Input/InputPhoneNumber.swift +1 -0
- package/ios/Input/InputSearch.swift +3 -0
- package/ios/Input/InputTextArea.swift +1 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +6 -0
- package/ios/Popup/PopupInput.swift +2 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +2 -0
- package/ios/Typography/Text.swift +1 -0
- package/ios/Typography/Typography.swift +14 -5
- package/local.properties +8 -0
- package/package.json +1 -1
|
@@ -1,40 +1,21 @@
|
|
|
1
1
|
package vn.momo.kits.navigation.component
|
|
2
2
|
|
|
3
|
-
import androidx.compose.animation
|
|
3
|
+
import androidx.compose.animation.*
|
|
4
4
|
import androidx.compose.animation.core.CubicBezierEasing
|
|
5
5
|
import androidx.compose.animation.core.LinearEasing
|
|
6
6
|
import androidx.compose.animation.core.animateDpAsState
|
|
7
7
|
import androidx.compose.animation.core.tween
|
|
8
|
-
import androidx.compose.animation.expandHorizontally
|
|
9
|
-
import androidx.compose.animation.fadeIn
|
|
10
|
-
import androidx.compose.animation.fadeOut
|
|
11
|
-
import androidx.compose.animation.shrinkHorizontally
|
|
12
8
|
import androidx.compose.foundation.ScrollState
|
|
13
9
|
import androidx.compose.foundation.background
|
|
14
10
|
import androidx.compose.foundation.border
|
|
15
11
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
16
|
-
import androidx.compose.foundation.layout
|
|
17
|
-
import androidx.compose.foundation.layout.Box
|
|
18
|
-
import androidx.compose.foundation.layout.Row
|
|
19
|
-
import androidx.compose.foundation.layout.Spacer
|
|
20
|
-
import androidx.compose.foundation.layout.fillMaxSize
|
|
21
|
-
import androidx.compose.foundation.layout.height
|
|
22
|
-
import androidx.compose.foundation.layout.offset
|
|
23
|
-
import androidx.compose.foundation.layout.padding
|
|
24
|
-
import androidx.compose.foundation.layout.sizeIn
|
|
25
|
-
import androidx.compose.foundation.layout.width
|
|
12
|
+
import androidx.compose.foundation.layout.*
|
|
26
13
|
import androidx.compose.material3.AlertDialogDefaults
|
|
27
14
|
import androidx.compose.material3.FloatingActionButton
|
|
28
15
|
import androidx.compose.material3.FloatingActionButtonDefaults
|
|
29
16
|
import androidx.compose.material3.FloatingActionButtonElevation
|
|
30
|
-
import androidx.compose.runtime
|
|
31
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
32
|
-
import androidx.compose.runtime.getValue
|
|
33
|
-
import androidx.compose.runtime.mutableStateOf
|
|
34
|
-
import androidx.compose.runtime.remember
|
|
35
|
-
import androidx.compose.runtime.rememberCoroutineScope
|
|
17
|
+
import androidx.compose.runtime.*
|
|
36
18
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
37
|
-
import androidx.compose.runtime.setValue
|
|
38
19
|
import androidx.compose.ui.Alignment
|
|
39
20
|
import androidx.compose.ui.Modifier
|
|
40
21
|
import androidx.compose.ui.graphics.Color
|
|
@@ -50,6 +31,7 @@ import vn.momo.kits.components.Text
|
|
|
50
31
|
import vn.momo.kits.const.Colors
|
|
51
32
|
import vn.momo.kits.const.Typography
|
|
52
33
|
import vn.momo.kits.modifier.conditional
|
|
34
|
+
import kotlin.time.Duration.Companion.milliseconds
|
|
53
35
|
|
|
54
36
|
enum class FABSize { SMALL, DEFAULT }
|
|
55
37
|
enum class FABPosition { END, CENTER }
|
|
@@ -73,7 +55,7 @@ private val FabIconSizeDefault = 24.dp
|
|
|
73
55
|
private val FabPaddingHorizontal = 12.dp
|
|
74
56
|
|
|
75
57
|
@Composable
|
|
76
|
-
fun FloatingButton(
|
|
58
|
+
internal fun FloatingButton(
|
|
77
59
|
scrollPosition: Int,
|
|
78
60
|
bottom: Dp,
|
|
79
61
|
onClick: () -> Unit,
|
|
@@ -106,7 +88,7 @@ fun FloatingButton(
|
|
|
106
88
|
coroutineScope.launch {
|
|
107
89
|
scrollStateFlow.collectLatest { newScroll ->
|
|
108
90
|
isExpanded = newScroll <= lastScrollPosition
|
|
109
|
-
delay(100)
|
|
91
|
+
delay(100.milliseconds)
|
|
110
92
|
lastScrollPosition = newScroll
|
|
111
93
|
}
|
|
112
94
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package vn.momo.kits.navigation.component
|
|
2
2
|
|
|
3
|
+
import vn.momo.kits.modifier.InternalApi
|
|
4
|
+
|
|
3
5
|
import androidx.compose.animation.core.animateFloatAsState
|
|
4
6
|
import androidx.compose.foundation.background
|
|
5
7
|
import androidx.compose.foundation.border
|
|
@@ -42,12 +44,14 @@ import vn.momo.kits.navigation.LocalOptions
|
|
|
42
44
|
import vn.momo.kits.navigation.LocalScrollState
|
|
43
45
|
import vn.momo.kits.navigation.getInputSearchType
|
|
44
46
|
|
|
47
|
+
@InternalApi
|
|
45
48
|
const val HEADER_HEIGHT = 52
|
|
46
|
-
enum class InputSearchType { None, Header, Animated }
|
|
49
|
+
internal enum class InputSearchType { None, Header, Animated }
|
|
47
50
|
enum class TitlePosition { LEFT, CENTER }
|
|
48
51
|
|
|
52
|
+
@Suppress("FrequentlyChangingValue")
|
|
49
53
|
@Composable
|
|
50
|
-
fun Header(onBackHandler: (() -> Unit)? = null) {
|
|
54
|
+
internal fun Header(onBackHandler: (() -> Unit)? = null) {
|
|
51
55
|
val options = LocalOptions.current
|
|
52
56
|
val navigator = LocalNavigator.current
|
|
53
57
|
val scrollState = LocalScrollState.current
|
|
@@ -106,7 +110,7 @@ fun Header(onBackHandler: (() -> Unit)? = null) {
|
|
|
106
110
|
backgroundButton = headerColor.backgroundButton,
|
|
107
111
|
tintIconColor = headerColor.tintIconColor,
|
|
108
112
|
onBackHandler = {
|
|
109
|
-
|
|
113
|
+
navigator.onBackSafe { }
|
|
110
114
|
}
|
|
111
115
|
)
|
|
112
116
|
Spacer(Modifier.width(Spacing.S))
|
|
@@ -168,7 +172,7 @@ private fun BackButton(borderColor: Color, backgroundButton: Color, tintIconColo
|
|
|
168
172
|
}
|
|
169
173
|
|
|
170
174
|
@Composable
|
|
171
|
-
fun HeaderContent(
|
|
175
|
+
internal fun HeaderContent(
|
|
172
176
|
headerTitle: HeaderTitle,
|
|
173
177
|
tintIconColor: Color,
|
|
174
178
|
titlePosition: TitlePosition = TitlePosition.LEFT,
|
|
@@ -199,7 +203,7 @@ fun HeaderContent(
|
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
@Composable
|
|
202
|
-
fun VerticalShadow(opacity: Float){
|
|
206
|
+
internal fun VerticalShadow(opacity: Float){
|
|
203
207
|
if(opacity == 1f){
|
|
204
208
|
Box(modifier = Modifier
|
|
205
209
|
.fillMaxWidth()
|
|
@@ -282,8 +286,9 @@ data class HeaderBackProps(
|
|
|
282
286
|
val preventBack: PopupNotifyProps? = null,
|
|
283
287
|
)
|
|
284
288
|
|
|
289
|
+
@InternalApi
|
|
285
290
|
data class HeaderColor(val tintIconColor: Color, val backgroundButton: Color, val borderColor: Color)
|
|
286
|
-
fun getHeaderColor(headerType: HeaderType, opacity: Float, tintColor: Color?, defaultColor: Color): HeaderColor{
|
|
291
|
+
internal fun getHeaderColor(headerType: HeaderType, opacity: Float, tintColor: Color?, defaultColor: Color): HeaderColor{
|
|
287
292
|
return if(headerType is HeaderType.Animated) {
|
|
288
293
|
if (opacity == 1f || !headerType.isSurface)
|
|
289
294
|
HeaderColor(
|
|
@@ -27,8 +27,9 @@ enum class AnimatedHeaderRatio(val value: Float){
|
|
|
27
27
|
RATIO_3_2(3f / 2f)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
@Suppress("FrequentlyChangingValue")
|
|
30
31
|
@Composable
|
|
31
|
-
fun HeaderBackground() {
|
|
32
|
+
internal fun HeaderBackground() {
|
|
32
33
|
val density = LocalDensity.current
|
|
33
34
|
val theme = AppTheme.current
|
|
34
35
|
val options = LocalOptions.current
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package vn.momo.kits.navigation.component
|
|
2
2
|
|
|
3
|
+
import vn.momo.kits.modifier.InternalApi
|
|
4
|
+
|
|
3
5
|
import androidx.compose.foundation.background
|
|
4
6
|
import androidx.compose.foundation.border
|
|
5
7
|
import androidx.compose.foundation.layout.Arrangement
|
|
@@ -24,7 +26,7 @@ import androidx.compose.ui.Modifier
|
|
|
24
26
|
import androidx.compose.ui.draw.clip
|
|
25
27
|
import androidx.compose.ui.graphics.Color
|
|
26
28
|
import androidx.compose.ui.unit.dp
|
|
27
|
-
import vn.momo.kits.application.
|
|
29
|
+
import vn.momo.kits.application.LocalContext
|
|
28
30
|
import vn.momo.kits.application.MiniAppContext
|
|
29
31
|
import vn.momo.kits.components.BadgeDot
|
|
30
32
|
import vn.momo.kits.components.DotSize
|
|
@@ -35,6 +37,7 @@ import vn.momo.kits.modifier.activeOpacityClickable
|
|
|
35
37
|
import vn.momo.kits.navigation.LocalMaxApi
|
|
36
38
|
|
|
37
39
|
@Composable
|
|
40
|
+
@InternalApi
|
|
38
41
|
fun HeaderRight(
|
|
39
42
|
headerRight: HeaderRight,
|
|
40
43
|
tintColor: Color? = null,
|
|
@@ -57,13 +60,13 @@ fun HeaderRight(
|
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
@Composable
|
|
60
|
-
fun Toolkit(
|
|
63
|
+
internal fun Toolkit(
|
|
61
64
|
headerRight: HeaderRight.Toolkit,
|
|
62
65
|
tintColor: Color? = null,
|
|
63
66
|
headerColor: HeaderColor
|
|
64
67
|
) {
|
|
65
68
|
val api = LocalMaxApi.current
|
|
66
|
-
val context =
|
|
69
|
+
val context = LocalContext.current
|
|
67
70
|
|
|
68
71
|
var isFavorite by remember { mutableStateOf(false) }
|
|
69
72
|
val isLoading by remember { mutableStateOf(false) }
|
|
@@ -186,7 +189,7 @@ fun Toolkit(
|
|
|
186
189
|
|
|
187
190
|
|
|
188
191
|
@Composable
|
|
189
|
-
fun NavigationButton(
|
|
192
|
+
internal fun NavigationButton(
|
|
190
193
|
disabled: Boolean,
|
|
191
194
|
icon: String,
|
|
192
195
|
showBadge: Boolean? = false,
|
|
@@ -300,7 +303,7 @@ data class Tool(
|
|
|
300
303
|
}
|
|
301
304
|
}
|
|
302
305
|
|
|
303
|
-
data class NavigationButtonConfig(
|
|
306
|
+
private data class NavigationButtonConfig(
|
|
304
307
|
val icon: String,
|
|
305
308
|
val onPress: () -> Unit
|
|
306
|
-
)
|
|
309
|
+
)
|
|
@@ -2,17 +2,7 @@ package vn.momo.kits.navigation.component
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
|
-
import androidx.compose.foundation.layout
|
|
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
|
|
5
|
+
import androidx.compose.foundation.layout.*
|
|
16
6
|
import androidx.compose.foundation.shape.CircleShape
|
|
17
7
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
18
8
|
import androidx.compose.foundation.text.BasicText
|
|
@@ -43,7 +33,7 @@ import vn.momo.kits.navigation.component.HeaderTitle.User
|
|
|
43
33
|
import vn.momo.kits.platform.getScreenDimensions
|
|
44
34
|
|
|
45
35
|
@Composable
|
|
46
|
-
fun HeaderUser(
|
|
36
|
+
internal fun HeaderUser(
|
|
47
37
|
data: HeaderTitle
|
|
48
38
|
) {
|
|
49
39
|
if (data !is User) return
|
|
@@ -367,4 +357,4 @@ private fun RemoteIcon16(url: String) {
|
|
|
367
357
|
}
|
|
368
358
|
|
|
369
359
|
@Immutable
|
|
370
|
-
data class AvatarUrls(val items: List<String>)
|
|
360
|
+
private data class AvatarUrls(val items: List<String>)
|
|
@@ -29,6 +29,7 @@ import vn.momo.kits.navigation.LocalFooterHeightPx
|
|
|
29
29
|
import vn.momo.kits.navigation.LocalNavigator
|
|
30
30
|
import vn.momo.kits.navigation.LocalOptions
|
|
31
31
|
import vn.momo.kits.navigation.OverplayComponentRegistry
|
|
32
|
+
import kotlin.time.Duration.Companion.milliseconds
|
|
32
33
|
|
|
33
34
|
sealed class SnackBar(open val duration: Long? = null) {
|
|
34
35
|
data class Custom(
|
|
@@ -42,7 +43,7 @@ sealed class SnackBar(open val duration: Long? = null) {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
@Composable
|
|
45
|
-
fun SnackBar(
|
|
46
|
+
internal fun SnackBar(
|
|
46
47
|
data: SnackBar,
|
|
47
48
|
onDismiss: (() -> Unit)?
|
|
48
49
|
) {
|
|
@@ -95,7 +96,7 @@ fun SnackBar(
|
|
|
95
96
|
LaunchedEffect(data.duration) {
|
|
96
97
|
val duration = data.duration
|
|
97
98
|
if (duration != null) {
|
|
98
|
-
delay(duration)
|
|
99
|
+
delay(duration.milliseconds)
|
|
99
100
|
navigator.hideSnackBar()
|
|
100
101
|
}
|
|
101
102
|
}
|
|
@@ -5,13 +5,9 @@ import vn.momo.maxapi.IMaxApi
|
|
|
5
5
|
import kotlin.time.Clock
|
|
6
6
|
import kotlin.time.ExperimentalTime
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Screen tracking state holder
|
|
10
|
-
*/
|
|
11
8
|
class ScreenTrackingState {
|
|
12
9
|
@OptIn(ExperimentalTime::class)
|
|
13
|
-
var
|
|
14
|
-
var endTime: Long = startTime
|
|
10
|
+
var time: Long = Clock.System.now().toEpochMilliseconds()
|
|
15
11
|
var releaseNavigated: Boolean = false
|
|
16
12
|
var releaseLoad: Boolean = false
|
|
17
13
|
var releaseInteraction: Boolean = false
|
|
@@ -19,22 +15,10 @@ class ScreenTrackingState {
|
|
|
19
15
|
var action: String = "push"
|
|
20
16
|
}
|
|
21
17
|
|
|
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
18
|
object ScreenTracker {
|
|
31
19
|
|
|
32
20
|
private var lastScreenName: String? = null
|
|
33
21
|
|
|
34
|
-
/**
|
|
35
|
-
* Track screen navigation event
|
|
36
|
-
* Called when screen is focused
|
|
37
|
-
*/
|
|
38
22
|
fun trackScreenNavigated(
|
|
39
23
|
maxApi: IMaxApi?,
|
|
40
24
|
context: MiniAppContext?,
|
|
@@ -61,10 +45,6 @@ object ScreenTracker {
|
|
|
61
45
|
state.previousScreenName = previousScreen
|
|
62
46
|
}
|
|
63
47
|
|
|
64
|
-
/**
|
|
65
|
-
* Track screen displayed event
|
|
66
|
-
* Called when screen finished loading all elements
|
|
67
|
-
*/
|
|
68
48
|
fun trackScreenDisplayed(
|
|
69
49
|
maxApi: IMaxApi?,
|
|
70
50
|
context: MiniAppContext?,
|
|
@@ -85,10 +65,6 @@ object ScreenTracker {
|
|
|
85
65
|
state.releaseLoad = true
|
|
86
66
|
}
|
|
87
67
|
|
|
88
|
-
/**
|
|
89
|
-
* Track screen interacted event
|
|
90
|
-
* Called when screen is ready for user interaction
|
|
91
|
-
*/
|
|
92
68
|
fun trackScreenInteracted(
|
|
93
69
|
maxApi: IMaxApi?,
|
|
94
70
|
context: MiniAppContext?,
|
|
@@ -111,9 +87,6 @@ object ScreenTracker {
|
|
|
111
87
|
state.releaseInteraction = true
|
|
112
88
|
}
|
|
113
89
|
|
|
114
|
-
/**
|
|
115
|
-
* Build base tracking params from MiniAppContext
|
|
116
|
-
*/
|
|
117
90
|
private fun buildBaseParams(
|
|
118
91
|
context: MiniAppContext?,
|
|
119
92
|
screenName: String,
|
|
@@ -128,12 +101,6 @@ object ScreenTracker {
|
|
|
128
101
|
)
|
|
129
102
|
}
|
|
130
103
|
|
|
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
104
|
fun trackPopupDisplayed(
|
|
138
105
|
maxApi: IMaxApi?,
|
|
139
106
|
context: MiniAppContext?,
|
|
@@ -152,14 +119,8 @@ object ScreenTracker {
|
|
|
152
119
|
)
|
|
153
120
|
}
|
|
154
121
|
|
|
155
|
-
/**
|
|
156
|
-
* Get previous screen name for back navigation detection
|
|
157
|
-
*/
|
|
158
122
|
fun getLastScreenName(): String? = lastScreenName
|
|
159
123
|
|
|
160
|
-
/**
|
|
161
|
-
* Reset tracker (for testing or cleanup)
|
|
162
|
-
*/
|
|
163
124
|
@Suppress("UNUSED")
|
|
164
125
|
fun reset() {
|
|
165
126
|
lastScreenName = null
|
|
@@ -36,8 +36,6 @@ internal fun ComposeLottieAnimation(
|
|
|
36
36
|
LottieCompositionSpec.JsonString(json)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// Recolor only the fill/stroke color slots (matching the native lottie-ios per-keypath tint)
|
|
40
|
-
// instead of a global ColorFilter.tint, which would flatten a multicolor animation to a silhouette.
|
|
41
39
|
val dynamicProperties = if (tintColor != null) {
|
|
42
40
|
rememberLottieDynamicProperties(tintColor) {
|
|
43
41
|
shapeLayer("**") {
|
|
@@ -43,14 +43,6 @@ fun supportsImePadding(): Boolean = when (val v = getOSVersion()) {
|
|
|
43
43
|
is OSVersion.Android -> v.sdk > 29
|
|
44
44
|
is OSVersion.IOS -> true
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @param useCompose when `true`, renders via the pure-Compose Compottie engine instead of the
|
|
49
|
-
* platform-native engine (airbnb-lottie on Android, lottie-ios on iOS). Defaults to `false` for
|
|
50
|
-
* backward compatibility. Note: when `useCompose = true`, `tintColor` recolors only the fill/stroke
|
|
51
|
-
* color slots (matching the native lottie-ios per-keypath tint), so gradient and text-layer colors
|
|
52
|
-
* are left untinted; `placedAsOverlay` is a no-op.
|
|
53
|
-
*/
|
|
54
46
|
@Composable
|
|
55
47
|
expect fun LottieAnimation(
|
|
56
48
|
path: String,
|
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
package vn.momo.kits.utils
|
|
2
2
|
|
|
3
|
-
import androidx.compose.runtime
|
|
4
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
5
|
-
import androidx.compose.runtime.MutableState
|
|
6
|
-
import androidx.compose.runtime.getValue
|
|
7
|
-
import androidx.compose.runtime.mutableStateOf
|
|
8
|
-
import androidx.compose.runtime.remember
|
|
3
|
+
import androidx.compose.runtime.*
|
|
9
4
|
import org.jetbrains.compose.resources.DrawableResource
|
|
10
5
|
import org.jetbrains.compose.resources.InternalResourceApi
|
|
11
6
|
import org.jetbrains.compose.resources.ResourceItem
|
|
12
7
|
import org.jetbrains.compose.resources.readResourceBytes
|
|
13
|
-
|
|
14
|
-
@OptIn(InternalResourceApi::class)
|
|
15
|
-
@Composable
|
|
16
|
-
fun getResource(name: String): DrawableResource {
|
|
17
|
-
return DrawableResource(
|
|
18
|
-
"drawable:$name",
|
|
19
|
-
setOf(ResourceItem(setOf(), "drawable/$name", -1, -1))
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
8
|
@OptIn(InternalResourceApi::class)
|
|
24
9
|
@Composable
|
|
25
|
-
fun readJson(name: String): String {
|
|
10
|
+
internal fun readJson(name: String): String {
|
|
26
11
|
val path = name.plus(".json")
|
|
27
12
|
val candidatePaths = listOf(
|
|
28
13
|
path,
|
|
@@ -41,8 +41,8 @@ internal fun Modifier.bottomBorder(strokeWidth: Dp, color: Color) = composed(
|
|
|
41
41
|
}
|
|
42
42
|
)
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
fun <T> Boolean.ifTrue(trueCase: T, falseCase: T): T = if (this) trueCase else falseCase
|
|
45
|
+
fun <T> String.ifNotNull(trueCase: T, falseCase: T): T =
|
|
46
46
|
if (this.isBlank()) falseCase else trueCase
|
|
47
47
|
|
|
48
48
|
fun formatNumberToMoney(number: Long, currency: String = "đ"): String {
|
|
@@ -91,7 +91,7 @@ fun getAppStatusBarHeight(): Dp {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
@Composable
|
|
94
|
-
fun getNavigationBarHeight(): Dp {
|
|
94
|
+
internal fun getNavigationBarHeight(): Dp {
|
|
95
95
|
return if (AppNavigationBar.current == 0.dp) {
|
|
96
96
|
val systemBottomPadding = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
97
97
|
if (getPlatformName() == "iOS") {
|
|
@@ -13,14 +13,13 @@ private const val STATUS_BAR_TAPPED_NOTIFICATION = "statusBarSelected"
|
|
|
13
13
|
internal actual fun RegisterScrollToTop(callback: (() -> Unit)?) {
|
|
14
14
|
val maxApi = LocalMaxApi.current
|
|
15
15
|
DisposableEffect(callback) {
|
|
16
|
-
val
|
|
17
|
-
val token: NSObjectProtocol? = if (cb != null) {
|
|
16
|
+
val token: NSObjectProtocol? = if (callback != null) {
|
|
18
17
|
NSNotificationCenter.defaultCenter.addObserverForName(
|
|
19
18
|
name = STATUS_BAR_TAPPED_NOTIFICATION,
|
|
20
19
|
`object` = null,
|
|
21
20
|
queue = NSOperationQueue.mainQueue,
|
|
22
21
|
) { _: NSNotification? ->
|
|
23
|
-
runCatching {
|
|
22
|
+
runCatching { callback() }.onFailure {
|
|
24
23
|
maxApi?.logFile("[ScrollToTop] callback threw: ${it.message}") {}
|
|
25
24
|
|
|
26
25
|
}
|
|
@@ -19,8 +19,6 @@ import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
|
|
|
19
19
|
import androidx.compose.ui.graphics.Color
|
|
20
20
|
import androidx.compose.ui.graphics.NativePaint
|
|
21
21
|
import androidx.compose.ui.graphics.toArgb
|
|
22
|
-
import androidx.compose.ui.semantics.SemanticsPropertyKey
|
|
23
|
-
import androidx.compose.ui.semantics.semantics
|
|
24
22
|
import androidx.compose.ui.unit.Dp
|
|
25
23
|
import androidx.compose.ui.unit.dp
|
|
26
24
|
import androidx.compose.ui.viewinterop.UIKitInteropProperties
|
package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Scheme
|
|
3
|
+
version = "1.3">
|
|
4
|
+
<BuildAction>
|
|
5
|
+
<BuildActionEntries>
|
|
6
|
+
<BuildActionEntry
|
|
7
|
+
buildForRunning = "YES">
|
|
8
|
+
<BuildableReference
|
|
9
|
+
BuildableIdentifier = "primary"
|
|
10
|
+
BlueprintIdentifier = "A6A920D22B2ADD1E00C1A11F"
|
|
11
|
+
BuildableName = "Example"
|
|
12
|
+
BlueprintName = "Example"
|
|
13
|
+
ReferencedContainer = "container:Example.xcodeproj">
|
|
14
|
+
</BuildableReference>
|
|
15
|
+
</BuildActionEntry>
|
|
16
|
+
</BuildActionEntries>
|
|
17
|
+
</BuildAction>
|
|
18
|
+
<LaunchAction
|
|
19
|
+
useCustomWorkingDirectory = "NO"
|
|
20
|
+
buildConfiguration = "Debug"
|
|
21
|
+
allowLocationSimulation = "YES">
|
|
22
|
+
<BuildableProductRunnable>
|
|
23
|
+
<BuildableReference
|
|
24
|
+
BuildableIdentifier = "primary"
|
|
25
|
+
BlueprintIdentifier = "A6A920D22B2ADD1E00C1A11F"
|
|
26
|
+
BuildableName = "Example"
|
|
27
|
+
BlueprintName = "Example"
|
|
28
|
+
ReferencedContainer = "container:Example.xcodeproj">
|
|
29
|
+
</BuildableReference>
|
|
30
|
+
</BuildableProductRunnable>
|
|
31
|
+
</LaunchAction>
|
|
32
|
+
</Scheme>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Example.xcscheme</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>7</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>BuildLocationStyle</key>
|
|
6
|
+
<string>UseAppPreferences</string>
|
|
7
|
+
<key>CustomBuildLocationType</key>
|
|
8
|
+
<string>RelativeToDerivedData</string>
|
|
9
|
+
<key>DerivedDataCustomLocation</key>
|
|
10
|
+
<string>DerivedData</string>
|
|
11
|
+
<key>DerivedDataLocationStyle</key>
|
|
12
|
+
<string>WorkspaceRelativePath</string>
|
|
13
|
+
<key>ShowSharedSchemesAutomaticallyEnabled</key>
|
|
14
|
+
<true/>
|
|
15
|
+
</dict>
|
|
16
|
+
</plist>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Scheme
|
|
3
|
+
LastUpgradeVersion = "1600"
|
|
4
|
+
version = "1.3">
|
|
5
|
+
<BuildAction
|
|
6
|
+
parallelizeBuildables = "YES"
|
|
7
|
+
buildImplicitDependencies = "YES">
|
|
8
|
+
<BuildActionEntries>
|
|
9
|
+
<BuildActionEntry
|
|
10
|
+
buildForTesting = "YES"
|
|
11
|
+
buildForRunning = "YES"
|
|
12
|
+
buildForProfiling = "YES"
|
|
13
|
+
buildForArchiving = "YES"
|
|
14
|
+
buildForAnalyzing = "YES">
|
|
15
|
+
<BuildableReference
|
|
16
|
+
BuildableIdentifier = "primary"
|
|
17
|
+
BlueprintIdentifier = "3B6FB503A75BF5BC1FA6F30BC06B9D28"
|
|
18
|
+
BuildableName = "MoMoUIKits.framework"
|
|
19
|
+
BlueprintName = "MoMoUIKits"
|
|
20
|
+
ReferencedContainer = "container:Pods.xcodeproj">
|
|
21
|
+
</BuildableReference>
|
|
22
|
+
</BuildActionEntry>
|
|
23
|
+
</BuildActionEntries>
|
|
24
|
+
</BuildAction>
|
|
25
|
+
<TestAction
|
|
26
|
+
buildConfiguration = "Debug"
|
|
27
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
28
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
29
|
+
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
30
|
+
<Testables>
|
|
31
|
+
</Testables>
|
|
32
|
+
</TestAction>
|
|
33
|
+
<LaunchAction
|
|
34
|
+
buildConfiguration = "Debug"
|
|
35
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
36
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
37
|
+
launchStyle = "0"
|
|
38
|
+
useCustomWorkingDirectory = "NO"
|
|
39
|
+
ignoresPersistentStateOnLaunch = "NO"
|
|
40
|
+
debugDocumentVersioning = "YES"
|
|
41
|
+
debugServiceExtension = "internal"
|
|
42
|
+
allowLocationSimulation = "YES">
|
|
43
|
+
</LaunchAction>
|
|
44
|
+
<ProfileAction
|
|
45
|
+
buildConfiguration = "Release"
|
|
46
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
47
|
+
savedToolIdentifier = ""
|
|
48
|
+
useCustomWorkingDirectory = "NO"
|
|
49
|
+
debugDocumentVersioning = "YES">
|
|
50
|
+
</ProfileAction>
|
|
51
|
+
<AnalyzeAction
|
|
52
|
+
buildConfiguration = "Debug">
|
|
53
|
+
</AnalyzeAction>
|
|
54
|
+
<ArchiveAction
|
|
55
|
+
buildConfiguration = "Release"
|
|
56
|
+
revealArchiveInOrganizer = "YES">
|
|
57
|
+
</ArchiveAction>
|
|
58
|
+
</Scheme>
|