@momo-kits/native-kits 0.167.1-beta.7-debug → 0.167.1-beta.8-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 +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +34 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +1 -27
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +5 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +5 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +1 -1
- package/gradle.properties +1 -1
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/local.properties +8 -0
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -44,7 +44,7 @@ import vn.momo.kits.const.getFontFamily
|
|
|
44
44
|
import vn.momo.kits.modifier.kitsAutomationId
|
|
45
45
|
import vn.momo.kits.modifier.noFeedbackClickable
|
|
46
46
|
import vn.momo.kits.modifier.setAutomationId
|
|
47
|
-
import vn.momo.kits.navigation.component.
|
|
47
|
+
import vn.momo.kits.navigation.component.headerFontFamily
|
|
48
48
|
import vn.momo.kits.navigation.component.HEADER_HEIGHT
|
|
49
49
|
import vn.momo.kits.utils.getAppStatusBarHeight
|
|
50
50
|
import kotlin.math.max
|
|
@@ -362,7 +362,7 @@ private fun LiteScreenLayout(
|
|
|
362
362
|
text = title,
|
|
363
363
|
color = headerColor.tintIconColor,
|
|
364
364
|
style = titleStyle,
|
|
365
|
-
fontFamily =
|
|
365
|
+
fontFamily = headerFontFamily,
|
|
366
366
|
modifier = titleModifier,
|
|
367
367
|
maxLines = 1,
|
|
368
368
|
overflow = TextOverflow.Ellipsis
|
|
@@ -4,10 +4,6 @@ import androidx.compose.runtime.getValue
|
|
|
4
4
|
import androidx.compose.runtime.mutableStateOf
|
|
5
5
|
import androidx.compose.runtime.setValue
|
|
6
6
|
|
|
7
|
-
// Design-system rollout holder, same shape as KitFontScale: the kit is sandboxed and can't read the
|
|
8
|
-
// host config, so the host seeds this once at startup from DesignSystemConfig. getFontFamily() reads
|
|
9
|
-
// it to decide whether the new default font applies, so every screen follows the flag with no prop
|
|
10
|
-
// threading. Backed by snapshot state: writes recompose text automatically.
|
|
11
7
|
object KitDesignSystem {
|
|
12
8
|
var isWhiteList by mutableStateOf(false)
|
|
13
9
|
private set
|
|
@@ -56,16 +56,48 @@ data class ThemeAssets(
|
|
|
56
56
|
val headerBackground: String? = null
|
|
57
57
|
)
|
|
58
58
|
|
|
59
|
+
internal const val LEGACY_DEFAULT_FONT_FAMILY = "SFProText"
|
|
60
|
+
|
|
59
61
|
@Stable
|
|
60
|
-
|
|
62
|
+
class Theme(
|
|
61
63
|
val dark: Boolean,
|
|
62
64
|
val colors: ColorScheme,
|
|
63
|
-
|
|
65
|
+
font: String,
|
|
64
66
|
val assets: ThemeAssets
|
|
65
67
|
) {
|
|
68
|
+
private val designSystemFont = font
|
|
69
|
+
|
|
70
|
+
val font: String
|
|
71
|
+
get() = if (KitDesignSystem.isWhiteList) designSystemFont else LEGACY_DEFAULT_FONT_FAMILY
|
|
72
|
+
|
|
66
73
|
fun isHeaderImage(): Boolean {
|
|
67
74
|
return !assets.headerBackground.isNullOrEmpty()
|
|
68
75
|
}
|
|
76
|
+
|
|
77
|
+
fun copy(
|
|
78
|
+
dark: Boolean = this.dark,
|
|
79
|
+
colors: ColorScheme = this.colors,
|
|
80
|
+
font: String = designSystemFont,
|
|
81
|
+
assets: ThemeAssets = this.assets
|
|
82
|
+
): Theme = Theme(dark, colors, font, assets)
|
|
83
|
+
|
|
84
|
+
override fun equals(other: Any?): Boolean {
|
|
85
|
+
if (this === other) return true
|
|
86
|
+
if (other !is Theme) return false
|
|
87
|
+
return dark == other.dark && colors == other.colors &&
|
|
88
|
+
designSystemFont == other.designSystemFont && assets == other.assets
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
override fun hashCode(): Int {
|
|
92
|
+
var result = dark.hashCode()
|
|
93
|
+
result = 31 * result + colors.hashCode()
|
|
94
|
+
result = 31 * result + designSystemFont.hashCode()
|
|
95
|
+
result = 31 * result + assets.hashCode()
|
|
96
|
+
return result
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
override fun toString(): String =
|
|
100
|
+
"Theme(dark=$dark, colors=$colors, font=$designSystemFont, assets=$assets)"
|
|
69
101
|
}
|
|
70
102
|
val defaultTheme = Theme(
|
|
71
103
|
dark = false,
|
|
@@ -83,12 +83,6 @@ fun scaleSize(textStyle: TextStyle): TextStyle {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
/**
|
|
87
|
-
* Tên file font trong tài nguyên native của app host (xem [hostFontFamily]).
|
|
88
|
-
*
|
|
89
|
-
* SDK không đóng gói font riêng nữa: app host đã bundle sẵn toàn bộ font từ `font-source`
|
|
90
|
-
* cho cả React Native lẫn native, nên bản copy trong `composeResources` chỉ làm phình app.
|
|
91
|
-
*/
|
|
92
86
|
private const val LEGACY_DEFAULT_FONT_FILE = "SFProText-Regular.ttf"
|
|
93
87
|
private const val NEW_DEFAULT_FONT_FILE = "MomoTrustSans-Regular.ttf"
|
|
94
88
|
|
|
@@ -120,31 +114,11 @@ private val hostFontFiles: Map<String, String> = mapOf(
|
|
|
120
114
|
)
|
|
121
115
|
}
|
|
122
116
|
|
|
123
|
-
/**
|
|
124
|
-
* Font mặc định mới, chỉ áp cho user nằm trong whitelist design system ([KitDesignSystem]).
|
|
125
|
-
* Ngoài whitelist thì quay về [LEGACY_DEFAULT_FONT_FAMILY] như trước.
|
|
126
|
-
*/
|
|
127
|
-
private const val NEW_DEFAULT_FONT_FAMILY = "MomoTrustSans"
|
|
128
|
-
private const val LEGACY_DEFAULT_FONT_FAMILY = "SFProText"
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Font thuoc bo design system moi. MoMoTrustDisplay chi duoc header dung tu DS-791
|
|
132
|
-
* (commit header title 5bfde6251); truoc do header lay font theo theme, nen ngoai
|
|
133
|
-
* whitelist ca hai deu ha ve [LEGACY_DEFAULT_FONT_FAMILY].
|
|
134
|
-
*/
|
|
135
|
-
private val newFontFamilies = setOf(NEW_DEFAULT_FONT_FAMILY, "MoMoTrustDisplay")
|
|
136
|
-
|
|
137
117
|
@Composable
|
|
138
118
|
fun getFontFamily(fontFamily: String, fontWeight: FontWeight? = FontWeight.Normal): FontFamily {
|
|
139
119
|
val isWhiteList = KitDesignSystem.isWhiteList
|
|
140
|
-
val resolvedFamily =
|
|
141
|
-
if (fontFamily in newFontFamilies && !isWhiteList) {
|
|
142
|
-
LEGACY_DEFAULT_FONT_FAMILY
|
|
143
|
-
} else {
|
|
144
|
-
fontFamily
|
|
145
|
-
}
|
|
146
120
|
val defaultFile = if (isWhiteList) NEW_DEFAULT_FONT_FILE else LEGACY_DEFAULT_FONT_FILE
|
|
147
|
-
val key = "$
|
|
121
|
+
val key = "$fontFamily-${fontWeight?.weight}"
|
|
148
122
|
val fileName = hostFontFiles[key] ?: defaultFile
|
|
149
123
|
return hostFontFamily(fileName)
|
|
150
124
|
?: hostFontFamily(defaultFile)
|
|
@@ -67,10 +67,11 @@ internal fun Header(onBackHandler: (() -> Unit)? = null) {
|
|
|
67
67
|
else -> HEADER_HEIGHT
|
|
68
68
|
}
|
|
69
69
|
val opacity by animateFloatAsState(
|
|
70
|
-
targetValue =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
targetValue = if (options.headerType is HeaderType.Transparent) {
|
|
71
|
+
0f
|
|
72
|
+
} else {
|
|
73
|
+
(scrollState.value / opacityHeight.toFloat())
|
|
74
|
+
.coerceIn(0f, 1f)
|
|
74
75
|
}
|
|
75
76
|
)
|
|
76
77
|
|
|
@@ -9,10 +9,13 @@ import androidx.compose.ui.text.style.TextOverflow
|
|
|
9
9
|
import androidx.compose.ui.unit.sp
|
|
10
10
|
import androidx.compose.ui.zIndex
|
|
11
11
|
import vn.momo.kits.components.Text
|
|
12
|
+
import vn.momo.kits.const.KitDesignSystem
|
|
13
|
+
import vn.momo.kits.const.LEGACY_DEFAULT_FONT_FAMILY
|
|
12
14
|
import vn.momo.kits.const.Typography
|
|
13
15
|
import vn.momo.kits.modifier.setAutomationId
|
|
14
16
|
|
|
15
|
-
internal
|
|
17
|
+
internal val headerFontFamily: String
|
|
18
|
+
get() = if (KitDesignSystem.isWhiteList) "MoMoTrustDisplay" else LEGACY_DEFAULT_FONT_FAMILY
|
|
16
19
|
|
|
17
20
|
@Composable
|
|
18
21
|
internal fun HeaderTitle(
|
|
@@ -29,7 +32,7 @@ internal fun HeaderTitle(
|
|
|
29
32
|
fontSize = 15.sp,
|
|
30
33
|
lineHeight = 22.sp,
|
|
31
34
|
),
|
|
32
|
-
fontFamily =
|
|
35
|
+
fontFamily = headerFontFamily,
|
|
33
36
|
color = color,
|
|
34
37
|
maxLines = 1,
|
|
35
38
|
overflow = TextOverflow.Ellipsis
|
package/gradle.properties
CHANGED
package/ios/native-kits.podspec
CHANGED
package/local.properties
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
#Tue Apr 08 11:13:31 ICT 2025
|
|
8
|
+
sdk.dir=/Users/sonnguyen/Library/Android/sdk
|