@momo-kits/native-kits 0.162.2-sp.7-debug → 0.162.2-sp.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.
Files changed (160) hide show
  1. package/.claude/settings.local.json +15 -1
  2. package/CLAUDE.md +78 -0
  3. package/compose/build.gradle.kts +12 -31
  4. package/compose/build.gradle.kts.backup +11 -30
  5. package/compose/compose.podspec +1 -1
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +2 -7
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +8 -11
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +6 -24
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +4 -19
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -10
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +6 -17
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +6 -101
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +8 -19
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +8 -33
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +22 -25
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +27 -29
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +3 -26
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +30 -31
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +3 -13
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -5
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +3 -11
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +3 -18
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +42 -65
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +69 -26
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -5
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +84 -59
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +13 -71
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +10 -51
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +6 -1
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -21
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +16 -75
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +5 -26
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +3 -11
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +16 -40
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -9
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -28
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +2 -13
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +4 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +4 -10
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -28
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +8 -47
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +4 -25
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +2 -11
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +1 -17
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +1 -6
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +50 -111
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -5
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -5
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -12
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +4 -96
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +5 -7
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +2 -12
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +9 -21
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +9 -14
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +8 -11
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +11 -20
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +1 -1
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -5
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -2
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +94 -4
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -2
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +2 -2
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +3 -7
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +9 -15
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +36 -24
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +67 -61
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +6 -13
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +13 -31
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +6 -24
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +11 -6
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +2 -1
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +9 -6
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +3 -13
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +3 -2
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +1 -40
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -2
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -8
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +2 -17
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
  98. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +2 -3
  99. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  100. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -2
  101. package/gradle/libs.versions.toml +2 -0
  102. package/gradle.properties +1 -1
  103. package/ios/Application/ApplicationEnvironment.swift +4 -2
  104. package/ios/Application/Components.swift +16 -0
  105. package/ios/Application/Localize.swift +277 -0
  106. package/ios/Application/MaxApi.swift +18 -0
  107. package/ios/Application/Navigation/BottomTab/BottomTab.swift +1 -0
  108. package/ios/Application/Navigation/NavigationContainer.swift +27 -3
  109. package/ios/Application/Navigation/Navigator.swift +50 -29
  110. package/ios/Application/Navigation/Overplay/BottomSheet.swift +87 -19
  111. package/ios/Application/Navigation/Overplay/ModalScreen.swift +6 -0
  112. package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
  113. package/ios/Application/Screen.swift +1 -1
  114. package/ios/Application/StackScreen.swift +49 -1
  115. package/ios/Badge/BadgeRibbon.swift +80 -0
  116. package/ios/Button/Button.swift +68 -12
  117. package/ios/Carousel/Carousel.swift +16 -1
  118. package/ios/Checkbox/Checkbox.swift +14 -20
  119. package/ios/Chip/Chip.swift +35 -26
  120. package/ios/Collapse/Collapse.swift +11 -1
  121. package/ios/Colors+Radius+Spacing/Colors.swift +9 -6
  122. package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
  123. package/ios/DateTimePicker/DateTimePicker.swift +4 -2
  124. package/ios/DateTimePicker/WheelPicker.swift +7 -3
  125. package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
  126. package/ios/Extensions/Color++.swift +5 -2
  127. package/ios/Icon/Icon.swift +5 -1
  128. package/ios/IconButton/IconButton.swift +35 -7
  129. package/ios/Image/Image.swift +16 -3
  130. package/ios/Information/Information.swift +3 -1
  131. package/ios/Input/ErrorView.swift +3 -1
  132. package/ios/Input/Input.swift +31 -8
  133. package/ios/Input/InputPhoneNumber.swift +14 -3
  134. package/ios/Input/InputSearch.swift +7 -1
  135. package/ios/Input/InputTextArea.swift +78 -34
  136. package/ios/InputDropDown/InputDropDown.swift +4 -1
  137. package/ios/InputMoney/InputMoney.swift +16 -4
  138. package/ios/PARITY_AUDIT.md +641 -0
  139. package/ios/Popup/PopupDisplay.swift +3 -4
  140. package/ios/Popup/PopupNotify.swift +3 -4
  141. package/ios/Popup/PopupPromotion.swift +16 -8
  142. package/ios/ProgressInfo/ProgressInfo.swift +4 -2
  143. package/ios/Radio/Radio.swift +12 -13
  144. package/ios/Rating/Rating.swift +1 -1
  145. package/ios/Stepper/Stepper.swift +2 -2
  146. package/ios/Steps/Steps.swift +22 -6
  147. package/ios/SuggestAction/SuggestAction.swift +5 -3
  148. package/ios/Swipeable/SwipeCell.swift +5 -3
  149. package/ios/Switch/Switch.swift +53 -28
  150. package/ios/TabView/TabView.swift +18 -14
  151. package/ios/Template/TrustBanner/TrustBanner.swift +6 -7
  152. package/ios/Tooltip/Tooltip.swift +3 -0
  153. package/ios/Typography/FontScaleStore.swift +19 -0
  154. package/ios/Typography/Text.swift +3 -0
  155. package/ios/Typography/Typography.swift +8 -5
  156. package/ios/Uploader/Uploader.swift +0 -9
  157. package/ios/native-kits.podspec +1 -1
  158. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  159. package/package.json +1 -1
  160. package/ios/Colors+Radius+Spacing/MoMoUIKitsResources.swift +0 -2
@@ -2,17 +2,7 @@ package vn.momo.kits.navigation.component
2
2
 
3
3
  import androidx.compose.foundation.background
4
4
  import androidx.compose.foundation.border
5
- import androidx.compose.foundation.layout.Arrangement
6
- import androidx.compose.foundation.layout.Box
7
- import androidx.compose.foundation.layout.Column
8
- import androidx.compose.foundation.layout.Row
9
- import androidx.compose.foundation.layout.Spacer
10
- import androidx.compose.foundation.layout.fillMaxWidth
11
- import androidx.compose.foundation.layout.height
12
- import androidx.compose.foundation.layout.padding
13
- import androidx.compose.foundation.layout.size
14
- import androidx.compose.foundation.layout.width
15
- import androidx.compose.foundation.layout.widthIn
5
+ import androidx.compose.foundation.layout.*
16
6
  import androidx.compose.foundation.shape.CircleShape
17
7
  import androidx.compose.foundation.shape.RoundedCornerShape
18
8
  import androidx.compose.foundation.text.BasicText
@@ -43,7 +33,7 @@ import vn.momo.kits.navigation.component.HeaderTitle.User
43
33
  import vn.momo.kits.platform.getScreenDimensions
44
34
 
45
35
  @Composable
46
- fun HeaderUser(
36
+ internal fun HeaderUser(
47
37
  data: HeaderTitle
48
38
  ) {
49
39
  if (data !is User) return
@@ -367,4 +357,4 @@ private fun RemoteIcon16(url: String) {
367
357
  }
368
358
 
369
359
  @Immutable
370
- data class AvatarUrls(val items: List<String>)
360
+ private data class AvatarUrls(val items: List<String>)
@@ -29,6 +29,7 @@ import vn.momo.kits.navigation.LocalFooterHeightPx
29
29
  import vn.momo.kits.navigation.LocalNavigator
30
30
  import vn.momo.kits.navigation.LocalOptions
31
31
  import vn.momo.kits.navigation.OverplayComponentRegistry
32
+ import kotlin.time.Duration.Companion.milliseconds
32
33
 
33
34
  sealed class SnackBar(open val duration: Long? = null) {
34
35
  data class Custom(
@@ -42,7 +43,7 @@ sealed class SnackBar(open val duration: Long? = null) {
42
43
  }
43
44
 
44
45
  @Composable
45
- fun SnackBar(
46
+ internal fun SnackBar(
46
47
  data: SnackBar,
47
48
  onDismiss: (() -> Unit)?
48
49
  ) {
@@ -95,7 +96,7 @@ fun SnackBar(
95
96
  LaunchedEffect(data.duration) {
96
97
  val duration = data.duration
97
98
  if (duration != null) {
98
- delay(duration)
99
+ delay(duration.milliseconds)
99
100
  navigator.hideSnackBar()
100
101
  }
101
102
  }
@@ -5,13 +5,9 @@ import vn.momo.maxapi.IMaxApi
5
5
  import kotlin.time.Clock
6
6
  import kotlin.time.ExperimentalTime
7
7
 
8
- /**
9
- * Screen tracking state holder
10
- */
11
8
  class ScreenTrackingState {
12
9
  @OptIn(ExperimentalTime::class)
13
- var startTime: Long = Clock.System.now().toEpochMilliseconds()
14
- var endTime: Long = startTime
10
+ var time: Long = Clock.System.now().toEpochMilliseconds()
15
11
  var releaseNavigated: Boolean = false
16
12
  var releaseLoad: Boolean = false
17
13
  var releaseInteraction: Boolean = false
@@ -19,22 +15,10 @@ class ScreenTrackingState {
19
15
  var action: String = "push"
20
16
  }
21
17
 
22
- /**
23
- * Screen tracker for auto tracking events
24
- *
25
- * Tracks 3 main events:
26
- * - auto_screen_navigated: When screen is focused
27
- * - auto_screen_displayed: When screen finished loading
28
- * - auto_screen_interacted: When screen is ready for interaction
29
- */
30
18
  object ScreenTracker {
31
19
 
32
20
  private var lastScreenName: String? = null
33
21
 
34
- /**
35
- * Track screen navigation event
36
- * Called when screen is focused
37
- */
38
22
  fun trackScreenNavigated(
39
23
  maxApi: IMaxApi?,
40
24
  context: MiniAppContext?,
@@ -61,10 +45,6 @@ object ScreenTracker {
61
45
  state.previousScreenName = previousScreen
62
46
  }
63
47
 
64
- /**
65
- * Track screen displayed event
66
- * Called when screen finished loading all elements
67
- */
68
48
  fun trackScreenDisplayed(
69
49
  maxApi: IMaxApi?,
70
50
  context: MiniAppContext?,
@@ -85,10 +65,6 @@ object ScreenTracker {
85
65
  state.releaseLoad = true
86
66
  }
87
67
 
88
- /**
89
- * Track screen interacted event
90
- * Called when screen is ready for user interaction
91
- */
92
68
  fun trackScreenInteracted(
93
69
  maxApi: IMaxApi?,
94
70
  context: MiniAppContext?,
@@ -111,9 +87,6 @@ object ScreenTracker {
111
87
  state.releaseInteraction = true
112
88
  }
113
89
 
114
- /**
115
- * Build base tracking params from MiniAppContext
116
- */
117
90
  private fun buildBaseParams(
118
91
  context: MiniAppContext?,
119
92
  screenName: String,
@@ -128,12 +101,6 @@ object ScreenTracker {
128
101
  )
129
102
  }
130
103
 
131
- /**
132
- * Track popup/modal displayed event
133
- *
134
- * @param popupName name of the popup/modal
135
- * @param parentScreenName the screen that shows the popup
136
- */
137
104
  fun trackPopupDisplayed(
138
105
  maxApi: IMaxApi?,
139
106
  context: MiniAppContext?,
@@ -152,14 +119,8 @@ object ScreenTracker {
152
119
  )
153
120
  }
154
121
 
155
- /**
156
- * Get previous screen name for back navigation detection
157
- */
158
122
  fun getLastScreenName(): String? = lastScreenName
159
123
 
160
- /**
161
- * Reset tracker (for testing or cleanup)
162
- */
163
124
  @Suppress("UNUSED")
164
125
  fun reset() {
165
126
  lastScreenName = null
@@ -36,8 +36,6 @@ internal fun ComposeLottieAnimation(
36
36
  LottieCompositionSpec.JsonString(json)
37
37
  }
38
38
 
39
- // Recolor only the fill/stroke color slots (matching the native lottie-ios per-keypath tint)
40
- // instead of a global ColorFilter.tint, which would flatten a multicolor animation to a silhouette.
41
39
  val dynamicProperties = if (tintColor != null) {
42
40
  rememberLottieDynamicProperties(tintColor) {
43
41
  shapeLayer("**") {
@@ -0,0 +1,9 @@
1
+ package vn.momo.kits.platform
2
+
3
+ import androidx.compose.runtime.Composable
4
+
5
+ // Overrides LocalDensity.fontScale with the live OS Dynamic Type scale so text re-scales while a
6
+ // screen is visible. Wrapped inside the containers so every screen is covered, not just callers of
7
+ // the app-level wrappers.
8
+ @Composable
9
+ expect fun ProvideOsFontScale(content: @Composable () -> Unit)
@@ -43,14 +43,6 @@ fun supportsImePadding(): Boolean = when (val v = getOSVersion()) {
43
43
  is OSVersion.Android -> v.sdk > 29
44
44
  is OSVersion.IOS -> true
45
45
  }
46
-
47
- /**
48
- * @param useCompose when `true`, renders via the pure-Compose Compottie engine instead of the
49
- * platform-native engine (airbnb-lottie on Android, lottie-ios on iOS). Defaults to `false` for
50
- * backward compatibility. Note: when `useCompose = true`, `tintColor` recolors only the fill/stroke
51
- * color slots (matching the native lottie-ios per-keypath tint), so gradient and text-layer colors
52
- * are left untinted; `placedAsOverlay` is a no-op.
53
- */
54
46
  @Composable
55
47
  expect fun LottieAnimation(
56
48
  path: String,
@@ -1,28 +1,13 @@
1
1
  package vn.momo.kits.utils
2
2
 
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.LaunchedEffect
5
- import androidx.compose.runtime.MutableState
6
- import androidx.compose.runtime.getValue
7
- import androidx.compose.runtime.mutableStateOf
8
- import androidx.compose.runtime.remember
3
+ import androidx.compose.runtime.*
9
4
  import org.jetbrains.compose.resources.DrawableResource
10
5
  import org.jetbrains.compose.resources.InternalResourceApi
11
6
  import org.jetbrains.compose.resources.ResourceItem
12
7
  import org.jetbrains.compose.resources.readResourceBytes
13
-
14
- @OptIn(InternalResourceApi::class)
15
- @Composable
16
- fun getResource(name: String): DrawableResource {
17
- return DrawableResource(
18
- "drawable:$name",
19
- setOf(ResourceItem(setOf(), "drawable/$name", -1, -1))
20
- )
21
- }
22
-
23
8
  @OptIn(InternalResourceApi::class)
24
9
  @Composable
25
- fun readJson(name: String): String {
10
+ internal fun readJson(name: String): String {
26
11
  val path = name.plus(".json")
27
12
  val candidatePaths = listOf(
28
13
  path,
@@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable
4
4
  import vn.momo.kits.application.LocalComponentInformation
5
5
 
6
6
  @Composable
7
- fun getComponentId(
7
+ internal fun getComponentId(
8
8
  componentName: String? = null,
9
9
  accessibilityLabel: String? = null,
10
10
  ): String {
@@ -41,8 +41,8 @@ internal fun Modifier.bottomBorder(strokeWidth: Dp, color: Color) = composed(
41
41
  }
42
42
  )
43
43
 
44
- inline fun <T> Boolean.ifTrue(trueCase: T, falseCase: T): T = if (this) trueCase else falseCase
45
- inline fun <T> String.ifNotNull(trueCase: T, falseCase: T): T =
44
+ fun <T> Boolean.ifTrue(trueCase: T, falseCase: T): T = if (this) trueCase else falseCase
45
+ fun <T> String.ifNotNull(trueCase: T, falseCase: T): T =
46
46
  if (this.isBlank()) falseCase else trueCase
47
47
 
48
48
  fun formatNumberToMoney(number: Long, currency: String = "đ"): String {
@@ -91,7 +91,7 @@ fun getAppStatusBarHeight(): Dp {
91
91
  }
92
92
 
93
93
  @Composable
94
- fun getNavigationBarHeight(): Dp {
94
+ internal fun getNavigationBarHeight(): Dp {
95
95
  return if (AppNavigationBar.current == 0.dp) {
96
96
  val systemBottomPadding = WindowInsets.systemBars.asPaddingValues().calculateBottomPadding()
97
97
  if (getPlatformName() == "iOS") {
@@ -13,14 +13,13 @@ private const val STATUS_BAR_TAPPED_NOTIFICATION = "statusBarSelected"
13
13
  internal actual fun RegisterScrollToTop(callback: (() -> Unit)?) {
14
14
  val maxApi = LocalMaxApi.current
15
15
  DisposableEffect(callback) {
16
- val cb = callback
17
- val token: NSObjectProtocol? = if (cb != null) {
16
+ val token: NSObjectProtocol? = if (callback != null) {
18
17
  NSNotificationCenter.defaultCenter.addObserverForName(
19
18
  name = STATUS_BAR_TAPPED_NOTIFICATION,
20
19
  `object` = null,
21
20
  queue = NSOperationQueue.mainQueue,
22
21
  ) { _: NSNotification? ->
23
- runCatching { cb() }.onFailure {
22
+ runCatching { callback() }.onFailure {
24
23
  maxApi?.logFile("[ScrollToTop] callback threw: ${it.message}") {}
25
24
 
26
25
  }
@@ -0,0 +1,66 @@
1
+ package vn.momo.kits.platform
2
+
3
+ import androidx.compose.runtime.Composable
4
+ import androidx.compose.runtime.CompositionLocalProvider
5
+ import androidx.compose.runtime.DisposableEffect
6
+ import androidx.compose.runtime.mutableStateOf
7
+ import androidx.compose.runtime.remember
8
+ import androidx.compose.ui.platform.LocalDensity
9
+ import androidx.compose.ui.unit.Density
10
+ import kotlinx.cinterop.ExperimentalForeignApi
11
+ import kotlinx.cinterop.ObjCAction
12
+ import platform.Foundation.NSNotification
13
+ import platform.Foundation.NSNotificationCenter
14
+ import platform.Foundation.NSSelectorFromString
15
+ import platform.UIKit.UIContentSizeCategoryDidChangeNotification
16
+ import platform.UIKit.UIFont
17
+ import platform.UIKit.UIFontTextStyleBody
18
+ import platform.darwin.NSObject
19
+
20
+ // Compose MP iOS reads LocalDensity.fontScale once at ComposeUIViewController creation and does not
21
+ // recompose it when UIContentSizeCategory changes (Android tracks Configuration.fontScale live). We
22
+ // observe the notification and override LocalDensity.fontScale so scaleSize() recomposes live. The
23
+ // formula matches the SwiftUI kit (UIFont body point size / 17) so both iOS surfaces scale alike.
24
+ private const val DEFAULT_BODY_POINT_SIZE = 17.0
25
+
26
+ private fun currentOsFontScale(): Float =
27
+ (UIFont.preferredFontForTextStyle(UIFontTextStyleBody).pointSize / DEFAULT_BODY_POINT_SIZE).toFloat()
28
+
29
+ @OptIn(ExperimentalForeignApi::class)
30
+ @Composable
31
+ actual fun ProvideOsFontScale(content: @Composable () -> Unit) {
32
+ val osFontScale = remember { mutableStateOf(currentOsFontScale()) }
33
+
34
+ val listener = remember {
35
+ object : NSObject() {
36
+ @Suppress("unused")
37
+ @ObjCAction
38
+ fun contentSizeChanged(arg: NSNotification) {
39
+ osFontScale.value = currentOsFontScale()
40
+ }
41
+ }
42
+ }
43
+
44
+ DisposableEffect(Unit) {
45
+ NSNotificationCenter.defaultCenter.addObserver(
46
+ observer = listener,
47
+ selector = NSSelectorFromString(listener::contentSizeChanged.name + ":"),
48
+ name = UIContentSizeCategoryDidChangeNotification,
49
+ `object` = null,
50
+ )
51
+ onDispose {
52
+ NSNotificationCenter.defaultCenter.removeObserver(
53
+ observer = listener,
54
+ name = UIContentSizeCategoryDidChangeNotification,
55
+ `object` = null,
56
+ )
57
+ }
58
+ }
59
+
60
+ val density = LocalDensity.current
61
+ CompositionLocalProvider(
62
+ LocalDensity provides Density(density.density, osFontScale.value),
63
+ ) {
64
+ content()
65
+ }
66
+ }
@@ -19,8 +19,6 @@ import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
19
19
  import androidx.compose.ui.graphics.Color
20
20
  import androidx.compose.ui.graphics.NativePaint
21
21
  import androidx.compose.ui.graphics.toArgb
22
- import androidx.compose.ui.semantics.SemanticsPropertyKey
23
- import androidx.compose.ui.semantics.semantics
24
22
  import androidx.compose.ui.unit.Dp
25
23
  import androidx.compose.ui.unit.dp
26
24
  import androidx.compose.ui.viewinterop.UIKitInteropProperties
@@ -21,6 +21,7 @@ maxapi = "0.1.1"
21
21
  vanniktechMavenPublish = "0.34.0"
22
22
  kits = "0.159.1-beta.7"
23
23
  nativemaxapi = "0.0.6"
24
+ gif-image = "0.1.2"
24
25
 
25
26
  [libraries]
26
27
  ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor-version" }
@@ -53,6 +54,7 @@ androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "a
53
54
  androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
54
55
  material = { module = "com.google.android.material:material", version.ref = "material" }
55
56
 
57
+ gif-image = { module = "vn.momo.kits:gif-image", version.ref = "gif-image" }
56
58
  [plugins]
57
59
  jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
58
60
  jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
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.2-sp.7
21
+ version=0.162.2-sp.8
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
@@ -41,11 +41,13 @@ public class ApplicationEnvironment: ObservableObject {
41
41
  let applicationContext: MiniAppContext?
42
42
  let composeApi: KitComposeApi?
43
43
  let config: KitConfig?
44
-
45
- public init(applicationContext: MiniAppContext? = nil, composeApi: KitComposeApi? = nil, config: KitConfig? = nil) {
44
+ let maxApi: MaxApi?
45
+
46
+ public init(applicationContext: MiniAppContext? = nil, composeApi: KitComposeApi? = nil, config: KitConfig? = nil, maxApi: MaxApi? = nil) {
46
47
  self.applicationContext = applicationContext
47
48
  self.composeApi = composeApi
48
49
  self.config = config
50
+ self.maxApi = maxApi
49
51
  }
50
52
  }
51
53
 
@@ -143,6 +143,22 @@ public struct HeaderRightWidthKey: PreferenceKey {
143
143
  }
144
144
  }
145
145
 
146
+ // MARK: - Bottom-tab root preference
147
+
148
+ /// Set by `BottomTab` on appear so its enclosing `StackScreen` can detect that
149
+ /// it's hosting a self-contained bottom-tab surface and skip its own bottom
150
+ /// safe-area reservation — mirrors Compose's `Navigation.markAsBottomTabRoot()`
151
+ /// (`navigation.isBottomTabRoot`, read by `StackScreen.kt`'s `MainContent`).
152
+ /// Without this, `BottomTab`'s own internal safe-area handling gets an extra,
153
+ /// unwanted inset stacked on top of it by the outer `StackScreen`, pushing the
154
+ /// tab bar up higher than the true bottom inset.
155
+ public struct IsBottomTabRootKey: PreferenceKey {
156
+ public static var defaultValue: Bool = false
157
+ public static func reduce(value: inout Bool, nextValue: () -> Bool) {
158
+ value = value || nextValue()
159
+ }
160
+ }
161
+
146
162
  // MARK: - Header View
147
163
 
148
164
  public struct Header: View {