@momo-kits/native-kits 0.158.1-test.4-debug → 0.159.1-beta.10-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/compose.podspec +11 -4
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +8 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +4 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +4 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +2 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +70 -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 +2 -1
- package/gradle.properties +1 -1
- package/ios/Typography/Text.swift +11 -11
- package/package.json +1 -1
- package/.claude/settings.local.json +0 -21
- package/local.properties +0 -8
package/compose/build.gradle.kts
CHANGED
|
@@ -40,7 +40,7 @@ kotlin {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
cocoapods {
|
|
43
|
-
version = "0.
|
|
43
|
+
version = "0.159.1-beta.10-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
|
-
|
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.157.1-beta.3'
|
|
4
4
|
spec.homepage = 'https://momo.vn'
|
|
5
5
|
spec.source = { :http=> ''}
|
|
6
6
|
spec.authors = ''
|
|
@@ -10,20 +10,27 @@ 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
|
+
|
|
13
14
|
if !Dir.exist?('build/cocoapods/framework/kits.framework') || Dir.empty?('build/cocoapods/framework/kits.framework')
|
|
14
15
|
raise "
|
|
16
|
+
|
|
15
17
|
Kotlin framework 'kits' doesn't exist yet, so a proper Xcode project can't be generated.
|
|
16
18
|
'pod install' should be executed after running ':generateDummyFramework' Gradle task:
|
|
19
|
+
|
|
17
20
|
./gradlew :compose:generateDummyFramework
|
|
21
|
+
|
|
18
22
|
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
|
|
19
23
|
end
|
|
24
|
+
|
|
20
25
|
spec.xcconfig = {
|
|
21
26
|
'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
|
|
22
27
|
}
|
|
28
|
+
|
|
23
29
|
spec.pod_target_xcconfig = {
|
|
24
30
|
'KOTLIN_PROJECT_PATH' => ':compose',
|
|
25
31
|
'PRODUCT_MODULE_NAME' => 'kits',
|
|
26
32
|
}
|
|
33
|
+
|
|
27
34
|
spec.script_phases = [
|
|
28
35
|
{
|
|
29
36
|
:name => 'Build compose',
|
|
@@ -31,8 +38,8 @@ Pod::Spec.new do |spec|
|
|
|
31
38
|
:shell_path => '/bin/sh',
|
|
32
39
|
:script => <<-SCRIPT
|
|
33
40
|
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
|
|
42
|
+
exit 0
|
|
36
43
|
fi
|
|
37
44
|
set -ev
|
|
38
45
|
REPO_ROOT="$PODS_TARGET_SRCROOT"
|
|
@@ -44,4 +51,4 @@ Pod::Spec.new do |spec|
|
|
|
44
51
|
}
|
|
45
52
|
]
|
|
46
53
|
spec.resources = ['build/compose/cocoapods/compose-resources']
|
|
47
|
-
end
|
|
54
|
+
end
|
|
@@ -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
|
+
}
|
|
@@ -28,6 +28,7 @@ data class MiniAppContext(
|
|
|
28
28
|
val providerId: String = "",
|
|
29
29
|
val permissions: List<Map<String, Any>>? = emptyList(),
|
|
30
30
|
val features: FeatureFlags? = null,
|
|
31
|
+
val scaleSizeMaxRate: Float? = null,
|
|
31
32
|
) {
|
|
32
33
|
companion object {
|
|
33
34
|
|
|
@@ -58,7 +59,8 @@ data class MiniAppContext(
|
|
|
58
59
|
toolkitConfig = mergeMaps(parent.toolkitConfig, child.toolkitConfig),
|
|
59
60
|
providerId = parent.providerId.ifBlank { child.providerId },
|
|
60
61
|
permissions = if (!parent.permissions.isNullOrEmpty()) parent.permissions else child.permissions,
|
|
61
|
-
features = mergeFeatureFlags(parent.features, child.features)
|
|
62
|
+
features = mergeFeatureFlags(parent.features, child.features),
|
|
63
|
+
scaleSizeMaxRate = parent.scaleSizeMaxRate ?: child.scaleSizeMaxRate,
|
|
62
64
|
)
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -104,4 +106,4 @@ val LocalComponentInformation = staticCompositionLocalOf<ComponentInformation?>
|
|
|
104
106
|
null
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
|
|
@@ -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
|
-
|
|
@@ -305,7 +305,7 @@ fun Input(
|
|
|
305
305
|
visualTransformation = visualTransformation,
|
|
306
306
|
keyboardOptions = keyboardOptionsConfig,
|
|
307
307
|
modifier = inputModifier
|
|
308
|
-
.height(scaleSize(size.values.height.value
|
|
308
|
+
.height(scaleSize(size.values.height.value).dp)
|
|
309
309
|
.onFocusChanged { focusState ->
|
|
310
310
|
val wasFocused = inputState.isFocused
|
|
311
311
|
inputState = inputState.copy(
|
|
@@ -445,4 +445,4 @@ fun Input(
|
|
|
445
445
|
// Error/hint display
|
|
446
446
|
ErrorView(error, errorSpacing, hintText)
|
|
447
447
|
}
|
|
448
|
-
}
|
|
448
|
+
}
|
|
@@ -128,7 +128,7 @@ fun InputPhoneNumber(
|
|
|
128
128
|
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
|
|
129
129
|
cursorBrush = SolidColor(AppTheme.current.colors.primary),
|
|
130
130
|
modifier = inputModifier
|
|
131
|
-
.height(scaleSize(size.values.height.value
|
|
131
|
+
.height(scaleSize(size.values.height.value).dp)
|
|
132
132
|
.onFocusChanged { focusState ->
|
|
133
133
|
val wasFocused = inputState.isFocused
|
|
134
134
|
inputState = inputState.copy(
|
|
@@ -230,4 +230,4 @@ fun InputPhoneNumber(
|
|
|
230
230
|
// Error/hint display
|
|
231
231
|
ErrorView(error, errorSpacing, hintText)
|
|
232
232
|
}
|
|
233
|
-
}
|
|
233
|
+
}
|
|
@@ -33,12 +33,12 @@ import kotlin.math.max
|
|
|
33
33
|
import kotlin.math.min
|
|
34
34
|
|
|
35
35
|
const val DEFAULT_SCREEN_SIZE = 375f
|
|
36
|
-
const val MAX_FONT_SCALE = 1.
|
|
36
|
+
const val MAX_FONT_SCALE = 1.2f
|
|
37
37
|
const val MAX_DEVICE_SCALE = 5
|
|
38
38
|
|
|
39
39
|
@Composable
|
|
40
|
-
fun scaleSize(size: Float
|
|
41
|
-
val scaleSizeMaxRate: Float =
|
|
40
|
+
fun scaleSize(size: Float): Float {
|
|
41
|
+
val scaleSizeMaxRate: Float = ScaleSizeMaxRate.current ?: MAX_FONT_SCALE
|
|
42
42
|
val deviceWidth = getScreenDimensions().width
|
|
43
43
|
val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
|
|
44
44
|
|
|
@@ -77,7 +77,7 @@ fun scaleSize(size: TextUnit): TextUnit {
|
|
|
77
77
|
|
|
78
78
|
@Composable
|
|
79
79
|
fun scaleSize(size: Dp): Dp {
|
|
80
|
-
return scaleSize(size.value).
|
|
80
|
+
return scaleSize(size.value).dp
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
@Composable
|
|
@@ -9,7 +9,7 @@ import androidx.compose.ui.semantics.semantics
|
|
|
9
9
|
import androidx.compose.ui.semantics.testTag
|
|
10
10
|
import vn.momo.kits.platform.getPlatformName
|
|
11
11
|
|
|
12
|
-
fun Modifier.setAutomationId(accessibilityId: String,
|
|
12
|
+
fun Modifier.setAutomationId(accessibilityId: String, mergeDescendants: Boolean = false): Modifier {
|
|
13
13
|
return if (getPlatformName() == "Android") {
|
|
14
14
|
semantics {
|
|
15
15
|
contentDescription = accessibilityId
|
|
@@ -17,10 +17,8 @@ fun Modifier.setAutomationId(accessibilityId: String, label: String? = null, mer
|
|
|
17
17
|
} else {
|
|
18
18
|
semantics(mergeDescendants = mergeDescendants) {
|
|
19
19
|
testTag = accessibilityId
|
|
20
|
-
contentDescription = label ?: accessibilityId
|
|
21
20
|
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
21
|
+
}}
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* Alternative for [setAutomationId]
|
|
@@ -27,12 +27,14 @@ import vn.momo.kits.application.AppLanguage
|
|
|
27
27
|
import vn.momo.kits.application.ApplicationContext
|
|
28
28
|
import vn.momo.kits.application.KitConfig
|
|
29
29
|
import vn.momo.kits.application.MiniAppContext
|
|
30
|
+
import vn.momo.kits.application.ScaleSizeMaxRate
|
|
30
31
|
import vn.momo.kits.const.AppNavigationBar
|
|
31
32
|
import vn.momo.kits.const.AppStatusBar
|
|
32
33
|
import vn.momo.kits.const.AppTheme
|
|
33
34
|
import vn.momo.kits.const.Theme
|
|
34
35
|
import vn.momo.kits.const.ThemeAssets
|
|
35
36
|
import vn.momo.kits.const.defaultTheme
|
|
37
|
+
import vn.momo.kits.platform.ProvideNavigationEventDispatcherOwner
|
|
36
38
|
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
37
39
|
import vn.momo.maxapi.IMaxApi
|
|
38
40
|
|
|
@@ -76,76 +78,79 @@ fun NavigationContainer(
|
|
|
76
78
|
|
|
77
79
|
val startDestination = DynamicScreenRegistry.register(initialScreenName, initialScreen, options)
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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,
|
|
92
|
+
) {
|
|
93
|
+
LaunchedEffect(Unit) {
|
|
94
|
+
setNavigator?.invoke(navigator)
|
|
95
|
+
}
|
|
92
96
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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)
|
|
112
116
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
if (screen != null) {
|
|
118
|
+
StackScreen(
|
|
119
|
+
id = route.id,
|
|
120
|
+
name = screen.name,
|
|
121
|
+
content = screen.content,
|
|
122
|
+
navigationOptions = screen.options
|
|
123
|
+
)
|
|
124
|
+
}
|
|
120
125
|
}
|
|
121
|
-
}
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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)
|
|
141
145
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
if (screen != null) {
|
|
147
|
+
StackScreen(
|
|
148
|
+
id = route.id,
|
|
149
|
+
name = screen.name,
|
|
150
|
+
content = screen.content,
|
|
151
|
+
navigationOptions = screen.options
|
|
152
|
+
)
|
|
153
|
+
}
|
|
149
154
|
}
|
|
150
155
|
}
|
|
151
156
|
}
|
|
@@ -161,4 +166,3 @@ fun NavigationContainer(
|
|
|
161
166
|
val LocalMaxApi = staticCompositionLocalOf<IMaxApi?> {
|
|
162
167
|
error("No MaxApi provided")
|
|
163
168
|
}
|
|
164
|
-
|
|
@@ -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
|
+
}
|
|
@@ -18,7 +18,7 @@ androidx-appcompat = "1.7.0"
|
|
|
18
18
|
material = "1.10.0"
|
|
19
19
|
maxapi = "0.1.1"
|
|
20
20
|
vanniktechMavenPublish = "0.34.0"
|
|
21
|
-
kits = "0.
|
|
21
|
+
kits = "0.159.1-beta.7"
|
|
22
22
|
nativemaxapi = "0.0.6"
|
|
23
23
|
|
|
24
24
|
[libraries]
|
|
@@ -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
|
@@ -2,28 +2,28 @@ 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.2
|
|
6
6
|
let maxDeviceScale: CGFloat = 5
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
let deviceWidth = UIScreen.main.bounds.width
|
|
9
9
|
let deviceScale = deviceWidth / defaultScreenSize
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
|
|
12
12
|
let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
|
|
13
13
|
let fontScale = scaledFont.pointSize / defaultFont.pointSize
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
var fontSizeDeviceScale = size
|
|
16
16
|
var fontSizeOSScale = size
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
19
|
if deviceScale > 1 {
|
|
20
20
|
fontSizeDeviceScale = min(fontSizeDeviceScale * deviceScale, fontSizeDeviceScale + maxDeviceScale)
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
if fontScale > 1 {
|
|
24
24
|
fontSizeOSScale = min(fontSizeOSScale * fontScale, fontSizeOSScale * maxFontScale)
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
return max(fontSizeDeviceScale, fontSizeOSScale)
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -118,7 +118,7 @@ public struct MomoText: View {
|
|
|
118
118
|
private let content: String
|
|
119
119
|
private let typography: TypographyStyle
|
|
120
120
|
private let color: Color
|
|
121
|
-
|
|
121
|
+
|
|
122
122
|
public init(
|
|
123
123
|
_ content: String,
|
|
124
124
|
typography: TypographyStyle = .bodyDefaultRegular,
|
|
@@ -128,13 +128,13 @@ public struct MomoText: View {
|
|
|
128
128
|
self.typography = typography
|
|
129
129
|
self.color = color
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
public var body: some View {
|
|
133
133
|
let text = SwiftUI.Text(content)
|
|
134
134
|
.font(.system(size: scaleSize(typography.fontSize), weight: typography.fontWeight))
|
|
135
135
|
.foregroundColor(color)
|
|
136
136
|
.lineSpacing(scaleSize(typography.lineHeight) - scaleSize(typography.fontSize))
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
return text
|
|
139
139
|
}
|
|
140
140
|
}
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(yarn react-native:*)",
|
|
5
|
-
"Bash(./gradlew *)",
|
|
6
|
-
"Bash(git *)",
|
|
7
|
-
"Bash(ls *)",
|
|
8
|
-
"Bash(mkdir *)",
|
|
9
|
-
"Bash(rm *)",
|
|
10
|
-
"Bash(cp *)",
|
|
11
|
-
"Bash(mv *)",
|
|
12
|
-
"Bash(cat *)",
|
|
13
|
-
"Bash(find *)",
|
|
14
|
-
"Bash(grep *)",
|
|
15
|
-
"Bash(cd *)",
|
|
16
|
-
"Read(//Users/phuc/momo-native-kits/**)",
|
|
17
|
-
"Edit(//Users/phuc/momo-native-kits/**)",
|
|
18
|
-
"Write(//Users/phuc/momo-native-kits/**)"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
}
|
package/local.properties
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
-
# as it contains information specific to your local configuration.
|
|
3
|
-
#
|
|
4
|
-
# Location of the SDK. This is only used by Gradle.
|
|
5
|
-
# For customization when using a Version Control System, please read the
|
|
6
|
-
# header note.
|
|
7
|
-
#Thu Oct 02 17:53:13 ICT 2025
|
|
8
|
-
sdk.dir=/Users/phuc/Library/Android/sdk
|