@momo-kits/native-kits 0.157.13-debug → 0.157.14-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/compose/build.gradle.kts +2 -2
- package/compose/build.gradle.kts.backup +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +8 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +68 -66
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +5 -2
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +27 -2
- package/gradle/libs.versions.toml +1 -0
- package/gradle.properties +1 -1
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
|
@@ -40,7 +40,7 @@ kotlin {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
cocoapods {
|
|
43
|
-
version = "0.157.
|
|
43
|
+
version = "0.157.14-debug"
|
|
44
44
|
summary = "IOS Shared module"
|
|
45
45
|
homepage = "https://momo.vn"
|
|
46
46
|
ios.deploymentTarget = "15.0"
|
|
@@ -63,6 +63,7 @@ kotlin {
|
|
|
63
63
|
implementation(compose.material)
|
|
64
64
|
implementation(compose.material3)
|
|
65
65
|
implementation(compose.components.resources)
|
|
66
|
+
implementation(libs.compose.ui.backhandler)
|
|
66
67
|
implementation(libs.ktor.client.core)
|
|
67
68
|
implementation(libs.jetbrains.coroutines.core)
|
|
68
69
|
implementation(libs.navigation.multiplatform)
|
|
@@ -177,4 +178,3 @@ compose {
|
|
|
177
178
|
// }
|
|
178
179
|
// }
|
|
179
180
|
// }
|
|
180
|
-
|
|
@@ -63,6 +63,7 @@ kotlin {
|
|
|
63
63
|
implementation(compose.material)
|
|
64
64
|
implementation(compose.material3)
|
|
65
65
|
implementation(compose.components.resources)
|
|
66
|
+
implementation(libs.compose.ui.backhandler)
|
|
66
67
|
implementation(libs.ktor.client.core)
|
|
67
68
|
implementation(libs.jetbrains.coroutines.core)
|
|
68
69
|
implementation(libs.navigation.multiplatform)
|
|
@@ -177,4 +178,3 @@ mavenPublishing {
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
|
-
|
|
@@ -60,12 +60,17 @@ actual fun BackHandler(enabled: Boolean, onBack: () -> Unit) {
|
|
|
60
60
|
AndroidBackHandler(enabled = enabled, onBack = onBack)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
@Composable
|
|
64
|
+
actual fun ProvideNavigationEventDispatcherOwner(content: @Composable () -> Unit) {
|
|
65
|
+
content()
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
@Composable
|
|
64
69
|
actual fun getScreenHeight(): Dp {
|
|
65
|
-
return getScreenDimensions().height.dp + if (
|
|
70
|
+
return getScreenDimensions().height.dp + if (getOSVersion() >= 35) 0.dp else AppStatusBar.current + AppNavigationBar.current
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
actual fun
|
|
73
|
+
actual fun getOSVersion(): Int = Build.VERSION.SDK_INT
|
|
69
74
|
|
|
70
75
|
@Composable
|
|
71
76
|
actual fun LottieAnimation(
|
|
@@ -108,4 +113,4 @@ actual fun LottieAnimation(
|
|
|
108
113
|
|
|
109
114
|
actual fun NativePaint.setColor(color: Color){
|
|
110
115
|
this.color = color.toArgb()
|
|
111
|
-
}
|
|
116
|
+
}
|
|
@@ -60,7 +60,7 @@ import vn.momo.kits.modifier.DeprecatedModifier
|
|
|
60
60
|
import vn.momo.kits.modifier.conditional
|
|
61
61
|
import vn.momo.kits.modifier.shadow
|
|
62
62
|
import vn.momo.kits.navigation.component.SnackBar
|
|
63
|
-
import vn.momo.kits.platform.
|
|
63
|
+
import vn.momo.kits.platform.getOSVersion
|
|
64
64
|
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
65
65
|
|
|
66
66
|
enum class HeaderType {
|
|
@@ -135,7 +135,7 @@ fun Screen(
|
|
|
135
135
|
Box(
|
|
136
136
|
Modifier.fillMaxSize()
|
|
137
137
|
.background(backgroundColor ?: AppTheme.current.colors.background.default)
|
|
138
|
-
.conditional(useAvoidKeyboard &&
|
|
138
|
+
.conditional(useAvoidKeyboard && getOSVersion() > 29) {
|
|
139
139
|
imePadding()
|
|
140
140
|
}.then(DeprecatedModifier())
|
|
141
141
|
) {
|
|
@@ -402,4 +402,3 @@ fun ScreenSnackBarHost(footerHeightPx: Int) {
|
|
|
402
402
|
|
|
403
403
|
|
|
404
404
|
|
|
405
|
-
|
|
@@ -34,6 +34,7 @@ import vn.momo.kits.const.AppTheme
|
|
|
34
34
|
import vn.momo.kits.const.Theme
|
|
35
35
|
import vn.momo.kits.const.ThemeAssets
|
|
36
36
|
import vn.momo.kits.const.defaultTheme
|
|
37
|
+
import vn.momo.kits.platform.ProvideNavigationEventDispatcherOwner
|
|
37
38
|
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
38
39
|
import vn.momo.maxapi.IMaxApi
|
|
39
40
|
|
|
@@ -77,77 +78,79 @@ fun NavigationContainer(
|
|
|
77
78
|
|
|
78
79
|
val startDestination = DynamicScreenRegistry.register(initialScreenName, initialScreen, options)
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
ProvideNavigationEventDispatcherOwner {
|
|
82
|
+
CompositionLocalProvider(
|
|
83
|
+
LocalNavigator provides navigator,
|
|
84
|
+
LocalMaxApi provides maxApi,
|
|
85
|
+
AppTheme provides theme.value,
|
|
86
|
+
AppStatusBar provides statusBarHeight,
|
|
87
|
+
AppNavigationBar provides navigationBarHeight,
|
|
88
|
+
ApplicationContext provides mergedContext,
|
|
89
|
+
AppConfig provides config,
|
|
90
|
+
AppLanguage provides language,
|
|
91
|
+
ScaleSizeMaxRate provides mergedContext?.scaleSizeMaxRate,
|
|
90
92
|
) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
LaunchedEffect(Unit) {
|
|
94
|
+
setNavigator?.invoke(navigator)
|
|
95
|
+
}
|
|
94
96
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
97
|
+
NavHost(navController, startDestination = startDestination) {
|
|
98
|
+
composable<DynamicScreenRoute>(
|
|
99
|
+
enterTransition = {
|
|
100
|
+
slideInHorizontally(
|
|
101
|
+
animationSpec = tween(300),
|
|
102
|
+
initialOffsetX = { it }
|
|
103
|
+
)
|
|
104
|
+
},
|
|
105
|
+
exitTransition = null,
|
|
106
|
+
popEnterTransition = { fadeIn(animationSpec = tween(0)) },
|
|
107
|
+
popExitTransition = {
|
|
108
|
+
slideOutHorizontally(
|
|
109
|
+
animationSpec = tween(300),
|
|
110
|
+
targetOffsetX = { it }
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
) { backStackEntry ->
|
|
114
|
+
val route = backStackEntry.toRoute<DynamicScreenRoute>()
|
|
115
|
+
val screen = DynamicScreenRegistry.getScreen(route.id)
|
|
114
116
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
if (screen != null) {
|
|
118
|
+
StackScreen(
|
|
119
|
+
id = route.id,
|
|
120
|
+
name = screen.name,
|
|
121
|
+
content = screen.content,
|
|
122
|
+
navigationOptions = screen.options
|
|
123
|
+
)
|
|
124
|
+
}
|
|
122
125
|
}
|
|
123
|
-
}
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
composable<DynamicDialogRoute>(
|
|
128
|
+
enterTransition = {
|
|
129
|
+
slideInVertically(
|
|
130
|
+
animationSpec = tween(300),
|
|
131
|
+
initialOffsetY = { it }
|
|
132
|
+
)
|
|
133
|
+
},
|
|
134
|
+
exitTransition = null,
|
|
135
|
+
popEnterTransition = { fadeIn(animationSpec = tween(0)) },
|
|
136
|
+
popExitTransition = {
|
|
137
|
+
slideOutVertically(
|
|
138
|
+
animationSpec = tween(300),
|
|
139
|
+
targetOffsetY = { it }
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
) { backStackEntry ->
|
|
143
|
+
val route = backStackEntry.toRoute<DynamicDialogRoute>()
|
|
144
|
+
val screen = DynamicScreenRegistry.getScreen(route.id)
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
if (screen != null) {
|
|
147
|
+
StackScreen(
|
|
148
|
+
id = route.id,
|
|
149
|
+
name = screen.name,
|
|
150
|
+
content = screen.content,
|
|
151
|
+
navigationOptions = screen.options
|
|
152
|
+
)
|
|
153
|
+
}
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
156
|
}
|
|
@@ -163,4 +166,3 @@ fun NavigationContainer(
|
|
|
163
166
|
val LocalMaxApi = staticCompositionLocalOf<IMaxApi?> {
|
|
164
167
|
error("No MaxApi provided")
|
|
165
168
|
}
|
|
166
|
-
|
|
@@ -62,7 +62,7 @@ import vn.momo.kits.navigation.component.HeaderRight
|
|
|
62
62
|
import vn.momo.kits.navigation.component.HeaderType
|
|
63
63
|
import vn.momo.kits.navigation.component.InputSearchType
|
|
64
64
|
import vn.momo.kits.platform.BackHandler
|
|
65
|
-
import vn.momo.kits.platform.
|
|
65
|
+
import vn.momo.kits.platform.getOSVersion
|
|
66
66
|
import vn.momo.kits.navigation.tracking.ScreenTracker
|
|
67
67
|
import vn.momo.kits.navigation.tracking.ScreenTrackingState
|
|
68
68
|
import kotlinx.coroutines.delay
|
|
@@ -166,7 +166,7 @@ internal fun StackScreen(
|
|
|
166
166
|
.conditional(options.keyboardOptions.keyboardShouldPersistTaps) {
|
|
167
167
|
hideKeyboardOnTap()
|
|
168
168
|
}
|
|
169
|
-
.conditional(options.keyboardOptions.useAvoidKeyboard &&
|
|
169
|
+
.conditional(options.keyboardOptions.useAvoidKeyboard && getOSVersion() > 29) {
|
|
170
170
|
imePadding()
|
|
171
171
|
}
|
|
172
172
|
) {
|
|
@@ -24,10 +24,13 @@ expect fun getStatusBarHeight(): Dp
|
|
|
24
24
|
@Composable
|
|
25
25
|
expect fun BackHandler(enabled: Boolean, onBack: () -> Unit)
|
|
26
26
|
|
|
27
|
+
@Composable
|
|
28
|
+
expect fun ProvideNavigationEventDispatcherOwner(content: @Composable () -> Unit)
|
|
29
|
+
|
|
27
30
|
@Composable
|
|
28
31
|
expect fun getScreenHeight(): Dp
|
|
29
32
|
|
|
30
|
-
expect fun
|
|
33
|
+
expect fun getOSVersion(): Int
|
|
31
34
|
|
|
32
35
|
@Composable
|
|
33
36
|
expect fun LottieAnimation(
|
|
@@ -39,4 +42,4 @@ expect fun LottieAnimation(
|
|
|
39
42
|
|
|
40
43
|
expect fun NativePaint.setColor(
|
|
41
44
|
color: Color = Color.Black
|
|
42
|
-
)
|
|
45
|
+
)
|
|
@@ -6,12 +6,15 @@ import androidx.compose.foundation.layout.asPaddingValues
|
|
|
6
6
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
7
7
|
import androidx.compose.foundation.layout.systemBars
|
|
8
8
|
import androidx.compose.runtime.Composable
|
|
9
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
9
10
|
import androidx.compose.runtime.LaunchedEffect
|
|
10
11
|
import androidx.compose.runtime.getValue
|
|
11
12
|
import androidx.compose.runtime.mutableStateOf
|
|
12
13
|
import androidx.compose.runtime.remember
|
|
13
14
|
import androidx.compose.runtime.setValue
|
|
15
|
+
import androidx.compose.ui.InternalComposeUiApi
|
|
14
16
|
import androidx.compose.ui.Modifier
|
|
17
|
+
import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
|
|
15
18
|
import androidx.compose.ui.graphics.Color
|
|
16
19
|
import androidx.compose.ui.graphics.NativePaint
|
|
17
20
|
import androidx.compose.ui.graphics.toArgb
|
|
@@ -26,10 +29,13 @@ import cocoapods.lottie_ios.CompatibleAnimationView
|
|
|
26
29
|
import kotlinx.cinterop.ExperimentalForeignApi
|
|
27
30
|
import kotlinx.cinterop.get
|
|
28
31
|
import kotlinx.cinterop.memScoped
|
|
32
|
+
import androidx.navigationevent.NavigationEventDispatcher
|
|
33
|
+
import androidx.navigationevent.NavigationEventDispatcherOwner
|
|
29
34
|
import org.jetbrains.skia.FilterBlurMode
|
|
30
35
|
import org.jetbrains.skia.MaskFilter
|
|
31
36
|
import platform.Foundation.NSBundle
|
|
32
37
|
import platform.UIKit.UIColor
|
|
38
|
+
import platform.UIKit.UIDevice
|
|
33
39
|
import platform.UIKit.UIScreen
|
|
34
40
|
|
|
35
41
|
actual fun getPlatformName(): String = "iOS"
|
|
@@ -57,12 +63,31 @@ actual fun getStatusBarHeight(): Dp {
|
|
|
57
63
|
actual fun BackHandler(enabled: Boolean, onBack: () -> Unit) {
|
|
58
64
|
}
|
|
59
65
|
|
|
66
|
+
@OptIn(InternalComposeUiApi::class)
|
|
67
|
+
@Composable
|
|
68
|
+
actual fun ProvideNavigationEventDispatcherOwner(content: @Composable () -> Unit) {
|
|
69
|
+
val navigationEventDispatcherOwner = remember {
|
|
70
|
+
object : NavigationEventDispatcherOwner {
|
|
71
|
+
override val navigationEventDispatcher = NavigationEventDispatcher().apply {
|
|
72
|
+
isEnabled = false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
CompositionLocalProvider(
|
|
78
|
+
LocalCompatNavigationEventDispatcherOwner provides navigationEventDispatcherOwner,
|
|
79
|
+
content = content
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
60
83
|
@Composable
|
|
61
84
|
actual fun getScreenHeight(): Dp {
|
|
62
85
|
return getScreenDimensions().height.dp
|
|
63
86
|
}
|
|
64
87
|
|
|
65
|
-
actual fun
|
|
88
|
+
actual fun getOSVersion(): Int {
|
|
89
|
+
return UIDevice.currentDevice.systemVersion.substringBefore(".").toIntOrNull() ?: 0
|
|
90
|
+
}
|
|
66
91
|
|
|
67
92
|
@OptIn(ExperimentalForeignApi::class)
|
|
68
93
|
@Composable
|
|
@@ -148,4 +173,4 @@ fun Color.toUIColor(): UIColor {
|
|
|
148
173
|
|
|
149
174
|
actual fun NativePaint.setColor(color: Color){
|
|
150
175
|
this.color = color.toArgb()
|
|
151
|
-
}
|
|
176
|
+
}
|
|
@@ -31,6 +31,7 @@ jetbrains-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-c
|
|
|
31
31
|
jetbrains-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization", version.ref = "kSerialize" }
|
|
32
32
|
jetbrains-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kSerialize" }
|
|
33
33
|
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-datetime" }
|
|
34
|
+
compose-ui-backhandler = { module = "org.jetbrains.compose.ui:ui-backhandler", version.ref = "compose" }
|
|
34
35
|
navigation-multiplatform = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigation-multiplatform" }
|
|
35
36
|
coil-multiplatform-core = { module = "io.coil-kt.coil3:coil-core", version.ref = "coil3-multiplatform" }
|
|
36
37
|
coil-multiplatform-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil3-multiplatform" }
|
package/gradle.properties
CHANGED