@momo-kits/native-kits 0.161.3-beta.1-debug → 0.162.0-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/build.gradle.kts.backup +59 -59
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +8 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +24 -30
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +4 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +10 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +27 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +1 -28
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +11 -1
- package/gradle/libs.versions.toml +10 -3
- package/gradle.properties +1 -1
- package/ios/Application/ApplicationEnvironment.swift +2 -6
- package/ios/Input/Input.swift +19 -19
- package/ios/Input/InputPhoneNumber.swift +17 -17
- package/ios/Typography/Text.swift +19 -14
- package/ios/Typography/Typography.swift +22 -1
- package/package.json +1 -1
- package/publish.sh +136 -73
package/compose/build.gradle.kts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import com.vanniktech.maven.publish.JavadocJar
|
|
2
|
-
import com.vanniktech.maven.publish.KotlinMultiplatform
|
|
1
|
+
// import com.vanniktech.maven.publish.JavadocJar
|
|
2
|
+
// import com.vanniktech.maven.publish.KotlinMultiplatform
|
|
3
3
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
4
4
|
|
|
5
5
|
plugins {
|
|
@@ -7,7 +7,7 @@ plugins {
|
|
|
7
7
|
alias(libs.plugins.android.library)
|
|
8
8
|
alias(libs.plugins.compose)
|
|
9
9
|
alias(libs.plugins.kotlin.compose.compiler)
|
|
10
|
-
|
|
10
|
+
// alias(libs.plugins.vanniktech.mavenPublish)
|
|
11
11
|
id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
|
|
12
12
|
kotlin("plugin.serialization")
|
|
13
13
|
}
|
|
@@ -40,7 +40,7 @@ kotlin {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
cocoapods {
|
|
43
|
-
version =
|
|
43
|
+
version = "0.161.0-debug"
|
|
44
44
|
summary = "IOS Shared module"
|
|
45
45
|
homepage = "https://momo.vn"
|
|
46
46
|
ios.deploymentTarget = "15.0"
|
|
@@ -86,14 +86,14 @@ kotlin {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
android {
|
|
89
|
-
namespace = "
|
|
90
|
-
compileSdk =
|
|
89
|
+
namespace = "vn.momo.kits.kits"
|
|
90
|
+
compileSdk = 35
|
|
91
91
|
compileOptions {
|
|
92
92
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
93
93
|
targetCompatibility = JavaVersion.VERSION_17
|
|
94
94
|
}
|
|
95
95
|
defaultConfig {
|
|
96
|
-
minSdk =
|
|
96
|
+
minSdk = 24
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -132,55 +132,55 @@ compose {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
publishing {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
mavenPublishing {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
135
|
+
// publishing {
|
|
136
|
+
// repositories {
|
|
137
|
+
// maven {
|
|
138
|
+
// name = "${gitlabRepo}Packages"
|
|
139
|
+
// credentials {
|
|
140
|
+
// username = gitlabUser
|
|
141
|
+
// password = gitlabKey
|
|
142
|
+
// }
|
|
143
|
+
// url = uri("$gitlabUrl")
|
|
144
|
+
// }
|
|
145
|
+
// }
|
|
146
|
+
// }
|
|
147
|
+
|
|
148
|
+
// mavenPublishing {
|
|
149
|
+
// configure(
|
|
150
|
+
// KotlinMultiplatform(
|
|
151
|
+
// javadocJar = JavadocJar.Empty(),
|
|
152
|
+
// sourcesJar = true,
|
|
153
|
+
// androidVariantsToPublish = listOf("release")
|
|
154
|
+
// )
|
|
155
|
+
// )
|
|
156
|
+
//
|
|
157
|
+
// repositories {
|
|
158
|
+
// maven {
|
|
159
|
+
// name = "${gitlabRepo}Packages"
|
|
160
|
+
// credentials { username = gitlabUser; password = gitlabKey }
|
|
161
|
+
// url = uri("$gitlabUrl")
|
|
162
|
+
// }
|
|
163
|
+
// }
|
|
164
|
+
//
|
|
165
|
+
// coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
|
|
166
|
+
//
|
|
167
|
+
// pom {
|
|
168
|
+
// name = "$gitlabName Klib"
|
|
169
|
+
// description = "$gitlabName"
|
|
170
|
+
// url = "https://gitlab.mservice.com.vn"
|
|
171
|
+
// licenses {
|
|
172
|
+
// license {
|
|
173
|
+
// name = "The Apache License, Version 2.0"
|
|
174
|
+
// url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
175
|
+
// distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
176
|
+
// }
|
|
177
|
+
// }
|
|
178
|
+
// developers {
|
|
179
|
+
// developer {
|
|
180
|
+
// id = "kotlin-hands-on"
|
|
181
|
+
// name = "Kotlin Developer Advocate"
|
|
182
|
+
// url = "https://github.com/kotlin-hands-on/"
|
|
183
|
+
// }
|
|
184
|
+
// }
|
|
185
|
+
// }
|
|
186
|
+
// }
|
package/compose/compose.podspec
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
package vn.momo.kits.application
|
|
2
2
|
|
|
3
3
|
import androidx.compose.runtime.Immutable
|
|
4
|
-
import androidx.compose.runtime.mutableStateOf
|
|
5
4
|
import androidx.compose.runtime.staticCompositionLocalOf
|
|
6
5
|
import vn.momo.kits.components.TrustBannerData
|
|
7
6
|
|
|
8
7
|
@Immutable
|
|
9
8
|
data class FeatureFlags(
|
|
10
|
-
val
|
|
11
|
-
val isWhiteList: Boolean? = false,
|
|
12
|
-
val allowFontScale: Boolean? = true,
|
|
9
|
+
val showBaseLineDebug: Boolean? = false,
|
|
13
10
|
)
|
|
14
11
|
|
|
15
12
|
@Immutable
|
|
@@ -31,6 +28,7 @@ data class MiniAppContext(
|
|
|
31
28
|
val providerId: String = "",
|
|
32
29
|
val permissions: List<Map<String, Any>>? = emptyList(),
|
|
33
30
|
val features: FeatureFlags? = null,
|
|
31
|
+
val scaleSizeMaxRate: Float? = null,
|
|
34
32
|
) {
|
|
35
33
|
companion object {
|
|
36
34
|
|
|
@@ -62,6 +60,7 @@ data class MiniAppContext(
|
|
|
62
60
|
providerId = parent.providerId.ifBlank { child.providerId },
|
|
63
61
|
permissions = if (!parent.permissions.isNullOrEmpty()) parent.permissions else child.permissions,
|
|
64
62
|
features = mergeFeatureFlags(parent.features, child.features),
|
|
63
|
+
scaleSizeMaxRate = parent.scaleSizeMaxRate ?: child.scaleSizeMaxRate,
|
|
65
64
|
)
|
|
66
65
|
}
|
|
67
66
|
|
|
@@ -75,7 +74,7 @@ data class MiniAppContext(
|
|
|
75
74
|
if (child == null) return parent
|
|
76
75
|
|
|
77
76
|
return FeatureFlags(
|
|
78
|
-
|
|
77
|
+
showBaseLineDebug = parent.showBaseLineDebug ?: child.showBaseLineDebug
|
|
79
78
|
)
|
|
80
79
|
}
|
|
81
80
|
}
|
|
@@ -89,19 +88,12 @@ data class ComponentInformation(
|
|
|
89
88
|
val action: String? = null
|
|
90
89
|
)
|
|
91
90
|
|
|
91
|
+
var IsShowBaseLineDebug = false
|
|
92
|
+
|
|
92
93
|
val ApplicationContext = staticCompositionLocalOf<MiniAppContext?> {
|
|
93
94
|
null
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
var IsShowBaseLineDebug = false
|
|
97
|
-
|
|
98
|
-
private val UseFontScaleSystemState = mutableStateOf(true)
|
|
99
|
-
var UseFontScaleSystem: Boolean
|
|
100
|
-
get() = UseFontScaleSystemState.value
|
|
101
|
-
set(value) {
|
|
102
|
-
UseFontScaleSystemState.value = value
|
|
103
|
-
}
|
|
104
|
-
|
|
105
97
|
val AppConfig = staticCompositionLocalOf<KitConfig?> {
|
|
106
98
|
null
|
|
107
99
|
}
|
|
@@ -113,3 +105,5 @@ val AppLanguage = staticCompositionLocalOf<String?> {
|
|
|
113
105
|
val LocalComponentInformation = staticCompositionLocalOf<ComponentInformation?> {
|
|
114
106
|
null
|
|
115
107
|
}
|
|
108
|
+
|
|
109
|
+
val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
|
|
@@ -38,6 +38,7 @@ import androidx.compose.runtime.produceState
|
|
|
38
38
|
import androidx.compose.runtime.remember
|
|
39
39
|
import androidx.compose.runtime.rememberUpdatedState
|
|
40
40
|
import androidx.compose.runtime.snapshotFlow
|
|
41
|
+
import androidx.compose.runtime.staticCompositionLocalOf
|
|
41
42
|
import androidx.compose.ui.Alignment
|
|
42
43
|
import androidx.compose.ui.Modifier
|
|
43
44
|
import androidx.compose.ui.composed
|
|
@@ -48,6 +49,7 @@ import androidx.compose.ui.geometry.Offset
|
|
|
48
49
|
import androidx.compose.ui.geometry.Rect
|
|
49
50
|
import androidx.compose.ui.graphics.Brush
|
|
50
51
|
import androidx.compose.ui.graphics.Color
|
|
52
|
+
import androidx.compose.ui.graphics.SolidColor
|
|
51
53
|
import androidx.compose.ui.graphics.graphicsLayer
|
|
52
54
|
import androidx.compose.ui.input.pointer.pointerInput
|
|
53
55
|
import androidx.compose.ui.layout.Layout
|
|
@@ -60,19 +62,15 @@ import androidx.compose.ui.layout.layoutId
|
|
|
60
62
|
import androidx.compose.ui.platform.LocalDensity
|
|
61
63
|
import androidx.compose.ui.platform.LocalFocusManager
|
|
62
64
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
63
|
-
import androidx.compose.ui.text.style.TextOverflow
|
|
64
65
|
import androidx.compose.ui.text.TextStyle
|
|
66
|
+
import androidx.compose.ui.text.style.TextOverflow
|
|
65
67
|
import androidx.compose.ui.unit.Constraints
|
|
66
68
|
import androidx.compose.ui.unit.Dp
|
|
67
69
|
import androidx.compose.ui.unit.IntOffset
|
|
68
70
|
import androidx.compose.ui.unit.LayoutDirection
|
|
69
71
|
import androidx.compose.ui.unit.dp
|
|
70
|
-
import androidx.compose.ui.unit.sp
|
|
71
|
-
import androidx.compose.runtime.staticCompositionLocalOf
|
|
72
|
-
import androidx.compose.ui.graphics.Color.Companion
|
|
73
|
-
import androidx.compose.ui.graphics.SolidColor
|
|
74
72
|
import androidx.compose.ui.unit.lerp
|
|
75
|
-
import
|
|
73
|
+
import androidx.compose.ui.unit.sp
|
|
76
74
|
import kotlinx.coroutines.flow.collectLatest
|
|
77
75
|
import kotlinx.coroutines.flow.mapNotNull
|
|
78
76
|
import vn.momo.kits.components.Icon
|
|
@@ -81,11 +79,11 @@ import vn.momo.kits.const.AppTheme
|
|
|
81
79
|
import vn.momo.kits.const.Colors
|
|
82
80
|
import vn.momo.kits.const.Spacing
|
|
83
81
|
import vn.momo.kits.const.Typography
|
|
84
|
-
import vn.momo.kits.modifier.conditional
|
|
85
82
|
import vn.momo.kits.modifier.kitsAutomationId
|
|
86
83
|
import vn.momo.kits.modifier.noFeedbackClickable
|
|
87
84
|
import vn.momo.kits.modifier.setAutomationId
|
|
88
85
|
import vn.momo.kits.modifier.shadow
|
|
86
|
+
import vn.momo.kits.navigation.component.HEADER_HEIGHT
|
|
89
87
|
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
90
88
|
import kotlin.math.max
|
|
91
89
|
import kotlin.math.roundToInt
|
|
@@ -441,6 +439,7 @@ private class LiteScreenLayoutPolicy(
|
|
|
441
439
|
val spacing12 = Spacing.M.roundToPx()
|
|
442
440
|
val spaceBetween = headerSpaceBetween?.roundToPx() ?: spacing12
|
|
443
441
|
val statusBarPx = statusBarHeight.roundToPx()
|
|
442
|
+
val headerRowDefault = HEADER_HEIGHT.dp.roundToPx()
|
|
444
443
|
val scrollPercent = scrollPercentage.value
|
|
445
444
|
|
|
446
445
|
val contentMeasurable = measurables.find { it.layoutId == HeaderId.CONTENT_ID }
|
|
@@ -484,26 +483,20 @@ private class LiteScreenLayoutPolicy(
|
|
|
484
483
|
)
|
|
485
484
|
)
|
|
486
485
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
add(inputSearchPlaceable.safeHeight)
|
|
492
|
-
}
|
|
493
|
-
add(HEADER_HEIGHT.dp.roundToPx())
|
|
494
|
-
if (isHeaderExtend) {
|
|
495
|
-
add(titlePlaceable.safeHeight)
|
|
496
|
-
}
|
|
497
|
-
}.max()
|
|
498
|
-
|
|
499
|
-
var defaultHeight = statusBarPx + spacing12 + firstRowMaxHeight + spacing12
|
|
486
|
+
/**
|
|
487
|
+
* replicate logic from [vn.momo.kits.navigation.component.HeaderBackground]
|
|
488
|
+
* */
|
|
489
|
+
var defaultHeight = statusBarPx + headerRowDefault
|
|
500
490
|
if (isHeaderExtend) {
|
|
501
|
-
defaultHeight
|
|
491
|
+
defaultHeight = 154.dp.roundToPx()
|
|
502
492
|
}
|
|
503
493
|
val headerHeight = when {
|
|
504
494
|
isHeaderNone -> statusBarPx
|
|
505
495
|
!useAnimationSearch && !isHeaderExtend -> defaultHeight
|
|
506
|
-
else ->
|
|
496
|
+
else -> {
|
|
497
|
+
val collapsableSpace = defaultHeight - statusBarPx - headerRowDefault
|
|
498
|
+
(defaultHeight - scrollPercent * collapsableSpace).toInt()
|
|
499
|
+
}
|
|
507
500
|
}
|
|
508
501
|
|
|
509
502
|
val layoutWidth = constraints.maxWidth
|
|
@@ -566,14 +559,14 @@ private class LiteScreenLayoutPolicy(
|
|
|
566
559
|
if (backIconPlaceable != null) {
|
|
567
560
|
backIconPlaceable.place(
|
|
568
561
|
x = startX,
|
|
569
|
-
y = startY + backIconPlaceable.verticalCenterOffset(
|
|
562
|
+
y = startY + backIconPlaceable.verticalCenterOffset(headerRowDefault),
|
|
570
563
|
)
|
|
571
564
|
curX += backIconPlaceable.safeWidth + spaceBetween
|
|
572
565
|
}
|
|
573
566
|
|
|
574
567
|
headerRightPlaceable?.place(
|
|
575
568
|
x = layoutWidth - spacing12 - headerRightPlaceable.safeWidth,
|
|
576
|
-
y = startY + headerRightPlaceable.verticalCenterOffset(
|
|
569
|
+
y = startY + headerRightPlaceable.verticalCenterOffset(headerRowDefault),
|
|
577
570
|
)
|
|
578
571
|
|
|
579
572
|
val titleOffset = IntOffset(
|
|
@@ -582,19 +575,19 @@ private class LiteScreenLayoutPolicy(
|
|
|
582
575
|
space = layoutWidth,
|
|
583
576
|
layoutDirection = layoutDirection,
|
|
584
577
|
),
|
|
585
|
-
y = startY + titlePlaceable.verticalCenterOffset(
|
|
578
|
+
y = startY + titlePlaceable.verticalCenterOffset(headerRowDefault),
|
|
586
579
|
)
|
|
587
580
|
|
|
588
581
|
titlePlaceable?.place(titleOffset)
|
|
589
582
|
|
|
590
583
|
if (backIconPlaceable != null || headerRightPlaceable != null || titlePlaceable != null) {
|
|
591
|
-
curY +=
|
|
584
|
+
curY += headerRowDefault
|
|
592
585
|
}
|
|
593
586
|
|
|
594
587
|
val inputSearchOffset = if (isHeaderExtend) {
|
|
595
|
-
val baseY = curY + inputSearchPlaceable.verticalCenterOffset(
|
|
588
|
+
val baseY = curY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault)
|
|
596
589
|
val y = (baseY * (1 - scrollPercent)).toInt().coerceAtLeast(
|
|
597
|
-
startY + inputSearchPlaceable.verticalCenterOffset(
|
|
590
|
+
startY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault)
|
|
598
591
|
)
|
|
599
592
|
IntOffset(
|
|
600
593
|
x = startX + ((backIconPlaceable.safeWidth + spaceBetween) * (scrollPercent * 2f).coerceIn(
|
|
@@ -605,7 +598,7 @@ private class LiteScreenLayoutPolicy(
|
|
|
605
598
|
} else {
|
|
606
599
|
IntOffset(
|
|
607
600
|
x = curX,
|
|
608
|
-
y = startY + inputSearchPlaceable.verticalCenterOffset(
|
|
601
|
+
y = startY + inputSearchPlaceable.verticalCenterOffset(headerRowDefault),
|
|
609
602
|
)
|
|
610
603
|
}
|
|
611
604
|
val finalPosition = lerp(
|
|
@@ -823,7 +816,8 @@ private fun LiteInputSearch(
|
|
|
823
816
|
if (!placeHolder.isNullOrEmpty()) {
|
|
824
817
|
inputSearchProps.customPlaceHolder?.invoke() ?: Text(
|
|
825
818
|
text = placeHolder ?: "",
|
|
826
|
-
style = inputSearchProps.customTextStyle
|
|
819
|
+
style = inputSearchProps.customTextStyle
|
|
820
|
+
?: Typography.bodyDefaultRegular,
|
|
827
821
|
maxLines = 1,
|
|
828
822
|
color = theme.colors.text.hint,
|
|
829
823
|
overflow = TextOverflow.Ellipsis
|
|
@@ -21,6 +21,10 @@ import androidx.compose.ui.graphics.Color
|
|
|
21
21
|
import androidx.compose.ui.graphics.PathEffect
|
|
22
22
|
import androidx.compose.ui.graphics.StrokeCap
|
|
23
23
|
import androidx.compose.ui.unit.dp
|
|
24
|
+
import io.ktor.util.Platform
|
|
25
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
26
|
+
import vn.momo.kits.const.Colors
|
|
27
|
+
import vn.momo.kits.modifier.conditional
|
|
24
28
|
import vn.momo.kits.platform.getPlatformName
|
|
25
29
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
26
30
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package vn.momo.kits.components
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
|
+
import vn.momo.kits.application.ScaleSizeMaxRate
|
|
6
|
+
|
|
7
|
+
@Composable
|
|
8
|
+
fun ScaleSizeScope(
|
|
9
|
+
scaleSizeMaxRate: Float? = null,
|
|
10
|
+
content: @Composable () -> Unit
|
|
11
|
+
) {
|
|
12
|
+
CompositionLocalProvider(
|
|
13
|
+
ScaleSizeMaxRate provides scaleSizeMaxRate,
|
|
14
|
+
) {
|
|
15
|
+
content()
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package vn.momo.kits.components
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.border
|
|
4
|
+
import androidx.compose.foundation.text.InlineTextContent
|
|
4
5
|
import androidx.compose.runtime.Composable
|
|
5
6
|
import androidx.compose.runtime.remember
|
|
6
7
|
import androidx.compose.ui.Modifier
|
|
@@ -37,8 +38,9 @@ fun Text(
|
|
|
37
38
|
minLines: Int = 1,
|
|
38
39
|
letterSpacing: TextUnit = TextUnit.Unspecified,
|
|
39
40
|
softWrap: Boolean = true,
|
|
40
|
-
accessibilityId: String? = null
|
|
41
|
-
)
|
|
41
|
+
accessibilityId: String? = null,
|
|
42
|
+
inlineContent: Map<String, InlineTextContent> = mapOf(),
|
|
43
|
+
) {
|
|
42
44
|
Text(
|
|
43
45
|
text = AnnotatedString(text),
|
|
44
46
|
color = color,
|
|
@@ -53,7 +55,8 @@ fun Text(
|
|
|
53
55
|
minLines = minLines,
|
|
54
56
|
letterSpacing = letterSpacing,
|
|
55
57
|
softWrap = softWrap,
|
|
56
|
-
accessibilityId = accessibilityId
|
|
58
|
+
accessibilityId = accessibilityId,
|
|
59
|
+
inlineContent = inlineContent
|
|
57
60
|
)
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -73,7 +76,8 @@ fun Text(
|
|
|
73
76
|
minLines: Int = 1,
|
|
74
77
|
letterSpacing: TextUnit = TextUnit.Unspecified,
|
|
75
78
|
softWrap: Boolean = true,
|
|
76
|
-
accessibilityId: String? = null
|
|
79
|
+
accessibilityId: String? = null,
|
|
80
|
+
inlineContent: Map<String, InlineTextContent> = mapOf(),
|
|
77
81
|
) {
|
|
78
82
|
// Cache theme access to avoid repeated lookups
|
|
79
83
|
val theme = AppTheme.current
|
|
@@ -124,7 +128,8 @@ fun Text(
|
|
|
124
128
|
minLines = minLines,
|
|
125
129
|
textDecoration = textDecoration,
|
|
126
130
|
onTextLayout = onTextLayout ?: {},
|
|
127
|
-
overflow = overflow
|
|
131
|
+
overflow = overflow,
|
|
132
|
+
inlineContent = inlineContent
|
|
128
133
|
)
|
|
129
134
|
}
|
|
130
135
|
|
|
@@ -7,11 +7,15 @@ import androidx.compose.ui.text.TextStyle
|
|
|
7
7
|
import androidx.compose.ui.text.font.FontFamily
|
|
8
8
|
import androidx.compose.ui.text.font.FontWeight
|
|
9
9
|
import androidx.compose.ui.text.style.TextDecoration
|
|
10
|
-
import androidx.compose.ui.unit
|
|
10
|
+
import androidx.compose.ui.unit.Dp
|
|
11
|
+
import androidx.compose.ui.unit.TextUnit
|
|
12
|
+
import androidx.compose.ui.unit.TextUnitType
|
|
13
|
+
import androidx.compose.ui.unit.dp
|
|
14
|
+
import androidx.compose.ui.unit.sp
|
|
11
15
|
import org.jetbrains.compose.resources.Font
|
|
12
16
|
import org.jetbrains.compose.resources.FontResource
|
|
13
17
|
import org.jetbrains.compose.resources.InternalResourceApi
|
|
14
|
-
import vn.momo.kits.application.
|
|
18
|
+
import vn.momo.kits.application.ScaleSizeMaxRate
|
|
15
19
|
import vn.momo.kits.platform.getScreenDimensions
|
|
16
20
|
import vn.momo.uikits.resources.Res
|
|
17
21
|
import vn.momo.uikits.resources.momosignature
|
|
@@ -29,23 +33,34 @@ import kotlin.math.max
|
|
|
29
33
|
import kotlin.math.min
|
|
30
34
|
|
|
31
35
|
const val DEFAULT_SCREEN_SIZE = 375f
|
|
32
|
-
const val MAX_FONT_SCALE = 1.
|
|
36
|
+
const val MAX_FONT_SCALE = 1.5f
|
|
37
|
+
const val MAX_DEVICE_SCALE = 5
|
|
33
38
|
|
|
34
39
|
@Composable
|
|
35
40
|
fun scaleSize(size: Float): Float {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
val fontScale = LocalDensity.current.fontScale
|
|
41
|
+
val scaleSizeMaxRate: Float = ScaleSizeMaxRate.current ?: MAX_FONT_SCALE
|
|
42
|
+
val deviceWidth = getScreenDimensions().width
|
|
43
|
+
val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
val density = LocalDensity.current
|
|
46
|
+
val fontScale = density.fontScale
|
|
47
|
+
|
|
48
|
+
var fontSizeScaleDevice = size
|
|
49
|
+
var fontSizeScaleOS = size
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
if (deviceScale > 1) {
|
|
52
|
+
fontSizeScaleDevice =
|
|
53
|
+
min(deviceScale * fontSizeScaleDevice, fontSizeScaleDevice + MAX_DEVICE_SCALE)
|
|
46
54
|
}
|
|
47
55
|
|
|
48
|
-
|
|
56
|
+
if (fontScale > 1) {
|
|
57
|
+
fontSizeScaleOS = min(fontScale * fontSizeScaleOS, fontSizeScaleOS * scaleSizeMaxRate)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return max(
|
|
61
|
+
fontSizeScaleDevice,
|
|
62
|
+
fontSizeScaleOS
|
|
63
|
+
)
|
|
49
64
|
}
|
|
50
65
|
|
|
51
66
|
@Composable
|
|
@@ -9,9 +9,6 @@ import androidx.navigation.compose.NavHost
|
|
|
9
9
|
import androidx.navigation.compose.composable
|
|
10
10
|
import androidx.navigation.compose.rememberNavController
|
|
11
11
|
import androidx.navigation.toRoute
|
|
12
|
-
import kotlinx.coroutines.flow.catch
|
|
13
|
-
import kotlinx.coroutines.flow.distinctUntilChanged
|
|
14
|
-
import kotlinx.coroutines.flow.map
|
|
15
12
|
import vn.momo.kits.application.*
|
|
16
13
|
import vn.momo.kits.const.*
|
|
17
14
|
import vn.momo.kits.platform.ProvideNavigationEventDispatcherOwner
|
|
@@ -57,19 +54,6 @@ fun NavigationContainer(
|
|
|
57
54
|
DynamicScreenRegistry.bind(screenId, initialScreenName, initialScreen, options)
|
|
58
55
|
val startDestination = remember(screenId) { DynamicScreenRoute(screenId) }
|
|
59
56
|
|
|
60
|
-
LaunchedEffect(maxApi) {
|
|
61
|
-
val api = maxApi ?: return@LaunchedEffect
|
|
62
|
-
runCatching {
|
|
63
|
-
api.observer("use_font_scale")
|
|
64
|
-
.map { parseUseFontScale(it) }
|
|
65
|
-
.distinctUntilChanged()
|
|
66
|
-
.catch { /* ignore observer errors, keep current value */ }
|
|
67
|
-
.collect { enabled ->
|
|
68
|
-
UseFontScaleSystem = enabled
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
57
|
ProvideNavigationEventDispatcherOwner {
|
|
74
58
|
CompositionLocalProvider(
|
|
75
59
|
LocalNavigator provides navigator,
|
|
@@ -80,6 +64,7 @@ fun NavigationContainer(
|
|
|
80
64
|
ApplicationContext provides mergedContext,
|
|
81
65
|
AppConfig provides config,
|
|
82
66
|
AppLanguage provides language,
|
|
67
|
+
ScaleSizeMaxRate provides mergedContext?.scaleSizeMaxRate,
|
|
83
68
|
) {
|
|
84
69
|
LaunchedEffect(Unit) {
|
|
85
70
|
setNavigator?.invoke(navigator)
|
|
@@ -158,15 +143,3 @@ fun NavigationContainer(
|
|
|
158
143
|
val LocalMaxApi = staticCompositionLocalOf<IMaxApi?> {
|
|
159
144
|
error("No MaxApi provided")
|
|
160
145
|
}
|
|
161
|
-
|
|
162
|
-
private fun parseUseFontScale(raw: Any?): Boolean = when (raw) {
|
|
163
|
-
null -> true
|
|
164
|
-
is Boolean -> raw
|
|
165
|
-
is String -> raw.isBlank() || !raw.equals("false", ignoreCase = true)
|
|
166
|
-
is Number -> raw.toInt() != 0
|
|
167
|
-
is Map<*, *> -> {
|
|
168
|
-
val nested = raw["response"] ?: raw["value"] ?: raw["data"]
|
|
169
|
-
if (nested === raw) true else parseUseFontScale(nested)
|
|
170
|
-
}
|
|
171
|
-
else -> true
|
|
172
|
-
}
|
|
@@ -11,6 +11,7 @@ import androidx.compose.ui.graphics.Color
|
|
|
11
11
|
import io.github.alexzhirkevich.compottie.Compottie
|
|
12
12
|
import io.github.alexzhirkevich.compottie.ExperimentalCompottieApi
|
|
13
13
|
import io.github.alexzhirkevich.compottie.LottieCompositionSpec
|
|
14
|
+
import io.github.alexzhirkevich.compottie.animateLottieCompositionAsState
|
|
14
15
|
import io.github.alexzhirkevich.compottie.dynamic.rememberLottieDynamicProperties
|
|
15
16
|
import io.github.alexzhirkevich.compottie.rememberLottieComposition
|
|
16
17
|
import io.github.alexzhirkevich.compottie.rememberLottiePainter
|
|
@@ -48,12 +49,21 @@ internal fun ComposeLottieAnimation(
|
|
|
48
49
|
null
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
val lottieState = animateLottieCompositionAsState(
|
|
53
|
+
composition = composition,
|
|
54
|
+
iterations = Compottie.IterateForever,
|
|
55
|
+
)
|
|
56
|
+
|
|
51
57
|
Box(modifier.background(bgColor ?: Color.Transparent)) {
|
|
52
58
|
Image(
|
|
53
59
|
painter = rememberLottiePainter(
|
|
54
60
|
composition = composition,
|
|
55
|
-
|
|
61
|
+
progress = lottieState::value,
|
|
56
62
|
dynamicProperties = dynamicProperties,
|
|
63
|
+
enableExpressions = false,
|
|
64
|
+
expressionEngineFactory = { _, _ ->
|
|
65
|
+
error("Lottie JS expressions are disabled in MoMo kits")
|
|
66
|
+
},
|
|
57
67
|
),
|
|
58
68
|
contentDescription = null,
|
|
59
69
|
modifier = Modifier.fillMaxSize(),
|
|
@@ -13,13 +13,13 @@ androidGradlePlugin = "8.13.2"
|
|
|
13
13
|
r8 = "8.9.35"
|
|
14
14
|
kotlinx-datetime = "0.7.1"
|
|
15
15
|
airbnb-lottie = "5.2.0"
|
|
16
|
-
compottie = "2.
|
|
16
|
+
compottie = "2.1.0"
|
|
17
17
|
androidx-activity = "1.9.1"
|
|
18
18
|
androidx-appcompat = "1.7.0"
|
|
19
19
|
material = "1.10.0"
|
|
20
20
|
maxapi = "0.1.1"
|
|
21
21
|
vanniktechMavenPublish = "0.34.0"
|
|
22
|
-
kits = "0.
|
|
22
|
+
kits = "0.159.1-beta.7"
|
|
23
23
|
nativemaxapi = "0.0.6"
|
|
24
24
|
|
|
25
25
|
[libraries]
|
|
@@ -39,7 +39,14 @@ coil-multiplatform-compose = { module = "io.coil-kt.coil3:coil-compose", version
|
|
|
39
39
|
coil-multiplatform-network-ktor = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coil3-multiplatform" }
|
|
40
40
|
r8 = { module = "com.android.tools:r8", version.ref = "r8" }
|
|
41
41
|
airbnb-lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "airbnb-lottie" }
|
|
42
|
-
|
|
42
|
+
# AI-GENERATED START
|
|
43
|
+
# Depend on compottie-core (not the `compottie` umbrella). The umbrella drags in the
|
|
44
|
+
# separate `keight` umbrella artifact, which collides with `keight-core` on the
|
|
45
|
+
# `findRoot__at__ScriptRuntime` symbol (duplicate symbol at the iOS `ld` link of
|
|
46
|
+
# shared.framework). compottie-core pulls only `keight-core` (which declares
|
|
47
|
+
# keight.js.JsAny, so the earlier unlinked-symbol error stays fixed too).
|
|
48
|
+
compottie = { module = "io.github.alexzhirkevich:compottie-core", version.ref = "compottie" }
|
|
49
|
+
# AI-GENERATED END
|
|
43
50
|
native-max-api = { group = "vn.momo.maxapi", name = "NativeMaxApi", version.ref = "nativemaxapi" }
|
|
44
51
|
kits = { module = "vn.momo.kits:kits", version.ref = "kits" }
|
|
45
52
|
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
|
package/gradle.properties
CHANGED