@momo-kits/native-kits 0.162.3-fontscale.1-debug → 0.162.3-fontscale.2-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/CLAUDE.md CHANGED
@@ -40,7 +40,7 @@ Publishing is automated (`publish.sh` + GitLab CI on `[ci build]` / `main`). Do
40
40
  ## Architecture essentials
41
41
 
42
42
  - **Entry point:** wrap content in `NavigationContainer(...)` from `navigation/`. It builds the `Navigator`, takes a host-supplied `Localize` (falls back to an empty one), and provides the CompositionLocals below. **Do not use** `ApplicationContainer` (`application/NavigationContainer.kt`) — deprecated and does **not** wire `LocalLocalize` / `LocalNavigator` / `LocalMaxApi`.
43
- - **Configuration flows via CompositionLocals**, not params. Public ones: `AppTheme`, `AppStatusBar`, `AppNavigationBar` (`const/Theme.kt`); `ApplicationContext`, `AppConfig`, `AppLanguage`, `LocalLocalize`, `ScaleSizeMaxRate` (`application/`); `LocalNavigator`, `LocalMaxApi` (`navigation/`). Read with `X.current`.
43
+ - **Configuration flows via CompositionLocals**, not params. Public ones: `AppTheme`, `AppStatusBar`, `AppNavigationBar` (`const/Theme.kt`); `ApplicationContext`, `AppConfig`, `AppLanguage`, `LocalLocalize` (`application/`); `LocalNavigator`, `LocalMaxApi` (`navigation/`). Read with `X.current`.
44
44
  - **Platform code** goes through `expect`/`actual` in `platform/` — never reference Android/iOS APIs from `commonMain` directly.
45
45
  - **Native bridge:** `IMaxApi` (`vn.momo.maxapi`, exposed as `LocalMaxApi`) is the host-app bridge (dismiss, tracking, device info, language).
46
46
  - Navigation uses a runtime `DynamicScreenRegistry`; overlays (modal/bottom-sheet/snackbar) go through `Navigator` + `OverplayComponentRegistry`.
@@ -40,7 +40,7 @@ kotlin {
40
40
  }
41
41
 
42
42
  cocoapods {
43
- version = "0.162.3-fontscale.1-debug"
43
+ version = "0.162.3-fontscale.2-debug"
44
44
  summary = "IOS Shared module"
45
45
  homepage = "https://momo.vn"
46
46
  ios.deploymentTarget = "15.0"
@@ -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 userScaleRate: Float? = null,
33
+ val useOSScaleRate: Boolean? = 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
+ userScaleRate = parent.userScaleRate ?: child.userScaleRate,
67
+ useOSScaleRate = parent.useOSScaleRate ?: child.useOSScaleRate,
64
68
  )
65
69
  }
66
70
 
@@ -98,4 +102,5 @@ val LocalComponentInformation = staticCompositionLocalOf<ComponentInformation?>
98
102
  null
99
103
  }
100
104
 
105
+ @Deprecated("Max font scale is fixed at MAX_FONT_SCALE (1.5); this CompositionLocal is no longer read.")
101
106
  val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
@@ -4,6 +4,10 @@ import androidx.compose.runtime.Composable
4
4
  import androidx.compose.runtime.CompositionLocalProvider
5
5
  import vn.momo.kits.application.ScaleSizeMaxRate
6
6
 
7
+ @Deprecated(
8
+ "Max font scale is fixed at MAX_FONT_SCALE (1.5); this override is no longer applied. Remove the wrapper.",
9
+ ReplaceWith("content()"),
10
+ )
7
11
  @Composable
8
12
  fun ScaleSizeScope(
9
13
  scaleSizeMaxRate: Float? = null,
@@ -11,7 +11,7 @@ import androidx.compose.ui.unit.*
11
11
  import org.jetbrains.compose.resources.Font
12
12
  import org.jetbrains.compose.resources.FontResource
13
13
  import org.jetbrains.compose.resources.InternalResourceApi
14
- import vn.momo.kits.application.ScaleSizeMaxRate
14
+ import vn.momo.kits.application.LocalContext
15
15
  import vn.momo.kits.platform.getScreenDimensions
16
16
  import vn.momo.uikits.resources.*
17
17
  import kotlin.math.max
@@ -23,7 +23,11 @@ const val MAX_DEVICE_SCALE = 5
23
23
 
24
24
  @Composable
25
25
  fun scaleSize(size: Float): Float {
26
- val scaleSizeMaxRate: Float = ScaleSizeMaxRate.current ?: MAX_FONT_SCALE
26
+ val context = LocalContext.current
27
+ if (context?.useOSScaleRate == false) {
28
+ return size * (context.userScaleRate ?: 1f)
29
+ }
30
+ val scaleSizeMaxRate: Float = MAX_FONT_SCALE
27
31
  val deviceWidth = getScreenDimensions().width
28
32
  val deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE
29
33
 
@@ -51,15 +51,6 @@ fun NavigationContainer(
51
51
  }
52
52
  })
53
53
  }
54
- // TEMP: verify FontScale MaxApi end-to-end via dynamic dispatch — remove after test
55
- runCatching {
56
- api.maxDispatcher.dispatchAsync("getFontScale", arrayOf<Any?>()) { resp ->
57
- println("[FontScale][native-kit] getFontScale -> $resp")
58
- }
59
- api.maxDispatcher.dispatchAsync("setFontScale", arrayOf<Any?>(1.5f)) { resp ->
60
- println("[FontScale][native-kit] setFontScale -> $resp")
61
- }
62
- }
63
54
  }
64
55
 
65
56
  val screenId = rememberSaveable { registry.nextId() }
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.3-fontscale.1
21
+ version=0.162.3-fontscale.2
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.162.3-fontscale.1-debug",
3
+ "version": "0.162.3-fontscale.2-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},