@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.
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.167.1-beta.7-debug"
43
+ version = "0.167.1-beta.8-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.167.1-beta.4-debug'
3
+ spec.version = '0.167.1-beta.8-debug'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -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.HEADER_FONT_FAMILY
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 = HEADER_FONT_FAMILY,
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
- data class Theme(
62
+ class Theme(
61
63
  val dark: Boolean,
62
64
  val colors: ColorScheme,
63
- val font: String,
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 = "$resolvedFamily-${fontWeight?.weight}"
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 = when {
71
- options.headerType is HeaderType.Transparent -> 0f
72
- opacityHeight <= 0 -> if (scrollState.value > 0) 1f else 0f
73
- else -> (scrollState.value / opacityHeight.toFloat()).coerceIn(0f, 1f)
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 const val HEADER_FONT_FAMILY = "MoMoTrustDisplay"
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 = HEADER_FONT_FAMILY,
35
+ fontFamily = headerFontFamily,
33
36
  color = color,
34
37
  maxLines = 1,
35
38
  overflow = TextOverflow.Ellipsis
@@ -79,7 +79,7 @@ internal fun HeaderUser(
79
79
  text = data.title,
80
80
  color = data.tintColor,
81
81
  style = Typography.actionXsBold,
82
- fontFamily = HEADER_FONT_FAMILY,
82
+ fontFamily = headerFontFamily,
83
83
  maxLines = 1,
84
84
  overflow = TextOverflow.Ellipsis
85
85
  )
package/gradle.properties CHANGED
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
18
18
  name="ComposeKits"
19
19
  group=vn.momo.kits
20
20
  artifact.id=kits
21
- version=0.167.1-beta.4
21
+ version=0.167.1-beta.8
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.167.1-beta.4'
3
+ s.version = '0.167.1-beta.8'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.167.1-beta.4'
3
+ s.version = '0.167.1-beta.8'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.167.1-beta.7-debug",
3
+ "version": "0.167.1-beta.8-debug",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},