@momo-kits/native-kits 0.151.2-test.1 → 0.151.2-test.2
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/FloatingButton.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +2 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -0
- 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 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +4 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +23 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +4 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +132 -119
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +21 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +21 -20
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +5 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +4 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +14 -0
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -385
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Localize.kt +0 -35
|
@@ -67,6 +67,7 @@ data class FabProps(
|
|
|
67
67
|
val position: FABPosition? = FABPosition.END,
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
+
@Deprecated("Use vn.momo.kits.navigation.FloatingButton instead", ReplaceWith("vn.momo.kits.navigation.FloatingButton"))
|
|
70
71
|
@Composable
|
|
71
72
|
fun FloatingButton(
|
|
72
73
|
scrollPosition: Int,
|
|
@@ -9,13 +9,10 @@ import androidx.compose.foundation.layout.Box
|
|
|
9
9
|
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
10
10
|
import androidx.compose.foundation.layout.Row
|
|
11
11
|
import androidx.compose.foundation.layout.Spacer
|
|
12
|
-
import androidx.compose.foundation.layout.WindowInsets
|
|
13
|
-
import androidx.compose.foundation.layout.asPaddingValues
|
|
14
12
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
15
13
|
import androidx.compose.foundation.layout.height
|
|
16
14
|
import androidx.compose.foundation.layout.padding
|
|
17
15
|
import androidx.compose.foundation.layout.size
|
|
18
|
-
import androidx.compose.foundation.layout.systemBars
|
|
19
16
|
import androidx.compose.foundation.layout.width
|
|
20
17
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
21
18
|
import androidx.compose.runtime.Composable
|
|
@@ -38,13 +35,12 @@ import kotlinx.coroutines.flow.map
|
|
|
38
35
|
import vn.momo.kits.components.Icon
|
|
39
36
|
import vn.momo.kits.components.InputSearch
|
|
40
37
|
import vn.momo.kits.components.InputSearchProps
|
|
41
|
-
import vn.momo.kits.const.AppStatusBar
|
|
42
38
|
import vn.momo.kits.const.AppTheme
|
|
43
39
|
import vn.momo.kits.const.Colors
|
|
44
40
|
import vn.momo.kits.const.Spacing
|
|
45
41
|
import vn.momo.kits.modifier.conditional
|
|
46
42
|
import vn.momo.kits.modifier.setAutomationId
|
|
47
|
-
import vn.momo.kits.
|
|
43
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
48
44
|
|
|
49
45
|
data class HeaderColor(val tintIconColor: Color, val backgroundButton: Color, val borderColor: Color)
|
|
50
46
|
fun getHeaderColor(animatedHeader: AnimatedHeader?, opacity: Float, tintColor: Color?, defaultColor: Color): HeaderColor{
|
|
@@ -76,6 +72,7 @@ fun getHeaderColor(animatedHeader: AnimatedHeader?, opacity: Float, tintColor: C
|
|
|
76
72
|
)
|
|
77
73
|
}
|
|
78
74
|
|
|
75
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
79
76
|
@Composable
|
|
80
77
|
fun Header(
|
|
81
78
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
@@ -222,13 +219,4 @@ fun Header(
|
|
|
222
219
|
}
|
|
223
220
|
}
|
|
224
221
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
@Composable
|
|
228
|
-
fun getAppStatusBarHeight(): Dp {
|
|
229
|
-
return if (AppStatusBar.current == 0.dp) {
|
|
230
|
-
WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
|
231
|
-
} else {
|
|
232
|
-
AppStatusBar.current
|
|
233
|
-
}
|
|
234
222
|
}
|
|
@@ -11,6 +11,7 @@ import androidx.compose.ui.graphics.graphicsLayer
|
|
|
11
11
|
import androidx.compose.ui.unit.dp
|
|
12
12
|
import vn.momo.kits.components.Image
|
|
13
13
|
|
|
14
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
14
15
|
@Composable
|
|
15
16
|
fun HeaderAnimated(image: String, scrollState: Int = 0) {
|
|
16
17
|
// Scale animation
|
|
@@ -8,9 +8,8 @@ import androidx.compose.runtime.Composable
|
|
|
8
8
|
import androidx.compose.runtime.getValue
|
|
9
9
|
import androidx.compose.ui.Modifier
|
|
10
10
|
import androidx.compose.ui.graphics.Color
|
|
11
|
-
import vn.momo.kits.const.AppStatusBar
|
|
12
11
|
import vn.momo.kits.const.AppTheme
|
|
13
|
-
import vn.momo.kits.
|
|
12
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
14
13
|
|
|
15
14
|
enum class TitlePosition {
|
|
16
15
|
LEFT, CENTER,
|
|
@@ -37,6 +36,7 @@ fun animateColor(start: Color, stop: Color, fraction: Float): Color {
|
|
|
37
36
|
)
|
|
38
37
|
}
|
|
39
38
|
|
|
39
|
+
@Deprecated("Use vn.momo.kits.navigation.component.HeaderBackground instead", ReplaceWith("vn.momo.kits.navigation.component.HeaderBackground"))
|
|
40
40
|
@Composable
|
|
41
41
|
fun HeaderBackground(
|
|
42
42
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
@@ -19,6 +19,7 @@ import vn.momo.kits.components.Options
|
|
|
19
19
|
import vn.momo.kits.const.AppTheme
|
|
20
20
|
import vn.momo.kits.utils.bottomBorder
|
|
21
21
|
|
|
22
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
22
23
|
@Composable
|
|
23
24
|
fun HeaderDefault(
|
|
24
25
|
opacityAni: Float,
|
|
@@ -19,6 +19,7 @@ import vn.momo.kits.components.Options
|
|
|
19
19
|
import vn.momo.kits.const.AppTheme
|
|
20
20
|
import vn.momo.kits.utils.bottomBorder
|
|
21
21
|
|
|
22
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
22
23
|
@Composable
|
|
23
24
|
fun HeaderExtended(
|
|
24
25
|
opacityAni: Float,
|
|
@@ -81,6 +81,7 @@ object Spacing {
|
|
|
81
81
|
val XXS = 2.dp
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
@Deprecated("Use vn.momo.kits.navigation.component.HeaderRight instead", ReplaceWith("vn.momo.kits.navigation.component.HeaderRight"))
|
|
84
85
|
@Composable
|
|
85
86
|
fun HeaderRight(
|
|
86
87
|
headerRight: HeaderRightData? = null,
|
|
@@ -258,6 +259,7 @@ private fun ToolkitHeaderRight(
|
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
261
|
|
|
262
|
+
@Deprecated("Use vn.momo.kits.navigation.component instead", ReplaceWith("vn.momo.kits.navigation.component"))
|
|
261
263
|
@Composable
|
|
262
264
|
fun NavigationButton(
|
|
263
265
|
disabled: Boolean,
|
|
@@ -10,6 +10,7 @@ import androidx.compose.ui.zIndex
|
|
|
10
10
|
import vn.momo.kits.components.Text
|
|
11
11
|
import vn.momo.kits.const.Typography
|
|
12
12
|
|
|
13
|
+
@Deprecated("Use vn.momo.kits.navigation.component instead", ReplaceWith("vn.momo.kits.navigation.component"))
|
|
13
14
|
@Composable
|
|
14
15
|
fun HeaderTitle(
|
|
15
16
|
title: String = "",
|
|
@@ -68,7 +68,6 @@ import androidx.compose.ui.unit.Dp
|
|
|
68
68
|
import androidx.compose.ui.unit.IntOffset
|
|
69
69
|
import androidx.compose.ui.unit.LayoutDirection
|
|
70
70
|
import androidx.compose.ui.unit.dp
|
|
71
|
-
import androidx.compose.ui.unit.max
|
|
72
71
|
import androidx.compose.ui.unit.sp
|
|
73
72
|
import kotlinx.coroutines.flow.collectLatest
|
|
74
73
|
import kotlinx.coroutines.flow.mapNotNull
|
|
@@ -83,8 +82,10 @@ import vn.momo.kits.modifier.kitsAutomationId
|
|
|
83
82
|
import vn.momo.kits.modifier.noFeedbackClickable
|
|
84
83
|
import vn.momo.kits.modifier.setAutomationId
|
|
85
84
|
import vn.momo.kits.modifier.shadow
|
|
85
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
86
86
|
import kotlin.math.max
|
|
87
87
|
|
|
88
|
+
@Deprecated("Use NavigationContainer(StackScreen) instead", ReplaceWith("NavigationContainer(StackScreen)"))
|
|
88
89
|
@Composable
|
|
89
90
|
fun LiteScreen(
|
|
90
91
|
scrollable: Boolean = true,
|
|
@@ -17,6 +17,7 @@ import vn.momo.kits.const.ThemeAssets
|
|
|
17
17
|
import vn.momo.kits.const.defaultTheme
|
|
18
18
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
19
19
|
|
|
20
|
+
@Deprecated("Use IMaxApi instead", ReplaceWith("IMaxApi"))
|
|
20
21
|
interface ComposeApi {
|
|
21
22
|
fun request(funcName: String, params: Any?): String
|
|
22
23
|
fun request(funcName: String, params: Any?, onResponse: ((String) -> Unit)?): String
|
|
@@ -135,9 +136,10 @@ private fun Map<String, Any?>?.mapStringAny(key: String): Map<String, Any?> =
|
|
|
135
136
|
private fun Map<String, Any?>?.listOfMapStringAny(key: String): List<Map<String, Any>> =
|
|
136
137
|
(this?.get(key) as? List<Map<String, Any>>) ?: emptyList()
|
|
137
138
|
|
|
138
|
-
|
|
139
|
+
@Deprecated("Use LocalApi instead", ReplaceWith("LocalApi"))
|
|
139
140
|
val PlatformApi = staticCompositionLocalOf<Any?> { null }
|
|
140
141
|
|
|
142
|
+
@Deprecated("Use LocalNavigator instead", ReplaceWith("LocalNavigator"))
|
|
141
143
|
val AppNavigator = staticCompositionLocalOf<Navigator?> {
|
|
142
144
|
null
|
|
143
145
|
}
|
|
@@ -162,6 +164,7 @@ data class KitConfig(
|
|
|
162
164
|
|
|
163
165
|
internal var DesignSystemWhiteList: Boolean? = null
|
|
164
166
|
|
|
167
|
+
@Deprecated("Use NavigationContainer instead", ReplaceWith("NavigationContainer"))
|
|
165
168
|
@Composable
|
|
166
169
|
fun ApplicationContainer(
|
|
167
170
|
theme: Theme = defaultTheme,
|
|
@@ -40,6 +40,7 @@ import vn.momo.kits.const.Spacing
|
|
|
40
40
|
import vn.momo.kits.modifier.conditional
|
|
41
41
|
import vn.momo.kits.modifier.shadow
|
|
42
42
|
import vn.momo.kits.platform.getAndroidBuildVersion
|
|
43
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
43
44
|
|
|
44
45
|
enum class HeaderType {
|
|
45
46
|
DEFAULT,
|
|
@@ -49,6 +50,7 @@ enum class HeaderType {
|
|
|
49
50
|
|
|
50
51
|
const val HEADER_HEIGHT = 52
|
|
51
52
|
|
|
53
|
+
@Deprecated("Use NavigationContainer(StackScreen) instead", ReplaceWith("NavigationContainer(StackScreen)"))
|
|
52
54
|
@Composable
|
|
53
55
|
fun Screen(
|
|
54
56
|
backgroundColor: Color? = null,
|
|
@@ -22,6 +22,7 @@ data class HeaderAnimations(
|
|
|
22
22
|
private const val SCREEN_PADDING = 12
|
|
23
23
|
private const val BACK_WIDTH = 28
|
|
24
24
|
|
|
25
|
+
@Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
|
|
25
26
|
@Composable
|
|
26
27
|
fun useHeaderSearchAnimation(
|
|
27
28
|
opacityAni: Float,
|
|
@@ -72,7 +72,7 @@ private fun getHostFromUrl(url: String): String? {
|
|
|
72
72
|
private fun appendSizeQueryParam(url: String, value: String): String {
|
|
73
73
|
val fragmentIndex = url.indexOf('#')
|
|
74
74
|
val (baseUrl, fragment) = if (fragmentIndex != -1) {
|
|
75
|
-
url.
|
|
75
|
+
url.take(fragmentIndex) to url.substring(fragmentIndex)
|
|
76
76
|
} else {
|
|
77
77
|
url to ""
|
|
78
78
|
}
|
|
@@ -20,7 +20,6 @@ import androidx.compose.foundation.layout.padding
|
|
|
20
20
|
import androidx.compose.foundation.layout.size
|
|
21
21
|
import androidx.compose.foundation.layout.width
|
|
22
22
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
23
|
-
import androidx.compose.material.Text
|
|
24
23
|
import androidx.compose.runtime.Composable
|
|
25
24
|
import androidx.compose.runtime.DisposableEffect
|
|
26
25
|
import androidx.compose.runtime.LaunchedEffect
|
|
@@ -36,6 +35,7 @@ import androidx.compose.ui.unit.dp
|
|
|
36
35
|
import kotlinx.coroutines.launch
|
|
37
36
|
import vn.momo.kits.components.Divider
|
|
38
37
|
import vn.momo.kits.components.Icon
|
|
38
|
+
import vn.momo.kits.components.Text
|
|
39
39
|
import vn.momo.kits.const.AppTheme
|
|
40
40
|
import vn.momo.kits.const.Colors
|
|
41
41
|
import vn.momo.kits.const.Radius
|
|
@@ -67,7 +67,7 @@ val LocalNavigation = staticCompositionLocalOf<Navigation> {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
data class NavigationOptions(
|
|
70
|
-
|
|
70
|
+
val onBackHandler: (() -> Unit)? = null,
|
|
71
71
|
val hiddenBack: Boolean = false,
|
|
72
72
|
val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
|
|
73
73
|
val headerRight: HeaderRight = HeaderRight.Toolkit(),
|
|
@@ -16,19 +16,25 @@ import androidx.compose.runtime.LaunchedEffect
|
|
|
16
16
|
import androidx.compose.runtime.mutableStateOf
|
|
17
17
|
import androidx.compose.runtime.remember
|
|
18
18
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
19
|
+
import androidx.compose.ui.unit.Dp
|
|
19
20
|
import androidx.compose.ui.unit.dp
|
|
20
21
|
import androidx.navigation.compose.NavHost
|
|
21
22
|
import androidx.navigation.compose.composable
|
|
22
23
|
import androidx.navigation.compose.rememberNavController
|
|
23
24
|
import androidx.navigation.toRoute
|
|
25
|
+
import vn.momo.kits.application.AppConfig
|
|
26
|
+
import vn.momo.kits.application.AppLanguage
|
|
24
27
|
import vn.momo.kits.application.ApplicationContext
|
|
28
|
+
import vn.momo.kits.application.KitConfig
|
|
25
29
|
import vn.momo.kits.application.MiniAppContext
|
|
26
30
|
import vn.momo.kits.const.AppNavigationBar
|
|
27
31
|
import vn.momo.kits.const.AppStatusBar
|
|
28
32
|
import vn.momo.kits.const.AppTheme
|
|
29
33
|
import vn.momo.kits.const.AppThemeController
|
|
30
34
|
import vn.momo.kits.const.Theme
|
|
35
|
+
import vn.momo.kits.const.ThemeAssets
|
|
31
36
|
import vn.momo.kits.const.defaultTheme
|
|
37
|
+
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
32
38
|
import vn.momo.maxapi.IMaxApi
|
|
33
39
|
|
|
34
40
|
@Composable
|
|
@@ -39,14 +45,13 @@ fun NavigationContainer(
|
|
|
39
45
|
applicationContext: MiniAppContext? = null,
|
|
40
46
|
maxApi: IMaxApi? = null,
|
|
41
47
|
setNavigator: ((Navigator) -> Unit)? = null,
|
|
48
|
+
statusBarHeight: Dp? = null,
|
|
49
|
+
config: KitConfig? = null,
|
|
50
|
+
language: String? = null,
|
|
42
51
|
){
|
|
43
52
|
val navController = rememberNavController()
|
|
44
53
|
val navigator = remember { Navigator(navController = navController, maxApi = maxApi) }
|
|
45
|
-
val statusBarHeight =
|
|
46
|
-
WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
|
47
|
-
} else {
|
|
48
|
-
AppStatusBar.current
|
|
49
|
-
}
|
|
54
|
+
val statusBarHeight = statusBarHeight ?: getAppStatusBarHeight()
|
|
50
55
|
val navigationBarHeight = if (AppNavigationBar.current == 0.dp) {
|
|
51
56
|
WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
52
57
|
} else {
|
|
@@ -55,6 +60,17 @@ fun NavigationContainer(
|
|
|
55
60
|
|
|
56
61
|
val theme = remember { mutableStateOf(initialTheme) }
|
|
57
62
|
|
|
63
|
+
LaunchedEffect(Unit) {
|
|
64
|
+
val headerBar = config?.headerBar
|
|
65
|
+
if (headerBar != null && theme.value.assets.headerBackground == null) {
|
|
66
|
+
theme.value = theme.value.copy(
|
|
67
|
+
assets = ThemeAssets(
|
|
68
|
+
headerBackground = headerBar
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
val startDestination = DynamicScreenRegistry.register(initialScreen, options)
|
|
59
75
|
|
|
60
76
|
CompositionLocalProvider(
|
|
@@ -65,6 +81,8 @@ fun NavigationContainer(
|
|
|
65
81
|
AppStatusBar provides statusBarHeight,
|
|
66
82
|
AppNavigationBar provides navigationBarHeight,
|
|
67
83
|
ApplicationContext provides applicationContext,
|
|
84
|
+
AppConfig provides config,
|
|
85
|
+
AppLanguage provides language
|
|
68
86
|
) {
|
|
69
87
|
LaunchedEffect(Unit) {
|
|
70
88
|
setNavigator?.invoke(navigator)
|
|
@@ -208,9 +208,8 @@ object OverplayComponentRegistry {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
@Composable
|
|
211
|
-
fun
|
|
212
|
-
val overplay = currentOverlayComponent.value
|
|
213
|
-
if (overplay == null) return
|
|
211
|
+
fun OverlayComponent(){
|
|
212
|
+
val overplay = currentOverlayComponent.value ?: return
|
|
214
213
|
|
|
215
214
|
if (overplay.params is OverplayComponentParams.BottomSheet) {
|
|
216
215
|
val param = overplay.params
|
|
@@ -218,14 +217,14 @@ object OverplayComponentRegistry {
|
|
|
218
217
|
content = overplay.content,
|
|
219
218
|
header = param.bottomSheetHeader ?: BottomHeader.Title(),
|
|
220
219
|
isSurface = param.isSurface,
|
|
221
|
-
barrierDismissible = param.barrierDismissible
|
|
220
|
+
barrierDismissible = param.barrierDismissible,
|
|
222
221
|
onDismiss = param.onDismiss
|
|
223
222
|
)
|
|
224
223
|
} else if (overplay.params is OverplayComponentParams.Modal) {
|
|
225
224
|
val param = overplay.params
|
|
226
225
|
ModalScreen(
|
|
227
226
|
content = overplay.content,
|
|
228
|
-
barrierDismissible = param.barrierDismissible
|
|
227
|
+
barrierDismissible = param.barrierDismissible,
|
|
229
228
|
onDismiss = param.onDismiss
|
|
230
229
|
)
|
|
231
230
|
}
|