@momo-kits/native-kits 0.162.1 → 0.162.2-beta.1-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.
Files changed (32) hide show
  1. package/compose/build.gradle.kts.backup +186 -0
  2. package/compose/compose.podspec +1 -1
  3. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +9 -1
  4. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +6 -0
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +14 -4
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +4 -0
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +2 -0
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +1 -1
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +46 -10
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +4 -2
  11. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
  12. package/example/ios/Example.xcodeproj/xcuserdata/{huynhdung.xcuserdatad → sonnguyen.xcuserdatad}/xcschemes/xcschememanagement.plist +2 -2
  13. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  14. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
  15. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
  16. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
  17. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
  18. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/{huynhdung.xcuserdatad → sonnguyen.xcuserdatad}/xcschemes/xcschememanagement.plist +14 -0
  19. package/gradle.properties +1 -1
  20. package/ios/Typography/MomoFontScale.swift +36 -0
  21. package/ios/Typography/Text.swift +19 -9
  22. package/ios/Typography/Typography.swift +6 -22
  23. package/local.properties +2 -2
  24. package/package.json +1 -1
  25. package/publish.sh +2 -2
  26. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  27. /package/example/ios/Example.xcworkspace/xcuserdata/{huynhdung.xcuserdatad → sonnguyen.xcuserdatad}/xcschemes/xcschememanagement.plist +0 -0
  28. /package/example/ios/Pods/Pods.xcodeproj/xcuserdata/{huynhdung.xcuserdatad → sonnguyen.xcuserdatad}/xcschemes/MoMoUIKits.xcscheme +0 -0
  29. /package/example/ios/Pods/Pods.xcodeproj/xcuserdata/{huynhdung.xcuserdatad → sonnguyen.xcuserdatad}/xcschemes/Pods-Example.xcscheme +0 -0
  30. /package/example/ios/Pods/Pods.xcodeproj/xcuserdata/{huynhdung.xcuserdatad → sonnguyen.xcuserdatad}/xcschemes/SDWebImage.xcscheme +0 -0
  31. /package/example/ios/Pods/Pods.xcodeproj/xcuserdata/{huynhdung.xcuserdatad → sonnguyen.xcuserdatad}/xcschemes/SDWebImageSwiftUI.xcscheme +0 -0
  32. /package/example/ios/Pods/Pods.xcodeproj/xcuserdata/{huynhdung.xcuserdatad → sonnguyen.xcuserdatad}/xcschemes/SkeletonUI.xcscheme +0 -0
@@ -0,0 +1,186 @@
1
+ import com.vanniktech.maven.publish.JavadocJar
2
+ import com.vanniktech.maven.publish.KotlinMultiplatform
3
+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4
+
5
+ plugins {
6
+ alias(libs.plugins.jetbrains.kotlin.multiplatform)
7
+ alias(libs.plugins.android.library)
8
+ alias(libs.plugins.compose)
9
+ alias(libs.plugins.kotlin.compose.compiler)
10
+ alias(libs.plugins.vanniktech.mavenPublish)
11
+ id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
12
+ kotlin("plugin.serialization")
13
+ }
14
+
15
+ val gitlabName: String? = findProperty("name") as String? ?: ""
16
+ val gitlabRepo: String? = findProperty("repo") as String? ?: ""
17
+ val gitlabUrl: String? = findProperty("url") as String? ?: ""
18
+ val gitlabGroup: String? = findProperty("group") as String? ?: ""
19
+ val gitlabArtifactId: String = findProperty("artifact.id") as String? ?: ""
20
+ val gitlabVersion: String? = findProperty("version") as String? ?: ""
21
+ val gitlabUser: String? = findProperty("gitlab.user") as String? ?: ""
22
+ val gitlabKey: String? = findProperty("gitlab.password") as String? ?: ""
23
+
24
+ kotlin {
25
+ androidTarget {
26
+ compilerOptions {
27
+ jvmTarget.set(JvmTarget.JVM_17)
28
+ }
29
+ publishLibraryVariants("release")
30
+ }
31
+
32
+ val fwName = gitlabArtifactId
33
+ val iosTargets = listOf(iosArm64(), iosSimulatorArm64())
34
+ iosTargets.forEach {
35
+ it.binaries.framework {
36
+ baseName = fwName
37
+ binaryOption("bundleId", "$gitlabGroup.$fwName")
38
+ isStatic = true
39
+ }
40
+ }
41
+
42
+ cocoapods {
43
+ version = "0.161.0-debug"
44
+ summary = "IOS Shared module"
45
+ homepage = "https://momo.vn"
46
+ ios.deploymentTarget = "15.0"
47
+
48
+ framework {
49
+ baseName = fwName
50
+ isStatic = true
51
+ }
52
+
53
+ pod("lottie-ios") {
54
+ moduleName = "Lottie"
55
+ version = "4.4.3"
56
+ extraOpts += listOf("-compiler-option", "-fmodules")
57
+ }
58
+ }
59
+
60
+ sourceSets {
61
+ commonMain.dependencies {
62
+ implementation(compose.runtime)
63
+ implementation(compose.material)
64
+ implementation(compose.material3)
65
+ implementation(compose.components.resources)
66
+ implementation(libs.compose.ui.backhandler)
67
+ implementation(libs.ktor.client.core)
68
+ implementation(libs.jetbrains.coroutines.core)
69
+ implementation(libs.navigation.multiplatform)
70
+ implementation(libs.coil.multiplatform.compose)
71
+ implementation(libs.coil.multiplatform.core)
72
+ implementation(libs.coil.multiplatform.network.ktor)
73
+ implementation(libs.jetbrains.serialization.json)
74
+ implementation(libs.kotlinx.datetime)
75
+ api(libs.native.max.api)
76
+ implementation(libs.compottie)
77
+ }
78
+ androidMain.dependencies {
79
+ implementation(libs.ktor.client.okhttp)
80
+ implementation(libs.airbnb.lottie)
81
+ }
82
+ iosMain.dependencies {
83
+ implementation(libs.ktor.client.darwin)
84
+ }
85
+ }
86
+ }
87
+
88
+ android {
89
+ namespace = "vn.momo.kits.kits"
90
+ compileSdk = 35
91
+ compileOptions {
92
+ sourceCompatibility = JavaVersion.VERSION_17
93
+ targetCompatibility = JavaVersion.VERSION_17
94
+ }
95
+ defaultConfig {
96
+ minSdk = 24
97
+ }
98
+ }
99
+
100
+ dependencies {
101
+ }
102
+
103
+ repositories {
104
+ google {
105
+ mavenContent {
106
+ includeGroupAndSubgroups("androidx")
107
+ includeGroupAndSubgroups("com.android")
108
+ includeGroupAndSubgroups("com.google")
109
+ }
110
+ }
111
+ mavenCentral()
112
+ maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
113
+ maven {
114
+ url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
115
+ credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
116
+ }
117
+ maven {
118
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
119
+ credentials {
120
+ username = "viewer"
121
+ password = "viewer"
122
+ }
123
+ isAllowInsecureProtocol = true
124
+ }
125
+ }
126
+
127
+ compose {
128
+ resources {
129
+ publicResClass = true
130
+ packageOfResClass = "vn.momo.uikits.resources"
131
+ generateResClass = always
132
+ }
133
+ }
134
+
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
+ }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |spec|
2
2
  spec.name = 'compose'
3
- spec.version = '0.161.2-beta.15'
3
+ spec.version = '0.161.0-debug'
4
4
  spec.homepage = 'https://momo.vn'
5
5
  spec.source = { :http=> ''}
6
6
  spec.authors = ''
@@ -29,6 +29,8 @@ data class MiniAppContext(
29
29
  val permissions: List<Map<String, Any>>? = emptyList(),
30
30
  val features: FeatureFlags? = null,
31
31
  val scaleSizeMaxRate: Float? = null,
32
+ val followOSScale: Boolean? = null,
33
+ val fontSizeRatio: Float? = null,
32
34
  ) {
33
35
  companion object {
34
36
 
@@ -61,6 +63,8 @@ data class MiniAppContext(
61
63
  permissions = if (!parent.permissions.isNullOrEmpty()) parent.permissions else child.permissions,
62
64
  features = mergeFeatureFlags(parent.features, child.features),
63
65
  scaleSizeMaxRate = parent.scaleSizeMaxRate ?: child.scaleSizeMaxRate,
66
+ followOSScale = parent.followOSScale ?: child.followOSScale,
67
+ fontSizeRatio = parent.fontSizeRatio ?: child.fontSizeRatio,
64
68
  )
65
69
  }
66
70
 
@@ -106,4 +110,8 @@ val LocalComponentInformation = staticCompositionLocalOf<ComponentInformation?>
106
110
  null
107
111
  }
108
112
 
109
- val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
113
+ val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
114
+
115
+ val FollowOSScale = staticCompositionLocalOf<Boolean?> { null }
116
+
117
+ val FontSizeRatio = staticCompositionLocalOf<Float?> { null }
@@ -2,15 +2,21 @@ package vn.momo.kits.components
2
2
 
3
3
  import androidx.compose.runtime.Composable
4
4
  import androidx.compose.runtime.CompositionLocalProvider
5
+ import vn.momo.kits.application.FollowOSScale
6
+ import vn.momo.kits.application.FontSizeRatio
5
7
  import vn.momo.kits.application.ScaleSizeMaxRate
6
8
 
7
9
  @Composable
8
10
  fun ScaleSizeScope(
9
11
  scaleSizeMaxRate: Float? = null,
12
+ followOSScale: Boolean? = null,
13
+ fontSizeRatio: Float? = null,
10
14
  content: @Composable () -> Unit
11
15
  ) {
12
16
  CompositionLocalProvider(
13
17
  ScaleSizeMaxRate provides scaleSizeMaxRate,
18
+ FollowOSScale provides followOSScale,
19
+ FontSizeRatio provides fontSizeRatio,
14
20
  ) {
15
21
  content()
16
22
  }
@@ -15,6 +15,8 @@ import androidx.compose.ui.unit.sp
15
15
  import org.jetbrains.compose.resources.Font
16
16
  import org.jetbrains.compose.resources.FontResource
17
17
  import org.jetbrains.compose.resources.InternalResourceApi
18
+ import vn.momo.kits.application.FollowOSScale
19
+ import vn.momo.kits.application.FontSizeRatio
18
20
  import vn.momo.kits.application.ScaleSizeMaxRate
19
21
  import vn.momo.kits.platform.getScreenDimensions
20
22
  import vn.momo.uikits.resources.Res
@@ -39,6 +41,8 @@ const val MAX_DEVICE_SCALE = 5
39
41
  @Composable
40
42
  fun scaleSize(size: Float): Float {
41
43
  val scaleSizeMaxRate: Float = ScaleSizeMaxRate.current ?: MAX_FONT_SCALE
44
+ val followOSScale: Boolean = FollowOSScale.current ?: false
45
+ val fontSizeRatio: Float = FontSizeRatio.current ?: 1f
42
46
  val deviceWidth = getScreenDimensions().width
43
47
  val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
44
48
 
@@ -46,20 +50,26 @@ fun scaleSize(size: Float): Float {
46
50
  val fontScale = density.fontScale
47
51
 
48
52
  var fontSizeScaleDevice = size
49
- var fontSizeScaleOS = size
53
+ var fontSizeScaleUser = size
50
54
 
51
55
  if (deviceScale > 1) {
52
56
  fontSizeScaleDevice =
53
57
  min(deviceScale * fontSizeScaleDevice, fontSizeScaleDevice + MAX_DEVICE_SCALE)
54
58
  }
55
59
 
56
- if (fontScale > 1) {
57
- fontSizeScaleOS = min(fontScale * fontSizeScaleOS, fontSizeScaleOS * scaleSizeMaxRate)
60
+ if (followOSScale) {
61
+ // Follow OS font scale (capped). User ratio is ignored in this mode.
62
+ if (fontScale > 1) {
63
+ fontSizeScaleUser = min(fontScale * fontSizeScaleUser, fontSizeScaleUser * scaleSizeMaxRate)
64
+ }
65
+ } else if (fontSizeRatio > 1) {
66
+ // Custom in-app ratio. OS font scale is ignored.
67
+ fontSizeScaleUser = fontSizeScaleUser * fontSizeRatio
58
68
  }
59
69
 
60
70
  return max(
61
71
  fontSizeScaleDevice,
62
- fontSizeScaleOS
72
+ fontSizeScaleUser
63
73
  )
64
74
  }
65
75
 
@@ -13,6 +13,7 @@ import vn.momo.kits.navigation.component.HeaderBackProps
13
13
  import vn.momo.kits.navigation.component.HeaderRight
14
14
  import vn.momo.kits.navigation.component.HeaderTitle
15
15
  import vn.momo.kits.navigation.component.HeaderType
16
+ import vn.momo.kits.navigation.component.TitlePosition
16
17
 
17
18
  class Navigation(
18
19
  val id: Int = -1,
@@ -28,6 +29,7 @@ class Navigation(
28
29
  hiddenBack: Boolean? = null,
29
30
  headerBackProps: HeaderBackProps? = null,
30
31
  headerTitle: HeaderTitle? = null,
32
+ titlePosition: TitlePosition? = null,
31
33
  headerRight: HeaderRight? = null,
32
34
  headerType: HeaderType? = null,
33
35
  scrollData: ScrollData? = null,
@@ -43,6 +45,7 @@ class Navigation(
43
45
  hiddenBack = hiddenBack ?: options.hiddenBack,
44
46
  headerBackProps = headerBackProps ?: options.headerBackProps,
45
47
  headerTitle = headerTitle ?: options.headerTitle,
48
+ titlePosition = titlePosition ?: options.titlePosition,
46
49
  headerRight = headerRight ?: options.headerRight,
47
50
  headerType = headerType ?: options.headerType,
48
51
  scrollData = scrollData ?: options.scrollData,
@@ -77,6 +80,7 @@ data class NavigationOptions(
77
80
  val hiddenBack: Boolean = false,
78
81
  val headerBackProps: HeaderBackProps = HeaderBackProps(),
79
82
  val headerTitle: HeaderTitle = HeaderTitle.Default("Stack"),
83
+ val titlePosition: TitlePosition = TitlePosition.LEFT,
80
84
  val headerRight: HeaderRight = HeaderRight.Toolkit(),
81
85
  val headerType: HeaderType = HeaderType.Default(),
82
86
  val scrollData: ScrollData = ScrollData(),
@@ -65,6 +65,8 @@ fun NavigationContainer(
65
65
  AppConfig provides config,
66
66
  AppLanguage provides language,
67
67
  ScaleSizeMaxRate provides mergedContext?.scaleSizeMaxRate,
68
+ FollowOSScale provides mergedContext?.followOSScale,
69
+ FontSizeRatio provides mergedContext?.fontSizeRatio,
68
70
  ) {
69
71
  LaunchedEffect(Unit) {
70
72
  setNavigator?.invoke(navigator)
@@ -376,7 +376,7 @@ fun SearchAnimated(
376
376
  val minTopPadding = AppStatusBar.current
377
377
  val maxTopPadding = AppStatusBar.current + HEADER_HEIGHT.dp
378
378
  val minStartPadding = Spacing.M
379
- val maxStartPadding = if (options.hiddenBack) Spacing.M else 52.dp
379
+ val maxStartPadding = if (options.hiddenBack) Spacing.M else 48.dp // button back: size + left +right = 28 + 12 + 8 = 48
380
380
  val minEndPadding = Spacing.M
381
381
  val maxEndPadding = headerRightWidthDp + if (options.headerRight is HeaderRight.None) Spacing.M else Spacing.M * 2
382
382
 
@@ -6,7 +6,6 @@ import androidx.compose.foundation.border
6
6
  import androidx.compose.foundation.layout.Arrangement
7
7
  import androidx.compose.foundation.layout.Box
8
8
  import androidx.compose.foundation.layout.Row
9
- import androidx.compose.foundation.layout.RowScope
10
9
  import androidx.compose.foundation.layout.Spacer
11
10
  import androidx.compose.foundation.layout.fillMaxWidth
12
11
  import androidx.compose.foundation.layout.height
@@ -23,6 +22,7 @@ import androidx.compose.ui.graphics.Brush
23
22
  import androidx.compose.ui.graphics.Color
24
23
  import androidx.compose.ui.layout.onGloballyPositioned
25
24
  import androidx.compose.ui.platform.LocalDensity
25
+ import androidx.compose.ui.text.style.TextAlign
26
26
  import androidx.compose.ui.unit.Dp
27
27
  import androidx.compose.ui.unit.dp
28
28
  import vn.momo.kits.components.Icon
@@ -44,6 +44,7 @@ import vn.momo.kits.navigation.getInputSearchType
44
44
 
45
45
  const val HEADER_HEIGHT = 52
46
46
  enum class InputSearchType { None, Header, Animated }
47
+ enum class TitlePosition { LEFT, CENTER }
47
48
 
48
49
  @Composable
49
50
  fun Header(onBackHandler: (() -> Unit)? = null) {
@@ -76,6 +77,13 @@ fun Header(onBackHandler: (() -> Unit)? = null) {
76
77
  AppTheme.current.colors.background.surface
77
78
 
78
79
  if (options.headerType == HeaderType.None) return
80
+
81
+ val titlePosition = options.titlePosition
82
+ val titleColor = headerColor.tintIconColor
83
+ .copy(alpha = if (inputSearchType == InputSearchType.Animated) 1f - animatedAlpha else 1f)
84
+ // Centered title needs a full-width overlay to stay screen-centered, not boxed between back button and header right.
85
+ val centerTitle = titlePosition == TitlePosition.CENTER && options.headerTitle is HeaderTitle.Default
86
+
79
87
  Box(
80
88
  Modifier.height(AppStatusBar.current + HEADER_HEIGHT.dp)
81
89
  .fillMaxWidth()
@@ -101,20 +109,40 @@ fun Header(onBackHandler: (() -> Unit)? = null) {
101
109
  onBackHandler?.invoke() ?: navigator.onBackSafe { }
102
110
  }
103
111
  )
104
- Spacer(Modifier.width(Spacing.M))
112
+ Spacer(Modifier.width(Spacing.S))
105
113
  }
106
114
 
107
- HeaderContent(
108
- options.headerTitle,
109
- headerColor.tintIconColor
110
- .copy(alpha = if (inputSearchType == InputSearchType.Animated) 1f - animatedAlpha else 1f)
111
- )
115
+ if (centerTitle) {
116
+ Spacer(Modifier.weight(1f))
117
+ } else {
118
+ HeaderContent(
119
+ headerTitle = options.headerTitle,
120
+ tintIconColor = titleColor,
121
+ titlePosition = titlePosition,
122
+ modifier = Modifier.weight(1f)
123
+ )
124
+ }
112
125
  Box(Modifier.onGloballyPositioned {
113
126
  if(headerRightWidthPx.intValue != it.size.width) headerRightWidthPx.intValue = it.size.width
114
127
  }){
115
128
  HeaderRight(options.headerRight, options.tintColor, headerColor)
116
129
  }
117
130
  }
131
+ if (centerTitle) {
132
+ Box(
133
+ modifier = Modifier.height(HEADER_HEIGHT.dp)
134
+ .fillMaxWidth()
135
+ .padding(horizontal = Spacing.M),
136
+ contentAlignment = Alignment.Center
137
+ ) {
138
+ HeaderContent(
139
+ headerTitle = options.headerTitle,
140
+ tintIconColor = titleColor,
141
+ titlePosition = titlePosition,
142
+ modifier = Modifier.fillMaxWidth()
143
+ )
144
+ }
145
+ }
118
146
  VerticalShadow(opacity)
119
147
  }
120
148
  }
@@ -140,15 +168,23 @@ private fun BackButton(borderColor: Color, backgroundButton: Color, tintIconColo
140
168
  }
141
169
 
142
170
  @Composable
143
- fun RowScope.HeaderContent(headerTitle: HeaderTitle, tintIconColor: Color){
171
+ fun HeaderContent(
172
+ headerTitle: HeaderTitle,
173
+ tintIconColor: Color,
174
+ titlePosition: TitlePosition = TitlePosition.LEFT,
175
+ modifier: Modifier = Modifier,
176
+ ){
144
177
  Box(
145
- Modifier.weight(1f)
178
+ modifier = modifier,
179
+ contentAlignment = if (titlePosition == TitlePosition.CENTER) Alignment.Center else Alignment.CenterStart
146
180
  ) {
147
181
  when (headerTitle){
148
182
  is HeaderTitle.Default -> {
149
183
  HeaderTitle(
150
184
  title = headerTitle.title,
151
- color = tintIconColor
185
+ color = tintIconColor,
186
+ modifier = Modifier.fillMaxWidth(fraction = if (titlePosition == TitlePosition.CENTER) 0.5f else 1f),
187
+ textAlign = if (titlePosition == TitlePosition.CENTER) TextAlign.Center else TextAlign.Start
152
188
  )
153
189
  }
154
190
  is HeaderTitle.Journey -> {}
@@ -16,11 +16,13 @@ import vn.momo.kits.modifier.setAutomationId
16
16
  fun HeaderTitle(
17
17
  title: String = "",
18
18
  color: Color? = null,
19
+ modifier: Modifier = Modifier.fillMaxWidth(),
20
+ textAlign: TextAlign = TextAlign.Start,
19
21
  ) {
20
22
  Text(
21
- modifier = Modifier.fillMaxWidth().zIndex(1f).setAutomationId("title_navigation_header"),
23
+ modifier = modifier.zIndex(1f).setAutomationId("title_navigation_header"),
22
24
  text = title,
23
- textAlign = TextAlign.Start,
25
+ textAlign = textAlign,
24
26
  style = Typography.actionSBold.copy(
25
27
  fontSize = 15.sp,
26
28
  lineHeight = 22.sp,
@@ -0,0 +1,32 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ version = "1.3">
4
+ <BuildAction>
5
+ <BuildActionEntries>
6
+ <BuildActionEntry
7
+ buildForRunning = "YES">
8
+ <BuildableReference
9
+ BuildableIdentifier = "primary"
10
+ BlueprintIdentifier = "A6A920D22B2ADD1E00C1A11F"
11
+ BuildableName = "Example"
12
+ BlueprintName = "Example"
13
+ ReferencedContainer = "container:Example.xcodeproj">
14
+ </BuildableReference>
15
+ </BuildActionEntry>
16
+ </BuildActionEntries>
17
+ </BuildAction>
18
+ <LaunchAction
19
+ useCustomWorkingDirectory = "NO"
20
+ buildConfiguration = "Debug"
21
+ allowLocationSimulation = "YES">
22
+ <BuildableProductRunnable>
23
+ <BuildableReference
24
+ BuildableIdentifier = "primary"
25
+ BlueprintIdentifier = "A6A920D22B2ADD1E00C1A11F"
26
+ BuildableName = "Example"
27
+ BlueprintName = "Example"
28
+ ReferencedContainer = "container:Example.xcodeproj">
29
+ </BuildableReference>
30
+ </BuildableProductRunnable>
31
+ </LaunchAction>
32
+ </Scheme>
@@ -4,10 +4,10 @@
4
4
  <dict>
5
5
  <key>SchemeUserState</key>
6
6
  <dict>
7
- <key>Example.xcscheme_^#shared#^_</key>
7
+ <key>Example.xcscheme</key>
8
8
  <dict>
9
9
  <key>orderHint</key>
10
- <integer>0</integer>
10
+ <integer>7</integer>
11
11
  </dict>
12
12
  </dict>
13
13
  </dict>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>BuildLocationStyle</key>
6
+ <string>UseAppPreferences</string>
7
+ <key>CustomBuildLocationType</key>
8
+ <string>RelativeToDerivedData</string>
9
+ <key>DerivedDataCustomLocation</key>
10
+ <string>DerivedData</string>
11
+ <key>DerivedDataLocationStyle</key>
12
+ <string>WorkspaceRelativePath</string>
13
+ <key>ShowSharedSchemesAutomaticallyEnabled</key>
14
+ <true/>
15
+ </dict>
16
+ </plist>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Bucket
3
+ uuid = "6B3C387A-E951-41D1-A42C-FB6E447A46BA"
4
+ type = "0"
5
+ version = "2.0">
6
+ </Bucket>
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1600"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "BF2A15FEC3F3424BBC4B9AD5F86F2D54"
18
+ BuildableName = "LottiePrivacyInfo.bundle"
19
+ BlueprintName = "lottie-ios-LottiePrivacyInfo"
20
+ ReferencedContainer = "container:Pods.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ shouldUseLaunchSchemeArgsEnv = "YES">
30
+ <Testables>
31
+ </Testables>
32
+ </TestAction>
33
+ <LaunchAction
34
+ buildConfiguration = "Debug"
35
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
+ launchStyle = "0"
38
+ useCustomWorkingDirectory = "NO"
39
+ ignoresPersistentStateOnLaunch = "NO"
40
+ debugDocumentVersioning = "YES"
41
+ debugServiceExtension = "internal"
42
+ allowLocationSimulation = "YES">
43
+ </LaunchAction>
44
+ <ProfileAction
45
+ buildConfiguration = "Release"
46
+ shouldUseLaunchSchemeArgsEnv = "YES"
47
+ savedToolIdentifier = ""
48
+ useCustomWorkingDirectory = "NO"
49
+ debugDocumentVersioning = "YES">
50
+ </ProfileAction>
51
+ <AnalyzeAction
52
+ buildConfiguration = "Debug">
53
+ </AnalyzeAction>
54
+ <ArchiveAction
55
+ buildConfiguration = "Release"
56
+ revealArchiveInOrganizer = "YES">
57
+ </ArchiveAction>
58
+ </Scheme>
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1600"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "0B967D7F8561D42493EE289EC8D450D1"
18
+ BuildableName = "Lottie.framework"
19
+ BlueprintName = "lottie-ios"
20
+ ReferencedContainer = "container:Pods.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ shouldUseLaunchSchemeArgsEnv = "YES">
30
+ <Testables>
31
+ </Testables>
32
+ </TestAction>
33
+ <LaunchAction
34
+ buildConfiguration = "Debug"
35
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37
+ launchStyle = "0"
38
+ useCustomWorkingDirectory = "NO"
39
+ ignoresPersistentStateOnLaunch = "NO"
40
+ debugDocumentVersioning = "YES"
41
+ debugServiceExtension = "internal"
42
+ allowLocationSimulation = "YES">
43
+ </LaunchAction>
44
+ <ProfileAction
45
+ buildConfiguration = "Release"
46
+ shouldUseLaunchSchemeArgsEnv = "YES"
47
+ savedToolIdentifier = ""
48
+ useCustomWorkingDirectory = "NO"
49
+ debugDocumentVersioning = "YES">
50
+ </ProfileAction>
51
+ <AnalyzeAction
52
+ buildConfiguration = "Debug">
53
+ </AnalyzeAction>
54
+ <ArchiveAction
55
+ buildConfiguration = "Release"
56
+ revealArchiveInOrganizer = "YES">
57
+ </ArchiveAction>
58
+ </Scheme>
@@ -39,6 +39,20 @@
39
39
  <key>orderHint</key>
40
40
  <integer>4</integer>
41
41
  </dict>
42
+ <key>lottie-ios-LottiePrivacyInfo.xcscheme</key>
43
+ <dict>
44
+ <key>isShown</key>
45
+ <false />
46
+ <key>orderHint</key>
47
+ <integer>5</integer>
48
+ </dict>
49
+ <key>lottie-ios.xcscheme</key>
50
+ <dict>
51
+ <key>isShown</key>
52
+ <false />
53
+ <key>orderHint</key>
54
+ <integer>6</integer>
55
+ </dict>
42
56
  </dict>
43
57
  <key>SuppressBuildableAutocreation</key>
44
58
  <dict />
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.162.1
21
+ version=0.162.2-beta.1
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
@@ -0,0 +1,36 @@
1
+ import SwiftUI
2
+
3
+ /// Process-wide holder for the user's in-app font-size preference.
4
+ ///
5
+ /// `momo-native-kits` is a UI library; it does not read persistent storage
6
+ /// itself. The host app (momo-app) reads the persisted setting from the shared
7
+ /// Observable Storage and pushes it here at launch and on every change via
8
+ /// `update(followOSScale:ratio:)`. All native typography (`scaleSize`,
9
+ /// `Font.appFont`, `MomoText`) reads from this single source so the three
10
+ /// render stacks (RN / Compose / SwiftUI) stay in sync.
11
+ ///
12
+ /// Live update: `MomoText` observes this object, so changing the setting
13
+ /// re-renders typed text immediately. Views built from the `Font.appFont`
14
+ /// static constants pick up the value at launch (static `let` is evaluated
15
+ /// once); making those live would require turning them into functions.
16
+ public final class MomoFontScale: ObservableObject {
17
+ public static let shared = MomoFontScale()
18
+
19
+ /// When true, follow the OS font scale (capped). `ratio` is ignored.
20
+ @Published public private(set) var followOSScale: Bool = false
21
+
22
+ /// In-app font-size ratio (e.g. 1.0 / 1.1 / 1.2). Ignored when
23
+ /// `followOSScale` is true.
24
+ @Published public private(set) var ratio: CGFloat = 1
25
+
26
+ private init() {}
27
+
28
+ public func update(followOSScale: Bool, ratio: CGFloat) {
29
+ if self.followOSScale != followOSScale {
30
+ self.followOSScale = followOSScale
31
+ }
32
+ if self.ratio != ratio {
33
+ self.ratio = ratio
34
+ }
35
+ }
36
+ }
@@ -8,23 +8,30 @@ public func scaleSize(_ size: CGFloat, _ scaleRate: CGFloat? = nil) -> CGFloat {
8
8
  let deviceWidth = UIScreen.main.bounds.width
9
9
  let deviceScale = deviceWidth / defaultScreenSize
10
10
 
11
- let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
12
- let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
13
- let fontScale = scaledFont.pointSize / defaultFont.pointSize
14
-
15
11
  var fontSizeDeviceScale = size
16
- var fontSizeOSScale = size
17
-
12
+ var fontSizeUserScale = size
18
13
 
19
14
  if deviceScale > 1 {
20
15
  fontSizeDeviceScale = min(fontSizeDeviceScale * deviceScale, fontSizeDeviceScale + maxDeviceScale)
21
16
  }
22
17
 
23
- if fontScale > 1 {
24
- fontSizeOSScale = min(fontSizeOSScale * fontScale, fontSizeOSScale * maxFontScale)
18
+ if MomoFontScale.shared.followOSScale {
19
+ // Follow OS font scale (capped). User ratio is ignored in this mode.
20
+ let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
21
+ let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
22
+ let fontScale = scaledFont.pointSize / defaultFont.pointSize
23
+ if fontScale > 1 {
24
+ fontSizeUserScale = min(fontSizeUserScale * fontScale, fontSizeUserScale * maxFontScale)
25
+ }
26
+ } else {
27
+ // Custom in-app ratio. OS font scale is ignored.
28
+ let ratio = MomoFontScale.shared.ratio
29
+ if ratio > 1 {
30
+ fontSizeUserScale = fontSizeUserScale * ratio
31
+ }
25
32
  }
26
33
 
27
- return max(fontSizeDeviceScale, fontSizeOSScale)
34
+ return max(fontSizeDeviceScale, fontSizeUserScale)
28
35
  }
29
36
 
30
37
  public enum TypographyStyle {
@@ -118,6 +125,9 @@ public struct MomoText: View {
118
125
  private let content: String
119
126
  private let typography: TypographyStyle
120
127
  private let color: Color
128
+ // Observe so the text re-renders immediately when the user changes the
129
+ // font-size setting (live update, no app restart).
130
+ @ObservedObject private var fontScale = MomoFontScale.shared
121
131
 
122
132
  public init(
123
133
  _ content: String,
@@ -1,29 +1,13 @@
1
1
  import SwiftUI
2
2
 
3
3
  public extension Font {
4
+ // Shares the same scaling logic as `scaleSize` so it honors the user's
5
+ // font-size preference (follow-OS vs in-app ratio).
6
+ // NOTE: the `static let` constants below are evaluated once on first
7
+ // access, so they reflect the setting at launch but do not live-update.
8
+ // Components that need live updates should use `MomoText` / `scaleSize`.
4
9
  static func appFont(size: CGFloat) -> Font {
5
- let defaultScreenSize: CGFloat = 375
6
- let maxFontScale: CGFloat = 1.5
7
- let maxDeviceScale: CGFloat = 5
8
-
9
- let deviceWidth = UIScreen.main.bounds.width
10
- let deviceScale = deviceWidth / defaultScreenSize
11
-
12
- let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
13
- let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
14
- let fontScale = scaledFont.pointSize / defaultFont.pointSize
15
-
16
- var fontSize = size
17
-
18
- if deviceScale > 1 {
19
- fontSize = min(fontSize * deviceScale, fontSize + maxDeviceScale)
20
- }
21
-
22
- if fontScale > 1 {
23
- fontSize = min(fontSize * fontScale, fontSize * maxFontScale)
24
- }
25
-
26
- return Font.system(size: fontSize)
10
+ return Font.system(size: scaleSize(size))
27
11
  }
28
12
 
29
13
  // New supported typography styles
package/local.properties CHANGED
@@ -4,5 +4,5 @@
4
4
  # Location of the SDK. This is only used by Gradle.
5
5
  # For customization when using a Version Control System, please read the
6
6
  # header note.
7
- #Wed Aug 21 14:20:12 ICT 2024
8
- sdk.dir=/Users/huynhdung/Library/Android/sdk
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.162.1",
3
+ "version": "0.162.2-beta.1-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},
package/publish.sh CHANGED
@@ -456,7 +456,7 @@ case "$PHASE" in
456
456
  ;;
457
457
  "maven")
458
458
  echo "Running PHASE 2 only: Publish to Maven"
459
- # phase_publish_maven
459
+ phase_publish_maven
460
460
  ;;
461
461
  "npm")
462
462
  echo "Running PHASE 3 only: Publish to NPM"
@@ -465,7 +465,7 @@ case "$PHASE" in
465
465
  "all")
466
466
  echo "Running ALL PHASES"
467
467
  phase_check_version
468
- # phase_publish_maven
468
+ phase_publish_maven
469
469
  phase_publish_npm
470
470
  echo ""
471
471
  echo "🎉 ALL PHASES COMPLETED SUCCESSFULLY!"