@momo-kits/native-kits 0.89.21 → 0.89.23-payment.1
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 +5 -9
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +6 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +4 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +5 -1
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +12 -0
- package/gradle.properties +1 -1
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
|
@@ -31,17 +31,13 @@ kotlin {
|
|
|
31
31
|
implementation(compose.foundation)
|
|
32
32
|
implementation(compose.material)
|
|
33
33
|
implementation(compose.material3)
|
|
34
|
+
implementation(compose.components.resources)
|
|
34
35
|
implementation(libs.ktor.client.core)
|
|
35
36
|
implementation(libs.jetbrains.coroutines.core)
|
|
36
|
-
implementation(libs.
|
|
37
|
-
implementation(
|
|
38
|
-
implementation(libs.
|
|
39
|
-
implementation(libs.
|
|
40
|
-
implementation(libs.navigation.compose)
|
|
41
|
-
implementation(libs.coil.compose)
|
|
42
|
-
implementation(libs.coil.compose.core)
|
|
43
|
-
implementation(libs.coil.network.ktor)
|
|
44
|
-
implementation(libs.coil.mp)
|
|
37
|
+
implementation(libs.navigation.multiplatform)
|
|
38
|
+
implementation(libs.coil.multiplatform.compose)
|
|
39
|
+
implementation(libs.coil.multiplatform.core)
|
|
40
|
+
implementation(libs.coil.multiplatform.network.ktor)
|
|
45
41
|
}
|
|
46
42
|
}
|
|
47
43
|
val androidMain by getting {
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
package vn.momo.kits.platform
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.content.res.Resources
|
|
3
5
|
import android.graphics.BlurMaskFilter
|
|
4
6
|
import androidx.compose.runtime.Composable
|
|
5
7
|
import androidx.compose.ui.graphics.NativePaint
|
|
6
8
|
import androidx.compose.ui.platform.LocalConfiguration
|
|
9
|
+
import androidx.compose.ui.unit.Dp
|
|
10
|
+
import androidx.compose.ui.unit.dp
|
|
7
11
|
|
|
8
12
|
actual fun getPlatformName(): String = "Android"
|
|
9
13
|
|
|
@@ -19,4 +23,15 @@ actual fun getScreenDimensions(): ScreenDimension {
|
|
|
19
23
|
|
|
20
24
|
actual fun NativePaint.setMaskFilter(blurRadius: Float) {
|
|
21
25
|
this.maskFilter = BlurMaskFilter(blurRadius, BlurMaskFilter.Blur.NORMAL)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@SuppressLint("InternalInsetResource")
|
|
29
|
+
@Composable
|
|
30
|
+
actual fun getStatusBarHeight(): Dp {
|
|
31
|
+
val resourceId = Resources.getSystem().getIdentifier(
|
|
32
|
+
"status_bar_height",
|
|
33
|
+
"dimen",
|
|
34
|
+
"android"
|
|
35
|
+
)
|
|
36
|
+
return if(resourceId > 0) Resources.getSystem().getDimensionPixelSize(resourceId).dp else 0.dp
|
|
22
37
|
}
|
|
@@ -46,6 +46,7 @@ import vn.momo.kits.const.AppTheme
|
|
|
46
46
|
import vn.momo.kits.const.Colors
|
|
47
47
|
import vn.momo.kits.const.Spacing
|
|
48
48
|
import vn.momo.kits.const.Typography
|
|
49
|
+
import vn.momo.kits.platform.getStatusBarHeight
|
|
49
50
|
import vn.momo.kits.utils.bottomBorder
|
|
50
51
|
|
|
51
52
|
enum class TitlePosition {
|
|
@@ -63,9 +64,10 @@ fun HeaderImage(
|
|
|
63
64
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
64
65
|
headerBackground: String?,
|
|
65
66
|
) {
|
|
67
|
+
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
66
68
|
when (headerType) {
|
|
67
69
|
HeaderType.DEFAULT -> {
|
|
68
|
-
val height =
|
|
70
|
+
val height = statusBarHeight + 52.dp
|
|
69
71
|
Image(
|
|
70
72
|
source = headerBackground ?: "",
|
|
71
73
|
modifier = Modifier.fillMaxWidth().height(height),
|
|
@@ -86,7 +88,7 @@ fun HeaderImage(
|
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
HeaderType.SURFACE -> {
|
|
89
|
-
val height =
|
|
91
|
+
val height =statusBarHeight + 52.dp
|
|
90
92
|
Box(
|
|
91
93
|
modifier = Modifier.fillMaxWidth().height(height)
|
|
92
94
|
.background(AppTheme.current.colors.background.surface)
|
|
@@ -115,6 +117,7 @@ fun Header(
|
|
|
115
117
|
animatedHeader: AnimatedHeader? = null,
|
|
116
118
|
scrollState: Int = 0
|
|
117
119
|
) {
|
|
120
|
+
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
118
121
|
var tintIconColor = Colors.black_01
|
|
119
122
|
var backgroundButton = Colors.black_20.copy(alpha = 0.4f)
|
|
120
123
|
if (headerType == HeaderType.SURFACE) {
|
|
@@ -143,7 +146,7 @@ fun Header(
|
|
|
143
146
|
|
|
144
147
|
if (headerType != HeaderType.NONE) {
|
|
145
148
|
BoxWithConstraints(
|
|
146
|
-
Modifier.height(
|
|
149
|
+
Modifier.height(statusBarHeight + 52.dp)
|
|
147
150
|
.fillMaxWidth()
|
|
148
151
|
.zIndex(10f),
|
|
149
152
|
contentAlignment = Alignment.BottomCenter
|
|
@@ -11,6 +11,7 @@ import vn.momo.kits.const.AppTheme
|
|
|
11
11
|
import vn.momo.kits.const.Theme
|
|
12
12
|
import vn.momo.kits.const.defaultTheme
|
|
13
13
|
import vn.momo.kits.platform.disableOverscroll
|
|
14
|
+
import vn.momo.kits.platform.getStatusBarHeight
|
|
14
15
|
|
|
15
16
|
val AppNavigator = staticCompositionLocalOf<Navigator> {
|
|
16
17
|
error("no navigator provided!")
|
|
@@ -57,7 +58,7 @@ fun ApplicationContainer(
|
|
|
57
58
|
CompositionLocalProvider(
|
|
58
59
|
AppTheme provides theme,
|
|
59
60
|
AppNavigator provides Navigator(),
|
|
60
|
-
AppStatusBar provides
|
|
61
|
+
AppStatusBar provides getStatusBarHeight(),
|
|
61
62
|
) {
|
|
62
63
|
content()
|
|
63
64
|
}
|
|
@@ -34,6 +34,7 @@ import vn.momo.kits.const.AppTheme
|
|
|
34
34
|
import vn.momo.kits.const.Colors
|
|
35
35
|
import vn.momo.kits.const.Spacing
|
|
36
36
|
import vn.momo.kits.modifier.shadow
|
|
37
|
+
import vn.momo.kits.platform.getStatusBarHeight
|
|
37
38
|
|
|
38
39
|
enum class HeaderType {
|
|
39
40
|
DEFAULT,
|
|
@@ -62,6 +63,7 @@ fun Screen(
|
|
|
62
63
|
layoutOffset: Dp = 56.dp,
|
|
63
64
|
content: @Composable () -> Unit,
|
|
64
65
|
) {
|
|
66
|
+
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
65
67
|
val keyboardController = LocalSoftwareKeyboardController.current
|
|
66
68
|
val keyboardHeight = WindowInsets.ime.asPaddingValues().calculateBottomPadding()
|
|
67
69
|
val keyboardSize = when {
|
|
@@ -117,7 +119,7 @@ fun Screen(
|
|
|
117
119
|
|
|
118
120
|
Column(
|
|
119
121
|
modifier = Modifier.fillMaxSize()
|
|
120
|
-
.padding(top = if (animatedHeader === null && headerType !== HeaderType.NONE)
|
|
122
|
+
.padding(top = if (animatedHeader === null && headerType !== HeaderType.NONE) statusBarHeight + 52.dp else 0.dp)
|
|
121
123
|
.pointerInput(Unit) {
|
|
122
124
|
detectTapGestures(onTap = {
|
|
123
125
|
keyboardController?.hide()
|
|
@@ -137,7 +139,7 @@ fun Screen(
|
|
|
137
139
|
headerAnimated()
|
|
138
140
|
Column {
|
|
139
141
|
if (animatedHeader !== null) {
|
|
140
|
-
Spacer(modifier = Modifier.padding(top =
|
|
142
|
+
Spacer(modifier = Modifier.padding(top = statusBarHeight + 52.dp + layoutOffset))
|
|
141
143
|
}
|
|
142
144
|
content()
|
|
143
145
|
}
|
|
@@ -2,7 +2,7 @@ package vn.momo.kits.const
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
4
4
|
import androidx.compose.ui.graphics.Color
|
|
5
|
-
import androidx.compose.ui.unit.
|
|
5
|
+
import androidx.compose.ui.unit.Dp
|
|
6
6
|
|
|
7
7
|
data class Background(
|
|
8
8
|
val default: Color,
|
|
@@ -168,6 +168,6 @@ val darkTheme = Theme(
|
|
|
168
168
|
|
|
169
169
|
|
|
170
170
|
val AppTheme = staticCompositionLocalOf { defaultTheme }
|
|
171
|
-
val AppStatusBar = staticCompositionLocalOf {
|
|
172
|
-
|
|
171
|
+
val AppStatusBar = staticCompositionLocalOf<Dp?> {
|
|
172
|
+
null
|
|
173
173
|
}
|
|
@@ -2,6 +2,7 @@ package vn.momo.kits.platform
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
import androidx.compose.ui.graphics.NativePaint
|
|
5
|
+
import androidx.compose.ui.unit.Dp
|
|
5
6
|
|
|
6
7
|
data class ScreenDimension(
|
|
7
8
|
val width: Int,
|
|
@@ -15,4 +16,7 @@ expect fun disableOverscroll(): Unit
|
|
|
15
16
|
@Composable
|
|
16
17
|
expect fun getScreenDimensions(): ScreenDimension
|
|
17
18
|
|
|
18
|
-
expect fun NativePaint.setMaskFilter(blurRadius: Float)
|
|
19
|
+
expect fun NativePaint.setMaskFilter(blurRadius: Float)
|
|
20
|
+
|
|
21
|
+
@Composable
|
|
22
|
+
expect fun getStatusBarHeight(): Dp
|
|
@@ -2,15 +2,22 @@ package vn.momo.kits.platform
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
4
4
|
import androidx.compose.foundation.gestures.optOutOfCupertinoOverscroll
|
|
5
|
+
import androidx.compose.foundation.layout.WindowInsets
|
|
6
|
+
import androidx.compose.foundation.layout.asPaddingValues
|
|
7
|
+
import androidx.compose.foundation.layout.systemBars
|
|
5
8
|
import androidx.compose.runtime.Composable
|
|
6
9
|
import androidx.compose.ui.graphics.NativePaint
|
|
10
|
+
import androidx.compose.ui.unit.Dp
|
|
11
|
+
import androidx.compose.ui.unit.dp
|
|
7
12
|
import kotlinx.cinterop.ExperimentalForeignApi
|
|
8
13
|
import kotlinx.cinterop.get
|
|
9
14
|
import kotlinx.cinterop.memScoped
|
|
10
15
|
import org.jetbrains.skia.FilterBlurMode
|
|
11
16
|
import org.jetbrains.skia.MaskFilter
|
|
17
|
+
import platform.UIKit.UIApplication
|
|
12
18
|
import platform.UIKit.UIScreen
|
|
13
19
|
|
|
20
|
+
|
|
14
21
|
actual fun getPlatformName(): String = "iOS"
|
|
15
22
|
|
|
16
23
|
@OptIn(ExperimentalFoundationApi::class)
|
|
@@ -30,4 +37,9 @@ actual fun getScreenDimensions(): ScreenDimension = memScoped {
|
|
|
30
37
|
|
|
31
38
|
actual fun NativePaint.setMaskFilter(blurRadius: Float) {
|
|
32
39
|
this.maskFilter = MaskFilter.makeBlur(FilterBlurMode.NORMAL, blurRadius / 2, true)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Composable
|
|
43
|
+
actual fun getStatusBarHeight(): Dp {
|
|
44
|
+
return WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
|
33
45
|
}
|
package/gradle.properties
CHANGED