@momo-kits/native-kits 0.154.1-beta.3 → 0.154.1-beta.5

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.
@@ -16,6 +16,7 @@ import vn.momo.kits.const.AppTheme
16
16
  import vn.momo.kits.const.Theme
17
17
  import vn.momo.kits.const.ThemeAssets
18
18
  import vn.momo.kits.const.defaultTheme
19
+ import vn.momo.kits.navigation.IsBaselineViewEnabled
19
20
  import vn.momo.kits.platform.getStatusBarHeight
20
21
 
21
22
  @Deprecated("Use IMaxApi instead", ReplaceWith("IMaxApi"))
@@ -74,7 +75,8 @@ data class MiniAppContext(
74
75
  val support: Map<String, Any?> = emptyMap(),
75
76
  val toolkitConfig: Map<String, Any?> = emptyMap(),
76
77
  val providerId: String = "",
77
- val permissions: List<Map<String, Any>>? = emptyList()
78
+ val permissions: List<Map<String, Any>>? = emptyList(),
79
+ val isBaselineEnabled: Boolean = false
78
80
  ) {
79
81
  companion object {
80
82
  private const val KEY_ICON = "icon"
@@ -86,6 +88,7 @@ data class MiniAppContext(
86
88
  private const val KEY_TOOLKIT_CFG = "toolkitConfig"
87
89
  private const val KEY_PERMISSIONS = "permissions"
88
90
  private const val KEY_ORIGIN_APP = "originAppId"
91
+ private const val KEY_BASELINE_ENABLED = "isBaselineEnabled"
89
92
 
90
93
  fun toMap(context: MiniAppContext?): Map<String, Any?> = mapOf(
91
94
  "icon" to (context?.appIcon ?: ""),
@@ -96,7 +99,8 @@ data class MiniAppContext(
96
99
  "support" to (context?.support ?: emptyMap<String, Any?>()),
97
100
  "toolkitConfig" to (context?.toolkitConfig ?: emptyMap<String, Any?>()),
98
101
  "providerId" to (context?.providerId ?: ""),
99
- "permissions" to (context?.permissions ?: emptyList<Map<String, Any>>())
102
+ "permissions" to (context?.permissions ?: emptyList<Map<String, Any>>()),
103
+ "isBaselineEnabled" to (context?.isBaselineEnabled ?: false)
100
104
  )
101
105
 
102
106
  fun fromMap(data: Map<String, Any?>?): MiniAppContext = MiniAppContext(
@@ -111,7 +115,8 @@ data class MiniAppContext(
111
115
  originAppId = data.string(KEY_ORIGIN_APP),
112
116
  appId = data.string(KEY_APP_ID)
113
117
  ),
114
- permissions = data.listOfMapStringAny(KEY_PERMISSIONS)
118
+ permissions = data.listOfMapStringAny(KEY_PERMISSIONS),
119
+ isBaselineEnabled = data?.get(KEY_BASELINE_ENABLED) as Boolean
115
120
  )
116
121
 
117
122
  private fun computeProviderId(originAppId: String?, appId: String?): String {
@@ -198,6 +203,7 @@ fun ApplicationContainer(
198
203
  }
199
204
 
200
205
  val appStatusBarHeight = statusBarHeight ?: getStatusBarHeight()
206
+ val isBaselineEnabled = applicationContext?.isBaselineEnabled ?: false
201
207
 
202
208
  CompositionLocalProvider(
203
209
  AppTheme provides appTheme,
@@ -207,6 +213,7 @@ fun ApplicationContainer(
207
213
  ApplicationContext provides applicationContext,
208
214
  AppConfig provides config,
209
215
  AppLanguage provides language,
216
+ IsBaselineViewEnabled provides isBaselineEnabled
210
217
  ) {
211
218
  content()
212
219
  }
@@ -261,7 +261,7 @@ fun Input(
261
261
  visualTransformation = visualTransformation,
262
262
  keyboardOptions = keyboardOptionsConfig,
263
263
  modifier = Modifier
264
- .height(size.values.height)
264
+ .height(scaleSize(size.values.height.value, 1.1f).dp)
265
265
  .onFocusChanged { focusState ->
266
266
  val wasFocused = inputState.isFocused
267
267
  inputState = inputState.copy(
@@ -124,7 +124,7 @@ fun InputPhoneNumber(
124
124
  keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
125
125
  cursorBrush = SolidColor(AppTheme.current.colors.primary),
126
126
  modifier = Modifier
127
- .height(size.values.height)
127
+ .height(scaleSize(size.values.height.value, 1.1f).dp)
128
128
  .onFocusChanged { focusState ->
129
129
  val wasFocused = inputState.isFocused
130
130
  inputState = inputState.copy(
@@ -13,8 +13,6 @@ import androidx.compose.ui.text.style.TextDecoration
13
13
  import androidx.compose.ui.text.style.TextOverflow
14
14
  import androidx.compose.ui.unit.TextUnit
15
15
  import androidx.compose.ui.unit.dp
16
- import vn.momo.kits.application.ComposeApi
17
- import vn.momo.kits.application.PlatformApi
18
16
  import vn.momo.kits.const.AppTheme
19
17
  import vn.momo.kits.const.Colors
20
18
  import vn.momo.kits.const.Typography
@@ -22,6 +20,7 @@ import vn.momo.kits.const.getFontFamily
22
20
  import vn.momo.kits.const.scaleSize
23
21
  import vn.momo.kits.modifier.conditional
24
22
  import vn.momo.kits.modifier.setAutomationId
23
+ import vn.momo.kits.navigation.IsBaselineViewEnabled
25
24
 
26
25
  @Composable
27
26
  fun Text(
@@ -72,7 +71,7 @@ fun Text(
72
71
  }
73
72
 
74
73
  // on/off baseline config value, default will be false
75
- val isBaselineViewEnabled = true
74
+ val isBaselineViewEnabled = IsBaselineViewEnabled.current
76
75
 
77
76
  androidx.compose.material3.Text(
78
77
  modifier = modifier.conditional(isBaselineViewEnabled){
@@ -37,8 +37,8 @@ const val MAX_FONT_SCALE = 1.5f
37
37
  const val MAX_DEVICE_SCALE = 5
38
38
 
39
39
  @Composable
40
- fun scaleSize(size: Float): Float {
41
- val scaleSizeMaxRate: Float = ScaleSizeMaxRate.current ?: MAX_FONT_SCALE
40
+ fun scaleSize(size: Float, scaleRate: Float? = null): Float {
41
+ val scaleSizeMaxRate: Float = scaleRate ?: ScaleSizeMaxRate.current ?: MAX_FONT_SCALE
42
42
  val deviceWidth = getScreenDimensions().width
43
43
  val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
44
44
 
@@ -72,6 +72,7 @@ fun NavigationContainer(
72
72
  }
73
73
 
74
74
  val startDestination = DynamicScreenRegistry.register(initialScreen, options)
75
+ val isBaselineEnabled = applicationContext?.isBaselineEnabled ?: false
75
76
 
76
77
  CompositionLocalProvider(
77
78
  LocalNavigator provides navigator,
@@ -82,7 +83,8 @@ fun NavigationContainer(
82
83
  AppNavigationBar provides navigationBarHeight,
83
84
  ApplicationContext provides applicationContext,
84
85
  AppConfig provides config,
85
- AppLanguage provides language
86
+ AppLanguage provides language,
87
+ IsBaselineViewEnabled provides isBaselineEnabled
86
88
  ) {
87
89
  LaunchedEffect(Unit) {
88
90
  setNavigator?.invoke(navigator)
@@ -157,3 +159,5 @@ fun NavigationContainer(
157
159
  val LocalMaxApi = staticCompositionLocalOf<IMaxApi?> {
158
160
  error("No MaxApi provided")
159
161
  }
162
+
163
+ val IsBaselineViewEnabled = staticCompositionLocalOf<Boolean> { false }
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
+ #Thu Jan 09 10:43:10 ICT 2025
8
+ sdk.dir=/Users/sophia/Library/Android/sdk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.154.1-beta.3",
3
+ "version": "0.154.1-beta.5",
4
4
  "private": false,
5
5
  "dependencies": {
6
6
  "@momo-platform/native-max-api": "1.0.18"