@momo-kits/native-kits 0.157.14-debug → 0.157.15-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 +1 -1
- package/compose/compose.podspec +4 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +4 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +6 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +1 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +17 -0
- package/gradle.properties +1 -1
- package/ios/Typography/Text.swift +1 -1
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Pod::Spec.new do |spec|
|
|
2
2
|
spec.name = 'compose'
|
|
3
|
-
spec.version = '0.
|
|
3
|
+
spec.version = '0.159.1-beta.7'
|
|
4
4
|
spec.homepage = 'https://momo.vn'
|
|
5
5
|
spec.source = { :http=> ''}
|
|
6
6
|
spec.authors = ''
|
|
@@ -10,27 +10,20 @@ Pod::Spec.new do |spec|
|
|
|
10
10
|
spec.libraries = 'c++'
|
|
11
11
|
spec.ios.deployment_target = '15.0'
|
|
12
12
|
spec.dependency 'lottie-ios', '4.4.3'
|
|
13
|
-
|
|
14
13
|
if !Dir.exist?('build/cocoapods/framework/kits.framework') || Dir.empty?('build/cocoapods/framework/kits.framework')
|
|
15
14
|
raise "
|
|
16
|
-
|
|
17
15
|
Kotlin framework 'kits' doesn't exist yet, so a proper Xcode project can't be generated.
|
|
18
16
|
'pod install' should be executed after running ':generateDummyFramework' Gradle task:
|
|
19
|
-
|
|
20
17
|
./gradlew :compose:generateDummyFramework
|
|
21
|
-
|
|
22
18
|
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
|
|
23
19
|
end
|
|
24
|
-
|
|
25
20
|
spec.xcconfig = {
|
|
26
21
|
'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
spec.pod_target_xcconfig = {
|
|
30
24
|
'KOTLIN_PROJECT_PATH' => ':compose',
|
|
31
25
|
'PRODUCT_MODULE_NAME' => 'kits',
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
spec.script_phases = [
|
|
35
28
|
{
|
|
36
29
|
:name => 'Build compose',
|
|
@@ -38,8 +31,8 @@ Pod::Spec.new do |spec|
|
|
|
38
31
|
:shell_path => '/bin/sh',
|
|
39
32
|
:script => <<-SCRIPT
|
|
40
33
|
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
|
|
35
|
+
exit 0
|
|
43
36
|
fi
|
|
44
37
|
set -ev
|
|
45
38
|
REPO_ROOT="$PODS_TARGET_SRCROOT"
|
|
@@ -51,4 +44,4 @@ Pod::Spec.new do |spec|
|
|
|
51
44
|
}
|
|
52
45
|
]
|
|
53
46
|
spec.resources = ['build/compose/cocoapods/compose-resources']
|
|
54
|
-
end
|
|
47
|
+
end
|
|
@@ -18,9 +18,9 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
18
18
|
import androidx.compose.foundation.layout.height
|
|
19
19
|
import androidx.compose.foundation.layout.ime
|
|
20
20
|
import androidx.compose.foundation.layout.imePadding
|
|
21
|
+
import androidx.compose.foundation.layout.navigationBars
|
|
21
22
|
import androidx.compose.foundation.layout.offset
|
|
22
23
|
import androidx.compose.foundation.layout.padding
|
|
23
|
-
import androidx.compose.foundation.layout.systemBars
|
|
24
24
|
import androidx.compose.foundation.rememberScrollState
|
|
25
25
|
import androidx.compose.foundation.verticalScroll
|
|
26
26
|
import androidx.compose.runtime.Composable
|
|
@@ -43,7 +43,6 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
|
43
43
|
import androidx.compose.ui.unit.Dp
|
|
44
44
|
import androidx.compose.ui.unit.IntOffset
|
|
45
45
|
import androidx.compose.ui.unit.dp
|
|
46
|
-
import androidx.compose.ui.unit.min
|
|
47
46
|
import androidx.compose.ui.zIndex
|
|
48
47
|
import kotlinx.coroutines.CoroutineScope
|
|
49
48
|
import kotlinx.coroutines.Dispatchers
|
|
@@ -103,8 +102,8 @@ fun Screen(
|
|
|
103
102
|
val keyboardController = LocalSoftwareKeyboardController.current
|
|
104
103
|
|
|
105
104
|
val isKeyboardVisible = isKeyboardVisible()
|
|
106
|
-
val indicator =
|
|
107
|
-
val bottomPadding =
|
|
105
|
+
val indicator = getAppStatusBarHeight()
|
|
106
|
+
val bottomPadding = if (isKeyboardVisible) 0.dp else indicator
|
|
108
107
|
|
|
109
108
|
val headerHeight = if (animatedHeader !== null)
|
|
110
109
|
with(LocalDensity.current) { layoutOffset.roundToPx() }
|
|
@@ -343,7 +342,7 @@ fun ScreenSnackBarHost(footerHeightPx: Int) {
|
|
|
343
342
|
footerHeightPx
|
|
344
343
|
} else {
|
|
345
344
|
with(density) {
|
|
346
|
-
|
|
345
|
+
navigationBar.toPx()
|
|
347
346
|
}
|
|
348
347
|
}.toInt()
|
|
349
348
|
|
|
@@ -401,4 +400,3 @@ fun ScreenSnackBarHost(footerHeightPx: Int) {
|
|
|
401
400
|
|
|
402
401
|
|
|
403
402
|
|
|
404
|
-
|
|
@@ -1,41 +1,18 @@
|
|
|
1
1
|
package vn.momo.kits.navigation
|
|
2
2
|
|
|
3
|
+
import androidx.compose.animation.*
|
|
3
4
|
import androidx.compose.animation.core.tween
|
|
4
|
-
import androidx.compose.
|
|
5
|
-
import androidx.compose.animation.slideInHorizontally
|
|
6
|
-
import androidx.compose.animation.slideInVertically
|
|
7
|
-
import androidx.compose.animation.slideOutHorizontally
|
|
8
|
-
import androidx.compose.animation.slideOutVertically
|
|
9
|
-
import androidx.compose.foundation.layout.WindowInsets
|
|
10
|
-
import androidx.compose.foundation.layout.asPaddingValues
|
|
11
|
-
import androidx.compose.foundation.layout.systemBars
|
|
12
|
-
import androidx.compose.runtime.Composable
|
|
13
|
-
import androidx.compose.runtime.CompositionLocalProvider
|
|
14
|
-
import androidx.compose.runtime.DisposableEffect
|
|
15
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
16
|
-
import androidx.compose.runtime.mutableStateOf
|
|
17
|
-
import androidx.compose.runtime.remember
|
|
18
|
-
import androidx.compose.runtime.staticCompositionLocalOf
|
|
5
|
+
import androidx.compose.runtime.*
|
|
19
6
|
import androidx.compose.ui.unit.Dp
|
|
20
|
-
import androidx.compose.ui.unit.dp
|
|
21
7
|
import androidx.navigation.compose.NavHost
|
|
22
8
|
import androidx.navigation.compose.composable
|
|
23
9
|
import androidx.navigation.compose.rememberNavController
|
|
24
10
|
import androidx.navigation.toRoute
|
|
25
|
-
import vn.momo.kits.application
|
|
26
|
-
import vn.momo.kits.
|
|
27
|
-
import vn.momo.kits.application.ApplicationContext
|
|
28
|
-
import vn.momo.kits.application.KitConfig
|
|
29
|
-
import vn.momo.kits.application.MiniAppContext
|
|
30
|
-
import vn.momo.kits.application.ScaleSizeMaxRate
|
|
31
|
-
import vn.momo.kits.const.AppNavigationBar
|
|
32
|
-
import vn.momo.kits.const.AppStatusBar
|
|
33
|
-
import vn.momo.kits.const.AppTheme
|
|
34
|
-
import vn.momo.kits.const.Theme
|
|
35
|
-
import vn.momo.kits.const.ThemeAssets
|
|
36
|
-
import vn.momo.kits.const.defaultTheme
|
|
11
|
+
import vn.momo.kits.application.*
|
|
12
|
+
import vn.momo.kits.const.*
|
|
37
13
|
import vn.momo.kits.platform.ProvideNavigationEventDispatcherOwner
|
|
38
14
|
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
15
|
+
import vn.momo.kits.utils.getNavigationBarHeight
|
|
39
16
|
import vn.momo.maxapi.IMaxApi
|
|
40
17
|
|
|
41
18
|
@Composable
|
|
@@ -54,11 +31,7 @@ fun NavigationContainer(
|
|
|
54
31
|
val navController = rememberNavController()
|
|
55
32
|
val navigator = remember { Navigator(navController = navController, maxApi = maxApi) }
|
|
56
33
|
val statusBarHeight = statusBarHeight ?: getAppStatusBarHeight()
|
|
57
|
-
val navigationBarHeight =
|
|
58
|
-
WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
59
|
-
} else {
|
|
60
|
-
AppNavigationBar.current
|
|
61
|
-
}
|
|
34
|
+
val navigationBarHeight = getNavigationBarHeight()
|
|
62
35
|
|
|
63
36
|
val parentContext = ApplicationContext.current
|
|
64
37
|
val mergedContext = MiniAppContext.merge(parentContext, applicationContext)
|
|
@@ -289,7 +289,7 @@ fun FooterContent(){
|
|
|
289
289
|
val imeBottom = ime.getBottom(density)
|
|
290
290
|
val thresholdPx = with(density) { 50.dp.toPx() }
|
|
291
291
|
val isKeyboardVisible = imeBottom > thresholdPx
|
|
292
|
-
val bottomPadding =
|
|
292
|
+
val bottomPadding = if (isKeyboardVisible) 0.dp else AppNavigationBar.current
|
|
293
293
|
Footer(footerComponent = options.footerComponent, bottomPadding = bottomPadding)
|
|
294
294
|
}
|
|
295
295
|
}
|
|
@@ -18,7 +18,6 @@ import androidx.compose.runtime.LaunchedEffect
|
|
|
18
18
|
import androidx.compose.ui.Alignment
|
|
19
19
|
import androidx.compose.ui.Modifier
|
|
20
20
|
import androidx.compose.ui.unit.dp
|
|
21
|
-
import androidx.compose.ui.unit.min
|
|
22
21
|
import androidx.navigation.compose.NavHost
|
|
23
22
|
import androidx.navigation.compose.composable
|
|
24
23
|
import androidx.navigation.compose.rememberNavController
|
|
@@ -139,7 +138,7 @@ fun BottomTab(
|
|
|
139
138
|
}
|
|
140
139
|
}
|
|
141
140
|
)
|
|
142
|
-
Spacer(modifier = Modifier.fillMaxWidth().height(
|
|
141
|
+
Spacer(modifier = Modifier.fillMaxWidth().height(AppNavigationBar.current + Spacing.S).background(AppTheme.current.colors.background.surface))
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
}
|
|
@@ -19,7 +19,6 @@ import androidx.compose.ui.layout.onGloballyPositioned
|
|
|
19
19
|
import androidx.compose.ui.platform.LocalDensity
|
|
20
20
|
import androidx.compose.ui.unit.IntOffset
|
|
21
21
|
import androidx.compose.ui.unit.dp
|
|
22
|
-
import androidx.compose.ui.unit.min
|
|
23
22
|
import kotlinx.coroutines.delay
|
|
24
23
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
25
24
|
import vn.momo.kits.const.Colors
|
|
@@ -56,7 +55,7 @@ fun SnackBar(
|
|
|
56
55
|
val footerHeight = if (options.footerComponent != null) {
|
|
57
56
|
footerHeightPxState.value
|
|
58
57
|
} else {
|
|
59
|
-
with(density){
|
|
58
|
+
with(density){ navigationBar.toPx() }
|
|
60
59
|
}.toInt()
|
|
61
60
|
|
|
62
61
|
var startPosition by remember { mutableStateOf(Float.MAX_VALUE) }
|
|
@@ -129,4 +128,4 @@ fun SnackBar(
|
|
|
129
128
|
is SnackBar.Toast -> {}
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
|
-
}
|
|
131
|
+
}
|
|
@@ -12,7 +12,10 @@ import androidx.compose.ui.graphics.Color
|
|
|
12
12
|
import androidx.compose.ui.platform.LocalDensity
|
|
13
13
|
import androidx.compose.ui.unit.Dp
|
|
14
14
|
import androidx.compose.ui.unit.dp
|
|
15
|
+
import androidx.compose.ui.unit.min
|
|
16
|
+
import vn.momo.kits.const.AppNavigationBar
|
|
15
17
|
import vn.momo.kits.const.AppStatusBar
|
|
18
|
+
import vn.momo.kits.platform.getPlatformName
|
|
16
19
|
import kotlin.math.abs
|
|
17
20
|
|
|
18
21
|
|
|
@@ -86,3 +89,17 @@ fun getAppStatusBarHeight(): Dp {
|
|
|
86
89
|
AppStatusBar.current
|
|
87
90
|
}
|
|
88
91
|
}
|
|
92
|
+
|
|
93
|
+
@Composable
|
|
94
|
+
fun getNavigationBarHeight(): Dp {
|
|
95
|
+
return if (AppNavigationBar.current == 0.dp) {
|
|
96
|
+
val systemBottomPadding = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
|
|
97
|
+
if (getPlatformName() == "iOS") {
|
|
98
|
+
min(systemBottomPadding, 21.dp)
|
|
99
|
+
} else {
|
|
100
|
+
systemBottomPadding
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
AppNavigationBar.current
|
|
104
|
+
}
|
|
105
|
+
}
|
package/gradle.properties
CHANGED
|
@@ -2,7 +2,7 @@ import SwiftUI
|
|
|
2
2
|
|
|
3
3
|
public func scaleSize(_ size: CGFloat, _ scaleRate: CGFloat? = nil) -> CGFloat {
|
|
4
4
|
let defaultScreenSize: CGFloat = 375
|
|
5
|
-
let maxFontScale: CGFloat = scaleRate ?? 1.
|
|
5
|
+
let maxFontScale: CGFloat = scaleRate ?? 1.5
|
|
6
6
|
let maxDeviceScale: CGFloat = 5
|
|
7
7
|
|
|
8
8
|
let deviceWidth = UIScreen.main.bounds.width
|