@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.
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.157.13-debug"
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 (getAndroidBuildVersion() >= 35) 0.dp else AppStatusBar.current + AppNavigationBar.current
70
+ return getScreenDimensions().height.dp + if (getOSVersion() >= 35) 0.dp else AppStatusBar.current + AppNavigationBar.current
66
71
  }
67
72
 
68
- actual fun getAndroidBuildVersion(): Int = Build.VERSION.SDK_INT
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.getAndroidBuildVersion
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 && getAndroidBuildVersion() > 29) {
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
- CompositionLocalProvider(
81
- LocalNavigator provides navigator,
82
- LocalMaxApi provides maxApi,
83
- AppTheme provides theme.value,
84
- AppStatusBar provides statusBarHeight,
85
- AppNavigationBar provides navigationBarHeight,
86
- ApplicationContext provides mergedContext,
87
- AppConfig provides config,
88
- AppLanguage provides language,
89
- ScaleSizeMaxRate provides mergedContext?.scaleSizeMaxRate,
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
- LaunchedEffect(Unit) {
92
- setNavigator?.invoke(navigator)
93
- }
93
+ LaunchedEffect(Unit) {
94
+ setNavigator?.invoke(navigator)
95
+ }
94
96
 
95
- NavHost(navController, startDestination = startDestination) {
96
- composable<DynamicScreenRoute>(
97
- enterTransition = {
98
- slideInHorizontally(
99
- animationSpec = tween(300),
100
- initialOffsetX = { it }
101
- )
102
- },
103
- exitTransition = null,
104
- popEnterTransition = { fadeIn(animationSpec = tween(0)) },
105
- popExitTransition = {
106
- slideOutHorizontally(
107
- animationSpec = tween(300),
108
- targetOffsetX = { it }
109
- )
110
- }
111
- ) { backStackEntry ->
112
- val route = backStackEntry.toRoute<DynamicScreenRoute>()
113
- val screen = DynamicScreenRegistry.getScreen(route.id)
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
- if (screen != null){
116
- StackScreen(
117
- id = route.id,
118
- name = screen.name,
119
- content = screen.content,
120
- navigationOptions = screen.options
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
- composable<DynamicDialogRoute>(
126
- enterTransition = {
127
- slideInVertically (
128
- animationSpec = tween(300),
129
- initialOffsetY = { it }
130
- )
131
- },
132
- exitTransition = null,
133
- popEnterTransition = { fadeIn(animationSpec = tween(0)) },
134
- popExitTransition = {
135
- slideOutVertically (
136
- animationSpec = tween(300),
137
- targetOffsetY = { it }
138
- )
139
- }
140
- ) { backStackEntry ->
141
- val route = backStackEntry.toRoute<DynamicDialogRoute>()
142
- val screen = DynamicScreenRegistry.getScreen(route.id)
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
- if (screen != null){
145
- StackScreen(
146
- id = route.id,
147
- name = screen.name,
148
- content = screen.content,
149
- navigationOptions = screen.options
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.getAndroidBuildVersion
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 && getAndroidBuildVersion() > 29) {
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 getAndroidBuildVersion(): Int
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 getAndroidBuildVersion(): Int = 999
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
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.157.13
21
+ version=0.157.14
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.157.13-debug",
3
+ "version": "0.157.14-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},