@momo-kits/native-kits 0.162.6-debug → 0.163.1-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 (123) hide show
  1. package/CLAUDE.md +78 -0
  2. package/compose/build.gradle.kts +8 -11
  3. package/compose/build.gradle.kts.backup +7 -10
  4. package/compose/compose.podspec +1 -1
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +7 -2
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +5 -12
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +24 -6
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +19 -4
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +10 -1
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +16 -5
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +101 -6
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +15 -4
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +33 -8
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +25 -22
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +29 -27
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +26 -3
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +30 -27
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +13 -3
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +5 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +11 -3
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +18 -3
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +11 -3
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +5 -1
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +59 -84
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +71 -13
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +51 -10
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +1 -6
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +21 -4
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +75 -16
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +26 -5
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +11 -3
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +36 -15
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +9 -3
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +28 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +13 -2
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +10 -4
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +28 -3
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +47 -8
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +25 -4
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +11 -2
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +17 -1
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +6 -1
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +111 -50
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +5 -1
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +8 -7
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +12 -1
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +96 -4
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +12 -2
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +21 -9
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +14 -9
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +11 -8
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +40 -24
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +1 -1
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +5 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +2 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +4 -94
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +2 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +5 -1
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +15 -5
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +14 -65
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +33 -48
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +55 -56
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +9 -3
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +31 -13
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +24 -6
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +6 -11
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +1 -2
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +3 -6
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +13 -3
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +2 -3
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +40 -1
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +2 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +8 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +17 -2
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
  91. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +3 -2
  92. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +2 -0
  93. package/example/ios/Example.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  94. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  95. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
  96. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
  97. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
  98. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
  99. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
  100. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
  101. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +46 -0
  102. package/gradle.properties +1 -1
  103. package/ios/Application/ApplicationEnvironment.swift +0 -1
  104. package/ios/Application/Components.swift +0 -1
  105. package/ios/Application/FloatingButton.swift +0 -1
  106. package/ios/Badge/Badge.swift +0 -1
  107. package/ios/Badge/BadgeRibbon.swift +0 -2
  108. package/ios/Button/Button.swift +1 -1
  109. package/ios/Checkbox/Checkbox.swift +0 -1
  110. package/ios/Input/Input.swift +0 -1
  111. package/ios/Input/InputPhoneNumber.swift +0 -1
  112. package/ios/Input/InputSearch.swift +0 -3
  113. package/ios/Input/InputTextArea.swift +0 -1
  114. package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
  115. package/ios/Popup/PopupDisplay.swift +0 -6
  116. package/ios/Popup/PopupInput.swift +0 -2
  117. package/ios/Template/TrustBanner/TrustBanner.swift +0 -2
  118. package/ios/Typography/Text.swift +7 -13
  119. package/ios/Typography/Typography.swift +8 -22
  120. package/local.properties +8 -0
  121. package/package.json +1 -1
  122. package/ios/Application/FontScaleStore.swift +0 -59
  123. package/ios/Information/Information.swift +0 -151
@@ -1,7 +1,5 @@
1
1
  package vn.momo.kits.navigation.component
2
2
 
3
- import vn.momo.kits.modifier.InternalApi
4
-
5
3
  import androidx.compose.animation.core.animateFloatAsState
6
4
  import androidx.compose.foundation.background
7
5
  import androidx.compose.foundation.border
@@ -44,14 +42,12 @@ import vn.momo.kits.navigation.LocalOptions
44
42
  import vn.momo.kits.navigation.LocalScrollState
45
43
  import vn.momo.kits.navigation.getInputSearchType
46
44
 
47
- @InternalApi
48
45
  const val HEADER_HEIGHT = 52
49
- internal enum class InputSearchType { None, Header, Animated }
46
+ enum class InputSearchType { None, Header, Animated }
50
47
  enum class TitlePosition { LEFT, CENTER }
51
48
 
52
- @Suppress("FrequentlyChangingValue")
53
49
  @Composable
54
- internal fun Header(onBackHandler: (() -> Unit)? = null) {
50
+ fun Header(onBackHandler: (() -> Unit)? = null) {
55
51
  val options = LocalOptions.current
56
52
  val navigator = LocalNavigator.current
57
53
  val scrollState = LocalScrollState.current
@@ -110,7 +106,7 @@ internal fun Header(onBackHandler: (() -> Unit)? = null) {
110
106
  backgroundButton = headerColor.backgroundButton,
111
107
  tintIconColor = headerColor.tintIconColor,
112
108
  onBackHandler = {
113
- navigator.onBackSafe { }
109
+ onBackHandler?.invoke() ?: navigator.onBackSafe { }
114
110
  }
115
111
  )
116
112
  Spacer(Modifier.width(Spacing.S))
@@ -172,7 +168,7 @@ private fun BackButton(borderColor: Color, backgroundButton: Color, tintIconColo
172
168
  }
173
169
 
174
170
  @Composable
175
- internal fun HeaderContent(
171
+ fun HeaderContent(
176
172
  headerTitle: HeaderTitle,
177
173
  tintIconColor: Color,
178
174
  titlePosition: TitlePosition = TitlePosition.LEFT,
@@ -203,7 +199,7 @@ internal fun HeaderContent(
203
199
  }
204
200
 
205
201
  @Composable
206
- internal fun VerticalShadow(opacity: Float){
202
+ fun VerticalShadow(opacity: Float){
207
203
  if(opacity == 1f){
208
204
  Box(modifier = Modifier
209
205
  .fillMaxWidth()
@@ -286,9 +282,8 @@ data class HeaderBackProps(
286
282
  val preventBack: PopupNotifyProps? = null,
287
283
  )
288
284
 
289
- @InternalApi
290
285
  data class HeaderColor(val tintIconColor: Color, val backgroundButton: Color, val borderColor: Color)
291
- internal fun getHeaderColor(headerType: HeaderType, opacity: Float, tintColor: Color?, defaultColor: Color): HeaderColor{
286
+ fun getHeaderColor(headerType: HeaderType, opacity: Float, tintColor: Color?, defaultColor: Color): HeaderColor{
292
287
  return if(headerType is HeaderType.Animated) {
293
288
  if (opacity == 1f || !headerType.isSurface)
294
289
  HeaderColor(
@@ -27,9 +27,8 @@ enum class AnimatedHeaderRatio(val value: Float){
27
27
  RATIO_3_2(3f / 2f)
28
28
  }
29
29
 
30
- @Suppress("FrequentlyChangingValue")
31
30
  @Composable
32
- internal fun HeaderBackground() {
31
+ fun HeaderBackground() {
33
32
  val density = LocalDensity.current
34
33
  val theme = AppTheme.current
35
34
  val options = LocalOptions.current
@@ -1,7 +1,5 @@
1
1
  package vn.momo.kits.navigation.component
2
2
 
3
- import vn.momo.kits.modifier.InternalApi
4
-
5
3
  import androidx.compose.foundation.background
6
4
  import androidx.compose.foundation.border
7
5
  import androidx.compose.foundation.layout.Arrangement
@@ -37,7 +35,6 @@ import vn.momo.kits.modifier.activeOpacityClickable
37
35
  import vn.momo.kits.navigation.LocalMaxApi
38
36
 
39
37
  @Composable
40
- @InternalApi
41
38
  fun HeaderRight(
42
39
  headerRight: HeaderRight,
43
40
  tintColor: Color? = null,
@@ -60,7 +57,7 @@ fun HeaderRight(
60
57
  }
61
58
 
62
59
  @Composable
63
- internal fun Toolkit(
60
+ fun Toolkit(
64
61
  headerRight: HeaderRight.Toolkit,
65
62
  tintColor: Color? = null,
66
63
  headerColor: HeaderColor
@@ -189,7 +186,7 @@ internal fun Toolkit(
189
186
 
190
187
 
191
188
  @Composable
192
- internal fun NavigationButton(
189
+ fun NavigationButton(
193
190
  disabled: Boolean,
194
191
  icon: String,
195
192
  showBadge: Boolean? = false,
@@ -303,7 +300,7 @@ data class Tool(
303
300
  }
304
301
  }
305
302
 
306
- private data class NavigationButtonConfig(
303
+ data class NavigationButtonConfig(
307
304
  val icon: String,
308
305
  val onPress: () -> Unit
309
306
  )
@@ -13,7 +13,7 @@ import vn.momo.kits.const.Typography
13
13
  import vn.momo.kits.modifier.setAutomationId
14
14
 
15
15
  @Composable
16
- internal fun HeaderTitle(
16
+ fun HeaderTitle(
17
17
  title: String = "",
18
18
  color: Color? = null,
19
19
  modifier: Modifier = Modifier.fillMaxWidth(),
@@ -2,7 +2,17 @@ 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.*
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
6
16
  import androidx.compose.foundation.shape.CircleShape
7
17
  import androidx.compose.foundation.shape.RoundedCornerShape
8
18
  import androidx.compose.foundation.text.BasicText
@@ -33,7 +43,7 @@ import vn.momo.kits.navigation.component.HeaderTitle.User
33
43
  import vn.momo.kits.platform.getScreenDimensions
34
44
 
35
45
  @Composable
36
- internal fun HeaderUser(
46
+ fun HeaderUser(
37
47
  data: HeaderTitle
38
48
  ) {
39
49
  if (data !is User) return
@@ -357,4 +367,4 @@ private fun RemoteIcon16(url: String) {
357
367
  }
358
368
 
359
369
  @Immutable
360
- private data class AvatarUrls(val items: List<String>)
370
+ data class AvatarUrls(val items: List<String>)
@@ -29,7 +29,6 @@ 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
33
32
 
34
33
  sealed class SnackBar(open val duration: Long? = null) {
35
34
  data class Custom(
@@ -43,7 +42,7 @@ sealed class SnackBar(open val duration: Long? = null) {
43
42
  }
44
43
 
45
44
  @Composable
46
- internal fun SnackBar(
45
+ fun SnackBar(
47
46
  data: SnackBar,
48
47
  onDismiss: (() -> Unit)?
49
48
  ) {
@@ -96,7 +95,7 @@ internal fun SnackBar(
96
95
  LaunchedEffect(data.duration) {
97
96
  val duration = data.duration
98
97
  if (duration != null) {
99
- delay(duration.milliseconds)
98
+ delay(duration)
100
99
  navigator.hideSnackBar()
101
100
  }
102
101
  }
@@ -5,9 +5,13 @@ 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
+ */
8
11
  class ScreenTrackingState {
9
12
  @OptIn(ExperimentalTime::class)
10
- var time: Long = Clock.System.now().toEpochMilliseconds()
13
+ var startTime: Long = Clock.System.now().toEpochMilliseconds()
14
+ var endTime: Long = startTime
11
15
  var releaseNavigated: Boolean = false
12
16
  var releaseLoad: Boolean = false
13
17
  var releaseInteraction: Boolean = false
@@ -15,10 +19,22 @@ class ScreenTrackingState {
15
19
  var action: String = "push"
16
20
  }
17
21
 
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
+ */
18
30
  object ScreenTracker {
19
31
 
20
32
  private var lastScreenName: String? = null
21
33
 
34
+ /**
35
+ * Track screen navigation event
36
+ * Called when screen is focused
37
+ */
22
38
  fun trackScreenNavigated(
23
39
  maxApi: IMaxApi?,
24
40
  context: MiniAppContext?,
@@ -45,6 +61,10 @@ object ScreenTracker {
45
61
  state.previousScreenName = previousScreen
46
62
  }
47
63
 
64
+ /**
65
+ * Track screen displayed event
66
+ * Called when screen finished loading all elements
67
+ */
48
68
  fun trackScreenDisplayed(
49
69
  maxApi: IMaxApi?,
50
70
  context: MiniAppContext?,
@@ -65,6 +85,10 @@ object ScreenTracker {
65
85
  state.releaseLoad = true
66
86
  }
67
87
 
88
+ /**
89
+ * Track screen interacted event
90
+ * Called when screen is ready for user interaction
91
+ */
68
92
  fun trackScreenInteracted(
69
93
  maxApi: IMaxApi?,
70
94
  context: MiniAppContext?,
@@ -87,6 +111,9 @@ object ScreenTracker {
87
111
  state.releaseInteraction = true
88
112
  }
89
113
 
114
+ /**
115
+ * Build base tracking params from MiniAppContext
116
+ */
90
117
  private fun buildBaseParams(
91
118
  context: MiniAppContext?,
92
119
  screenName: String,
@@ -101,6 +128,12 @@ object ScreenTracker {
101
128
  )
102
129
  }
103
130
 
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
+ */
104
137
  fun trackPopupDisplayed(
105
138
  maxApi: IMaxApi?,
106
139
  context: MiniAppContext?,
@@ -119,8 +152,14 @@ object ScreenTracker {
119
152
  )
120
153
  }
121
154
 
155
+ /**
156
+ * Get previous screen name for back navigation detection
157
+ */
122
158
  fun getLastScreenName(): String? = lastScreenName
123
159
 
160
+ /**
161
+ * Reset tracker (for testing or cleanup)
162
+ */
124
163
  @Suppress("UNUSED")
125
164
  fun reset() {
126
165
  lastScreenName = null
@@ -36,6 +36,8 @@ 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.
39
41
  val dynamicProperties = if (tintColor != null) {
40
42
  rememberLottieDynamicProperties(tintColor) {
41
43
  shapeLayer("**") {
@@ -43,6 +43,14 @@ 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
+ */
46
54
  @Composable
47
55
  expect fun LottieAnimation(
48
56
  path: String,
@@ -1,13 +1,28 @@
1
1
  package vn.momo.kits.utils
2
2
 
3
- import androidx.compose.runtime.*
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
4
9
  import org.jetbrains.compose.resources.DrawableResource
5
10
  import org.jetbrains.compose.resources.InternalResourceApi
6
11
  import org.jetbrains.compose.resources.ResourceItem
7
12
  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
+
8
23
  @OptIn(InternalResourceApi::class)
9
24
  @Composable
10
- internal fun readJson(name: String): String {
25
+ fun readJson(name: String): String {
11
26
  val path = name.plus(".json")
12
27
  val candidatePaths = listOf(
13
28
  path,
@@ -4,7 +4,7 @@ import androidx.compose.runtime.Composable
4
4
  import vn.momo.kits.application.LocalComponentInformation
5
5
 
6
6
  @Composable
7
- internal fun getComponentId(
7
+ 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
- fun <T> Boolean.ifTrue(trueCase: T, falseCase: T): T = if (this) trueCase else falseCase
45
- fun <T> String.ifNotNull(trueCase: T, falseCase: T): T =
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 =
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
- internal fun getNavigationBarHeight(): Dp {
94
+ 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,13 +13,14 @@ 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 token: NSObjectProtocol? = if (callback != null) {
16
+ val cb = callback
17
+ val token: NSObjectProtocol? = if (cb != null) {
17
18
  NSNotificationCenter.defaultCenter.addObserverForName(
18
19
  name = STATUS_BAR_TAPPED_NOTIFICATION,
19
20
  `object` = null,
20
21
  queue = NSOperationQueue.mainQueue,
21
22
  ) { _: NSNotification? ->
22
- runCatching { callback() }.onFailure {
23
+ runCatching { cb() }.onFailure {
23
24
  maxApi?.logFile("[ScrollToTop] callback threw: ${it.message}") {}
24
25
 
25
26
  }
@@ -19,6 +19,8 @@ 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
22
24
  import androidx.compose.ui.unit.Dp
23
25
  import androidx.compose.ui.unit.dp
24
26
  import androidx.compose.ui.viewinterop.UIKitInteropProperties
@@ -0,0 +1,14 @@
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>SchemeUserState</key>
6
+ <dict>
7
+ <key>Example.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,5 @@
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
+ </plist>
@@ -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 = "3B6FB503A75BF5BC1FA6F30BC06B9D28"
18
+ BuildableName = "MoMoUIKits.framework"
19
+ BlueprintName = "MoMoUIKits"
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 = "0AEE99A309977BD12A049FF48AF9BA4B"
18
+ BuildableName = "Pods_Example.framework"
19
+ BlueprintName = "Pods-Example"
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 = "3847153A6E5EEFB86565BA840768F429"
18
+ BuildableName = "SDWebImage.framework"
19
+ BlueprintName = "SDWebImage"
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 = "92EBFA3E7005B4C18A9C0B44324EB80F"
18
+ BuildableName = "SDWebImageSwiftUI.framework"
19
+ BlueprintName = "SDWebImageSwiftUI"
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>