@momo-kits/native-kits 0.163.1-beta.1-debug → 0.163.1-beta.10-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 (307) hide show
  1. package/CLAUDE.md +1 -1
  2. package/compose/build.gradle.kts +12 -8
  3. package/compose/build.gradle.kts.backup +11 -7
  4. package/compose/compose.podspec +1 -1
  5. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +30 -3
  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 +6 -9
  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 +5 -16
  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/NavigationContainer.kt +6 -16
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +8 -33
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  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/Colors.kt +19 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +11 -20
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +50 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +22 -21
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +37 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -5
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -2
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +94 -4
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -2
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +5 -6
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +4 -8
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +12 -16
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +121 -84
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +88 -63
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +9 -14
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +13 -31
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +6 -24
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +11 -6
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +2 -1
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +9 -6
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +3 -13
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +3 -2
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +1 -40
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +23 -4
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +10 -7
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +2 -17
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
  101. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +2 -3
  102. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  103. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +26 -5
  104. package/gradle/libs.versions.toml +2 -0
  105. package/gradle.properties +1 -1
  106. package/ios/Application/ApplicationEnvironment.swift +15 -2
  107. package/ios/Application/Components.swift +50 -43
  108. package/ios/Application/FloatingButton.swift +10 -8
  109. package/ios/Application/HeaderRight.swift +79 -45
  110. package/ios/Application/Localize.swift +277 -0
  111. package/ios/Application/MaxApi.swift +18 -0
  112. package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
  113. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
  114. package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
  115. package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
  116. package/ios/Application/Navigation/HeaderTitle.swift +57 -0
  117. package/ios/Application/Navigation/HeaderUser.swift +209 -0
  118. package/ios/Application/Navigation/NavigationContainer.swift +200 -0
  119. package/ios/Application/Navigation/NavigationOptions.swift +109 -0
  120. package/ios/Application/Navigation/Navigator.swift +385 -0
  121. package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
  122. package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
  123. package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
  124. package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
  125. package/ios/Application/Navigation/component/Header.swift +178 -0
  126. package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
  127. package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
  128. package/ios/Application/Screen.swift +2 -1
  129. package/ios/Application/StackScreen.swift +501 -0
  130. package/ios/Avatar/Avatar.swift +193 -0
  131. package/ios/Badge/Badge.swift +11 -13
  132. package/ios/Badge/BadgeRibbon.swift +92 -19
  133. package/ios/BaselineView/BaselineView.swift +163 -0
  134. package/ios/Button/Button.swift +124 -29
  135. package/ios/Carousel/Carousel.swift +196 -0
  136. package/ios/Checkbox/Checkbox.swift +23 -27
  137. package/ios/Chip/Chip.swift +56 -33
  138. package/ios/Collapse/Collapse.swift +192 -0
  139. package/ios/Colors+Radius+Spacing/Colors.swift +20 -17
  140. package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
  141. package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
  142. package/ios/DateTimePicker/DateTimePicker.swift +212 -0
  143. package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
  144. package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
  145. package/ios/DateTimePicker/WheelPicker.swift +165 -0
  146. package/ios/Divider/Divider.swift +16 -0
  147. package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
  148. package/ios/Extensions/Color++.swift +32 -0
  149. package/ios/Icon/Icon.swift +10 -1
  150. package/ios/IconButton/IconButton.swift +140 -0
  151. package/ios/Image/Image.swift +16 -3
  152. package/ios/Information/Information.swift +153 -0
  153. package/ios/Input/ErrorView.swift +3 -1
  154. package/ios/Input/Input.swift +73 -33
  155. package/ios/Input/InputPhoneNumber.swift +34 -21
  156. package/ios/Input/InputSearch.swift +108 -46
  157. package/ios/Input/InputTextArea.swift +135 -64
  158. package/ios/InputDropDown/InputDropDown.swift +201 -0
  159. package/ios/InputMoney/InputMoney.swift +347 -0
  160. package/ios/InputOTP/InputOTP.swift +210 -0
  161. package/ios/Loader/Loader.swift +113 -0
  162. package/ios/MoMoUIKits.podspec +5 -0
  163. package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
  164. package/ios/Pagination/PaginationDot.swift +61 -0
  165. package/ios/Pagination/PaginationNumber.swift +35 -0
  166. package/ios/Pagination/PaginationScroll.swift +101 -0
  167. package/ios/Pagination/PaginationWhiteDot.swift +37 -0
  168. package/ios/Popup/PopupDisplay.swift +13 -16
  169. package/ios/Popup/PopupInput.swift +2 -6
  170. package/ios/Popup/PopupNotify.swift +218 -0
  171. package/ios/Popup/PopupPromotion.swift +16 -8
  172. package/ios/ProgressInfo/ProgressInfo.swift +296 -0
  173. package/ios/Radio/Radio.swift +69 -0
  174. package/ios/Rating/Rating.swift +82 -0
  175. package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +11 -0
  176. package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +38 -0
  177. package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +38 -0
  178. package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +38 -0
  179. package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +6 -0
  180. package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +38 -0
  181. package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +38 -0
  182. package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +38 -0
  183. package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +38 -0
  184. package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +38 -0
  185. package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +38 -0
  186. package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +38 -0
  187. package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +38 -0
  188. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
  189. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
  190. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
  191. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
  192. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
  193. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
  194. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
  195. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
  196. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
  197. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
  198. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
  199. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
  200. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
  201. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
  202. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
  203. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
  204. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
  205. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
  206. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
  207. package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +38 -0
  208. package/ios/Skeleton/Skeleton.swift +99 -0
  209. package/ios/Slider/Slider.swift +237 -0
  210. package/ios/Stepper/Stepper.swift +220 -0
  211. package/ios/Steps/Steps.swift +467 -0
  212. package/ios/SuggestAction/SuggestAction.swift +99 -0
  213. package/ios/Swipeable/SwipeCell.swift +187 -0
  214. package/ios/Swipeable/SwipeCellModel.swift +21 -0
  215. package/ios/Switch/Switch.swift +53 -28
  216. package/ios/TabView/TabView.swift +534 -0
  217. package/ios/Tag/Tag.swift +98 -0
  218. package/ios/Template/TrustBanner/TrustBanner.swift +8 -7
  219. package/ios/Title/Title.swift +269 -0
  220. package/ios/Tooltip/Tooltip.swift +485 -0
  221. package/ios/Typography/FontScaleStore.swift +19 -0
  222. package/ios/Typography/Text.swift +80 -5
  223. package/ios/Typography/Typography.swift +17 -5
  224. package/ios/Uploader/Uploader.swift +174 -0
  225. package/ios/native-kits.podspec +61 -8
  226. package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
  227. package/ios-demo/README.md +120 -0
  228. package/ios-demo/Resources/dot_loading.json +558 -0
  229. package/ios-demo/Resources/icon.json +4052 -0
  230. package/ios-demo/Resources/lottie_circle_loader.json +1 -0
  231. package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
  232. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
  233. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
  234. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
  235. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
  236. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
  237. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
  238. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
  239. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
  240. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
  241. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
  242. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
  243. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
  244. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
  245. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
  246. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
  247. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
  248. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
  249. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +63 -0
  250. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
  251. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
  252. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
  253. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
  254. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
  255. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
  256. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +279 -0
  257. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
  258. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
  259. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
  260. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
  261. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
  262. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
  263. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
  264. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
  265. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
  266. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
  267. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
  268. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +188 -0
  269. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +229 -0
  270. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
  271. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
  272. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
  273. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
  274. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
  275. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
  276. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
  277. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
  278. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
  279. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
  280. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
  281. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
  282. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
  283. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
  284. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
  285. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
  286. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
  287. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
  288. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
  289. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
  290. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
  291. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
  292. package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +51 -0
  293. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
  294. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
  295. package/package.json +1 -1
  296. package/publish.sh +53 -0
  297. package/scripts/gen-ios-color.mjs +136 -0
  298. package/example/ios/Example.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  299. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  300. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
  301. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
  302. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
  303. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
  304. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
  305. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
  306. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
  307. package/local.properties +0 -8
@@ -13,7 +13,7 @@ import vn.momo.kits.const.Typography
13
13
  import vn.momo.kits.modifier.setAutomationId
14
14
 
15
15
  @Composable
16
- fun HeaderTitle(
16
+ internal fun HeaderTitle(
17
17
  title: String = "",
18
18
  color: Color? = null,
19
19
  modifier: Modifier = Modifier.fillMaxWidth(),
@@ -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
@@ -5,10 +5,12 @@ import androidx.compose.foundation.background
5
5
  import androidx.compose.foundation.layout.Box
6
6
  import androidx.compose.foundation.layout.fillMaxSize
7
7
  import androidx.compose.runtime.Composable
8
+ import androidx.compose.runtime.LaunchedEffect
8
9
  import androidx.compose.runtime.getValue
10
+ import androidx.compose.runtime.rememberUpdatedState
11
+ import androidx.compose.runtime.snapshotFlow
9
12
  import androidx.compose.ui.Modifier
10
13
  import androidx.compose.ui.graphics.Color
11
- import io.github.alexzhirkevich.compottie.Compottie
12
14
  import io.github.alexzhirkevich.compottie.ExperimentalCompottieApi
13
15
  import io.github.alexzhirkevich.compottie.LottieCompositionSpec
14
16
  import io.github.alexzhirkevich.compottie.animateLottieCompositionAsState
@@ -23,6 +25,9 @@ internal fun ComposeLottieAnimation(
23
25
  path: String,
24
26
  tintColor: Color?,
25
27
  bgColor: Color?,
28
+ iterations: Int,
29
+ isPlaying: Boolean,
30
+ onEvent: ((String) -> Unit)?,
26
31
  modifier: Modifier,
27
32
  ) {
28
33
  val json = readJson(path)
@@ -36,8 +41,6 @@ internal fun ComposeLottieAnimation(
36
41
  LottieCompositionSpec.JsonString(json)
37
42
  }
38
43
 
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
44
  val dynamicProperties = if (tintColor != null) {
42
45
  rememberLottieDynamicProperties(tintColor) {
43
46
  shapeLayer("**") {
@@ -51,9 +54,25 @@ internal fun ComposeLottieAnimation(
51
54
 
52
55
  val lottieState = animateLottieCompositionAsState(
53
56
  composition = composition,
54
- iterations = Compottie.IterateForever,
57
+ iterations = iterations,
58
+ isPlaying = isPlaying,
59
+ restartOnPlay = false,
55
60
  )
56
61
 
62
+ val currentOnEvent by rememberUpdatedState(onEvent)
63
+
64
+ LaunchedEffect(isPlaying) {
65
+ currentOnEvent?.invoke(if (isPlaying) LottieEvent.Start else LottieEvent.Pause)
66
+ }
67
+
68
+ LaunchedEffect(lottieState) {
69
+ var armed = false
70
+ snapshotFlow { lottieState.isAtEnd }.collect { atEnd ->
71
+ if (!atEnd) armed = true
72
+ else if (armed) { armed = false; currentOnEvent?.invoke(LottieEvent.Finish) }
73
+ }
74
+ }
75
+
57
76
  Box(modifier.background(bgColor ?: Color.Transparent)) {
58
77
  Image(
59
78
  painter = rememberLottiePainter(
@@ -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,20 +43,23 @@ fun supportsImePadding(): Boolean = when (val v = getOSVersion()) {
43
43
  is OSVersion.Android -> v.sdk > 29
44
44
  is OSVersion.IOS -> true
45
45
  }
46
+ const val LottieIterateForever: Int = Int.MAX_VALUE
47
+
48
+ object LottieEvent {
49
+ const val Start = "start"
50
+ const val Pause = "pause"
51
+ const val Finish = "finish"
52
+ }
46
53
 
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
54
  @Composable
55
55
  expect fun LottieAnimation(
56
56
  path: String,
57
57
  tintColor: Color? = null,
58
58
  bgColor: Color? = null,
59
59
  placedAsOverlay: Boolean = false,
60
+ iterations: Int = LottieIterateForever,
61
+ isPlaying: Boolean = true,
62
+ onEvent: ((String) -> Unit)? = null,
60
63
  modifier: Modifier = Modifier,
61
64
  useCompose: Boolean = false
62
65
  )
@@ -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
+ }
@@ -11,6 +11,7 @@ import androidx.compose.runtime.LaunchedEffect
11
11
  import androidx.compose.runtime.getValue
12
12
  import androidx.compose.runtime.mutableStateOf
13
13
  import androidx.compose.runtime.remember
14
+ import androidx.compose.runtime.rememberUpdatedState
14
15
  import androidx.compose.runtime.setValue
15
16
  import androidx.compose.ui.ExperimentalComposeUiApi
16
17
  import androidx.compose.ui.InternalComposeUiApi
@@ -19,8 +20,6 @@ import androidx.compose.ui.backhandler.LocalCompatNavigationEventDispatcherOwner
19
20
  import androidx.compose.ui.graphics.Color
20
21
  import androidx.compose.ui.graphics.NativePaint
21
22
  import androidx.compose.ui.graphics.toArgb
22
- import androidx.compose.ui.semantics.SemanticsPropertyKey
23
- import androidx.compose.ui.semantics.semantics
24
23
  import androidx.compose.ui.unit.Dp
25
24
  import androidx.compose.ui.unit.dp
26
25
  import androidx.compose.ui.viewinterop.UIKitInteropProperties
@@ -98,20 +97,41 @@ actual fun LottieAnimation(
98
97
  tintColor: Color?,
99
98
  bgColor: Color?,
100
99
  placedAsOverlay: Boolean,
100
+ iterations: Int,
101
+ isPlaying: Boolean,
102
+ onEvent: ((String) -> Unit)?,
101
103
  modifier: Modifier,
102
104
  useCompose: Boolean
103
105
  ) {
104
106
  if (useCompose) {
105
- ComposeLottieAnimation(path, tintColor, bgColor, modifier)
107
+ ComposeLottieAnimation(path, tintColor, bgColor, iterations, isPlaying, onEvent, modifier)
106
108
  return
107
109
  }
108
110
 
111
+ val loopCount = if (iterations == LottieIterateForever) -1.0 else iterations.toDouble()
112
+
109
113
  var animation by remember { mutableStateOf<CompatibleAnimation?>(null) }
114
+ val animationView = remember { mutableStateOf<CompatibleAnimationView?>(null) }
110
115
 
111
116
  LaunchedEffect(Unit) {
112
117
  animation = CompatibleAnimation(name = "compose-resources/composeResources/vn.momo.compose.resources/".plus(path), subdirectory = null, NSBundle.mainBundle)
113
118
  }
114
119
 
120
+ val currentOnEvent by rememberUpdatedState(onEvent)
121
+
122
+ LaunchedEffect(isPlaying) {
123
+ currentOnEvent?.invoke(if (isPlaying) LottieEvent.Start else LottieEvent.Pause)
124
+ }
125
+
126
+ LaunchedEffect(animationView.value, isPlaying) {
127
+ val view = animationView.value ?: return@LaunchedEffect
128
+ if (isPlaying) {
129
+ view.playWithCompletion(completion = { finished -> if (finished) currentOnEvent?.invoke(LottieEvent.Finish) })
130
+ } else {
131
+ view.pause()
132
+ }
133
+ }
134
+
115
135
  when (val value = animation) {
116
136
  null -> {
117
137
  Box(modifier)
@@ -128,7 +148,7 @@ actual fun LottieAnimation(
128
148
 
129
149
  setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
130
150
 
131
- setLoopAnimationCount(-1.0)
151
+ setLoopAnimationCount(loopCount)
132
152
  setAnimationSpeed(1.0)
133
153
 
134
154
  if (tintColor != null) {
@@ -142,12 +162,13 @@ actual fun LottieAnimation(
142
162
  setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke.Color"))
143
163
  }
144
164
 
145
- play()
165
+ animationView.value = this
146
166
  }
147
167
  },
148
168
 
149
169
  update = { view ->
150
170
  view.setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
171
+ view.setLoopAnimationCount(loopCount)
151
172
 
152
173
  if (tintColor != null) {
153
174
  val uiColor = tintColor.toUIColor()
@@ -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.163.1-beta.1
21
+ version=0.163.1-beta.10
22
22
 
23
23
  repo=GitLab
24
24
  url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
@@ -41,10 +41,23 @@ 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
51
+ }
52
+ }
53
+
54
+ private struct ApplicationEnvironmentKey: EnvironmentKey {
55
+ static let defaultValue = ApplicationEnvironment()
56
+ }
57
+
58
+ public extension EnvironmentValues {
59
+ var applicationEnvironment: ApplicationEnvironment {
60
+ get { self[ApplicationEnvironmentKey.self] }
61
+ set { self[ApplicationEnvironmentKey.self] = newValue }
49
62
  }
50
63
  }