@momo-kits/native-kits 0.159.1-beta.15-debug → 0.159.1-beta.17-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.159.1-beta.15-debug"
43
+ version = "0.159.1-beta.17-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -70,7 +70,7 @@ actual fun getScreenHeight(): Dp {
70
70
  return getScreenDimensions().height.dp + if (getOSVersion() >= 35) 0.dp else AppStatusBar.current + AppNavigationBar.current
71
71
  }
72
72
 
73
- actual fun getOSVersion(): Int = Build.VERSION.SDK_INT
73
+ actual fun getOSVersion(): OSVersion = OSVersion.Android(sdk = Build.VERSION.SDK_INT)
74
74
 
75
75
  @Composable
76
76
  actual fun LottieAnimation(
@@ -59,8 +59,9 @@ import vn.momo.kits.modifier.DeprecatedModifier
59
59
  import vn.momo.kits.modifier.conditional
60
60
  import vn.momo.kits.modifier.shadow
61
61
  import vn.momo.kits.navigation.component.SnackBar
62
- import vn.momo.kits.platform.getOSVersion
62
+ import vn.momo.kits.platform.supportsImePadding
63
63
  import vn.momo.kits.utils.getAppStatusBarHeight
64
+ import vn.momo.kits.utils.getNavigationBarHeight
64
65
 
65
66
  enum class HeaderType {
66
67
  DEFAULT,
@@ -102,7 +103,7 @@ fun Screen(
102
103
  val keyboardController = LocalSoftwareKeyboardController.current
103
104
 
104
105
  val isKeyboardVisible = isKeyboardVisible()
105
- val indicator = getAppStatusBarHeight()
106
+ val indicator = getNavigationBarHeight()
106
107
  val bottomPadding = if (isKeyboardVisible) 0.dp else indicator
107
108
 
108
109
  val headerHeight = if (animatedHeader !== null)
@@ -134,7 +135,7 @@ fun Screen(
134
135
  Box(
135
136
  Modifier.fillMaxSize()
136
137
  .background(backgroundColor ?: AppTheme.current.colors.background.default)
137
- .conditional(useAvoidKeyboard && getOSVersion() > 29) {
138
+ .conditional(useAvoidKeyboard && supportsImePadding()) {
138
139
  imePadding()
139
140
  }.then(DeprecatedModifier())
140
141
  ) {
@@ -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.getOSVersion
65
+ import vn.momo.kits.platform.supportsImePadding
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 && getOSVersion() > 29) {
169
+ .conditional(options.keyboardOptions.useAvoidKeyboard && supportsImePadding()) {
170
170
  imePadding()
171
171
  }
172
172
  ) {
@@ -30,7 +30,19 @@ expect fun ProvideNavigationEventDispatcherOwner(content: @Composable () -> Unit
30
30
  @Composable
31
31
  expect fun getScreenHeight(): Dp
32
32
 
33
- expect fun getOSVersion(): Int
33
+ sealed interface OSVersion {
34
+ val value: Int
35
+ data class Android(val sdk: Int) : OSVersion { override val value: Int get() = sdk }
36
+ data class IOS(val major: Int) : OSVersion { override val value: Int get() = major }
37
+
38
+ operator fun compareTo(other: Int): Int = value.compareTo(other)
39
+ }
40
+ expect fun getOSVersion(): OSVersion
41
+
42
+ fun supportsImePadding(): Boolean = when (val v = getOSVersion()) {
43
+ is OSVersion.Android -> v.sdk > 29
44
+ is OSVersion.IOS -> true
45
+ }
34
46
 
35
47
  @Composable
36
48
  expect fun LottieAnimation(
@@ -85,9 +85,9 @@ actual fun getScreenHeight(): Dp {
85
85
  return getScreenDimensions().height.dp
86
86
  }
87
87
 
88
- actual fun getOSVersion(): Int {
89
- return UIDevice.currentDevice.systemVersion.substringBefore(".").toIntOrNull() ?: 0
90
- }
88
+ actual fun getOSVersion(): OSVersion = OSVersion.IOS(
89
+ major = UIDevice.currentDevice.systemVersion.substringBefore(".").toIntOrNull() ?: 0
90
+ )
91
91
 
92
92
  @OptIn(ExperimentalForeignApi::class)
93
93
  @Composable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.159.1-beta.15-debug",
3
+ "version": "0.159.1-beta.17-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},