@momo-kits/native-kits 0.169.4 → 0.169.5-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 (148) hide show
  1. package/CLAUDE.md +1 -1
  2. package/PUBLISH_GUIDE.md +3 -10
  3. package/build.gradle.kts +11 -0
  4. package/compose/build.gradle.kts +198 -0
  5. package/compose/compose.podspec +47 -0
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +20 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +154 -0
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +62 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1071 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +542 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +195 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +478 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +265 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +223 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +185 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +363 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +308 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +330 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +220 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +207 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +92 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +560 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +125 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +207 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +501 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +236 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +17 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +293 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +187 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +316 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +393 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +153 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +113 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +205 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +422 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +739 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +239 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +423 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +94 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +97 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +203 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +108 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +456 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +399 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +204 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +114 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +76 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +22 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +118 -0
  125. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
  128. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  130. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +219 -0
  131. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
  132. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +144 -0
  133. package/gradle/libs.versions.toml +69 -0
  134. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  135. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  136. package/gradle.properties +24 -0
  137. package/gradlew +252 -0
  138. package/gradlew.bat +94 -0
  139. package/ios/Navigation/BottomTab/BottomTabBar.swift +21 -6
  140. package/ios/Navigation/BottomTab/TabBarMetrics.swift +4 -0
  141. package/ios/Typography/FontScale.swift +28 -5
  142. package/ios/native-kits.podspec +1 -1
  143. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  144. package/ios-demo/README.md +120 -0
  145. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +21 -9
  146. package/package.json +1 -4
  147. package/publish.sh +10 -36
  148. package/settings.gradle.kts +64 -0
@@ -21,22 +21,32 @@ public struct FontScale: Equatable {
21
21
  public let osFontScale: CGFloat
22
22
  // AI-GENERATED START: device scale from the app window, not UIScreen.main (fixed to one display on iPhone Duo)
23
23
  public let windowShortSide: CGFloat
24
+ /// Opt-in ceiling (Compose's `MiniAppContext.scaleSizeMaxRate`): when set, the result never
25
+ /// exceeds size × maxScaleRate, in both the userScaleRate path and the OS path. nil keeps the
26
+ /// old behavior. Used by `CappedFontScale` for the bottom-tab labels.
27
+ public let maxScaleRate: CGFloat?
24
28
 
25
29
  public init(
26
30
  userScaleRate: CGFloat = 1,
27
31
  useOSScaleRate: Bool = true,
28
32
  osFontScale: CGFloat = 1,
29
- windowShortSide: CGFloat? = nil
33
+ windowShortSide: CGFloat? = nil,
34
+ maxScaleRate: CGFloat? = nil
30
35
  ) {
31
36
  self.userScaleRate = userScaleRate
32
37
  self.useOSScaleRate = useOSScaleRate
33
38
  self.osFontScale = osFontScale
34
39
  self.windowShortSide = windowShortSide ?? DesignSystemKits.currentWindowShortSide()
40
+ self.maxScaleRate = maxScaleRate
35
41
  }
36
42
 
37
43
  /// `callAsFunction` so call sites keep reading like Compose's `scaleSize(16)`.
38
44
  public func callAsFunction(_ size: CGFloat) -> CGFloat {
39
- guard useOSScaleRate else { return size * userScaleRate }
45
+ func cap(_ scaled: CGFloat) -> CGFloat {
46
+ guard let maxScaleRate else { return scaled }
47
+ return min(scaled, size * maxScaleRate)
48
+ }
49
+ guard useOSScaleRate else { return cap(size * userScaleRate) }
40
50
 
41
51
  // Short side, not width: landscape must not inflate every font (and so every popup's height).
42
52
  let deviceScale = windowShortSide / Self.defaultScreenSize
@@ -48,9 +58,21 @@ public struct FontScale: Equatable {
48
58
  deviceScaled = min(size * deviceScale, size + Self.maxDeviceScale)
49
59
  }
50
60
  if osFontScale > 1 {
51
- osScaled = min(size * osFontScale, size * Self.maxFontScale)
61
+ osScaled = min(size * osFontScale, size * (maxScaleRate ?? Self.maxFontScale))
52
62
  }
53
- return max(deviceScaled, osScaled)
63
+ return cap(max(deviceScaled, osScaled))
64
+ }
65
+
66
+ /// A copy that caps the scale at `rate` while keeping the host/OS inputs — the SwiftUI mirror of
67
+ /// Compose's `CappedFontScale` wrapper.
68
+ public func cappedAt(_ rate: CGFloat) -> FontScale {
69
+ FontScale(
70
+ userScaleRate: userScaleRate,
71
+ useOSScaleRate: useOSScaleRate,
72
+ osFontScale: osFontScale,
73
+ windowShortSide: windowShortSide,
74
+ maxScaleRate: rate
75
+ )
54
76
  }
55
77
 
56
78
  /// `.system(size:)` is a fixed-size font — SwiftUI does not Dynamic-Type it — so the scale has to
@@ -68,8 +90,9 @@ public struct FontScale: Equatable {
68
90
  useOSScaleRate: useOSScaleRate ?? self.useOSScaleRate,
69
91
  osFontScale: osFontScale,
70
92
  // AI-GENERATED START: keep the window size through context overrides
71
- windowShortSide: windowShortSide
93
+ windowShortSide: windowShortSide,
72
94
  // AI-GENERATED END: keep the window size through context overrides
95
+ maxScaleRate: maxScaleRate
73
96
  )
74
97
  }
75
98
  }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.169.4'
3
+ s.version = '0.169.5-beta.1'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.169.4'
3
+ s.version = '0.169.5-beta.1'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -0,0 +1,120 @@
1
+ # MoMoUIKitsDemo
2
+
3
+ SwiftUI demo browser for `MoMoUIKits`.
4
+
5
+ The package can optionally host a Compose UIKits screen by receiving a
6
+ `UIViewController` factory from the host app. It does not import the KMP
7
+ `shared` module directly.
8
+
9
+ SwiftUI mode reuses the full demo screen set from
10
+ `sample/iosApp/iosApp/Demo`, including the sample `HomeView` registry and demo
11
+ screens for all currently available components.
12
+
13
+ ## CocoaPods
14
+
15
+ In the host app `Podfile`, include both local pods:
16
+
17
+ ```ruby
18
+ pod 'MoMoUIKits', :path => '../momo-native-kits/ios/native-kits.podspec'
19
+ pod 'MoMoUIKitsDemo', :path => '../momo-native-kits/ios-demo'
20
+ ```
21
+
22
+ Adjust the relative paths to match the host app checkout.
23
+
24
+ ## Host App Usage
25
+
26
+ ```swift
27
+ import MoMoUIKitsDemo
28
+ import shared
29
+
30
+ class UIKitsViewController: BaseComposeAppViewController {
31
+ override func getViewController() -> UIViewController? {
32
+ let params = self.application.data as? [String: Any]
33
+
34
+ return MoMoUIKitsDemoViewControllerFactory.make(
35
+ context: MoMoUIKitsDemoContext(
36
+ appId: params?["appId"] as? String ?? "",
37
+ appCode: params?["code"] as? String ?? "",
38
+ appName: params?["name"] as? String,
39
+ appIcon: params?["icon"] as? String ?? ""
40
+ ),
41
+ composeViewController: {
42
+ UIKitsScreenComposeViewControllerKt.UIKitsScreenComposeViewController(
43
+ params: params
44
+ )
45
+ }
46
+ )
47
+ }
48
+
49
+ override func viewDidDisappear(_ animated: Bool) {
50
+ super.viewDidDisappear(animated)
51
+ composeViewController = nil
52
+ }
53
+ }
54
+ ```
55
+
56
+ If the host does not pass `composeViewController`, the demo opens directly in
57
+ SwiftUI mode.
58
+
59
+ ## Included SwiftUI Demos
60
+
61
+ The pod includes the sample demo screens for:
62
+
63
+ - Animated Header
64
+ - Avatar
65
+ - Badge
66
+ - Baseline View
67
+ - Bottom Tab
68
+ - Button
69
+ - Carousel
70
+ - Checkbox
71
+ - Chip
72
+ - Collapse
73
+ - DateTimePicker
74
+ - Divider
75
+ - Header User
76
+ - Icon Button
77
+ - Image
78
+ - Information
79
+ - Input
80
+ - Input DropDown
81
+ - Input Money
82
+ - Input OTP
83
+ - Input Phone Number
84
+ - Input Search
85
+ - Input TextArea
86
+ - Loader
87
+ - Navigation
88
+ - Pagination
89
+ - Popup Display
90
+ - Popup Notify
91
+ - Popup Promotion
92
+ - Progress Info
93
+ - Radio
94
+ - Rating
95
+ - Skeleton
96
+ - Slider
97
+ - SnackBar
98
+ - Stepper
99
+ - Steps
100
+ - Suggest Action
101
+ - Swipe
102
+ - Switch
103
+ - TabView
104
+ - Tag
105
+ - Theme
106
+ - Title
107
+ - Tooltip
108
+ - Typography
109
+ - Uploader
110
+
111
+ ## Validation Notes
112
+
113
+ Validated locally with:
114
+
115
+ ```sh
116
+ pod ipc spec ios/MoMoUIKits.podspec
117
+ pod ipc spec ios-demo/MoMoUIKitsDemo.podspec
118
+ pod lib lint ios/MoMoUIKits.podspec --allow-warnings --skip-import-validation
119
+ pod lib lint ios-demo/MoMoUIKitsDemo.podspec --allow-warnings --skip-import-validation --include-podspecs=ios/MoMoUIKits.podspec
120
+ ```
@@ -7,6 +7,7 @@
7
7
  // change rebuilds the bar below. Must be hosted inside a `NavigationContainer`.
8
8
  //
9
9
 
10
+ import Combine
10
11
  import Lottie
11
12
  import MoMoUIKits
12
13
  import SwiftUI
@@ -54,14 +55,23 @@ private let ctaLottieSize: CGFloat = 77
54
55
  private let ctaLottieButtonOffset: CGFloat = 5
55
56
  private let ctaLottieLabelOffset: CGFloat = 28
56
57
 
57
- /// A Lottie bundled with the demo: in the app bundle (sample iosApp) or the demo pod's resource bundle.
58
- private func demoLottie(_ name: String) -> LottieAnimation? {
59
- let podBundle = Bundle.main.url(forResource: "MoMoUIKitsDemoResources", withExtension: "bundle").flatMap(Bundle.init(url:))
60
- return LottieAnimation.named(name, bundle: .main) ?? podBundle.flatMap { LottieAnimation.named(name, bundle: $0) }
61
- }
58
+ private let ctaLottieButtonURL = URL(string: "https://static.momocdn.net/app/app/kits/animation_scan_qr_icon_button.json")!
59
+ private let ctaLottieLabelURL = URL(string: "https://static.momocdn.net/app/app/kits/animation_scan_qr_text.json")!
60
+
61
+ /// Loads the two CTA Lotties from the CDN once (no bundled files), mirroring the kit's LottieView(url:).
62
+ private final class CtaLottieLoader: ObservableObject {
63
+ @Published var button: LottieAnimation?
64
+ @Published var label: LottieAnimation?
62
65
 
63
- private let ctaLottieButton = demoLottie("tabbar_scan_qr_button")
64
- private let ctaLottieLabel = demoLottie("tabbar_scan_qr_label")
66
+ func load() {
67
+ if button == nil {
68
+ LottieAnimation.loadedFrom(url: ctaLottieButtonURL, closure: { [weak self] in self?.button = $0 }, animationCache: nil)
69
+ }
70
+ if label == nil {
71
+ LottieAnimation.loadedFrom(url: ctaLottieLabelURL, closure: { [weak self] in self?.label = $0 }, animationCache: nil)
72
+ }
73
+ }
74
+ }
65
75
 
66
76
  // both parts read their progress from the same clock, two playing views start at different times
67
77
  private func ctaLottie(_ animation: LottieAnimation?, offset: CGFloat) -> some View {
@@ -82,6 +92,7 @@ private let badges: [(String, String?)] = [
82
92
 
83
93
  struct BottomTabDemoContent: View {
84
94
  @State private var config = DemoConfig()
95
+ @StateObject private var ctaLottieLoader = CtaLottieLoader()
85
96
  // the bar is rebuilt on every change: reopen it on the tab the user is on
86
97
  @State private var focused = DemoConfig().initialRouteName
87
98
 
@@ -110,6 +121,7 @@ struct BottomTabDemoContent: View {
110
121
  backToInitialTab: config.backToInitialTab
111
122
  )
112
123
  .id(config)
124
+ .onAppear { ctaLottieLoader.load() }
113
125
  }
114
126
 
115
127
  private var floatingButton: BottomTabFloatingButton? {
@@ -120,8 +132,8 @@ struct BottomTabDemoContent: View {
120
132
  return BottomTabFloatingButton(
121
133
  label: config.ctaLabel,
122
134
  onPress: {},
123
- iconContent: { ctaLottie(ctaLottieButton, offset: ctaLottieButtonOffset) },
124
- labelContent: { ctaLottie(ctaLottieLabel, offset: -ctaLottieLabelOffset) }
135
+ iconContent: { ctaLottie(ctaLottieLoader.button, offset: ctaLottieButtonOffset) },
136
+ labelContent: { ctaLottie(ctaLottieLoader.label, offset: -ctaLottieLabelOffset) }
125
137
  )
126
138
  }
127
139
  }
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.169.4",
3
+ "version": "0.169.5-beta.1-debug",
4
4
  "private": false,
5
- "scripts": {
6
- "publish:local": "bash publish.sh local"
7
- },
8
5
  "dependeNavigationncies": {},
9
6
  "devDependencies": {},
10
7
  "license": "MoMo"
package/publish.sh CHANGED
@@ -2,9 +2,8 @@
2
2
  # Build & publish vn.momo.kits:kits / :demo (GitLab Maven) and @momo-kits/native-kits (npm).
3
3
  #
4
4
  # bash publish.sh build # build everything that gets published, no upload
5
- # bash publish.sh local # beta of the working tree as is (uncommitted too), any branch
6
- # bash publish.sh beta # CI, other branches: <npm latest + 1 patch>-beta.N, npm tag beta
7
- # bash publish.sh release [--version 0.169.1] # CI, main only: npm tag latest; default = npm latest + 1 patch
5
+ # bash publish.sh release [--version 0.169.1] # npm tag latest; default = npm latest + 1 patch
6
+ # bash publish.sh beta # <npm latest + 1 patch>-beta.N, npm tag beta
8
7
  # --dry-run: resolve the version and pack the npm tarballs, upload nothing
9
8
  #
10
9
  # The version is never read from the repo; files touched here are put back on exit.
@@ -27,7 +26,6 @@ MODE="${1:-}"
27
26
  [ $# -gt 0 ] && shift
28
27
  RELEASE_VERSION="${RELEASE_VERSION:-}"
29
28
  DRY_RUN=false
30
- CHANNEL=""
31
29
  while [ $# -gt 0 ]; do
32
30
  case "$1" in
33
31
  --version) RELEASE_VERSION="${2:-}"; shift 2 ;;
@@ -109,20 +107,17 @@ phase_build() {
109
107
  # ----------------------------------------------------------------------------
110
108
  # version: ask the registries, then stamp package.json + podspecs.
111
109
  # ----------------------------------------------------------------------------
112
- check_npm_auth() {
113
- # A bad token only surfaces as a 404 on the PUT, so check auth before anything is uploaded.
114
- if [ "$DRY_RUN" != true ] && ! npm whoami "${NPM_ARGS[@]}" >/dev/null 2>&1; then
115
- die "npm auth failed (npm whoami): set NPM_TOKEN or renew the token in .npmrc"
116
- fi
117
- }
118
-
119
110
  phase_version() {
120
- section "📋 VERSION ($CHANNEL)"
121
- local args=("$CHANNEL")
111
+ section "📋 VERSION ($MODE)"
112
+ local args=("$MODE")
122
113
  if [ -n "$RELEASE_VERSION" ]; then
123
- [ "$CHANNEL" = "release" ] || die "--version / RELEASE_VERSION is only for release"
114
+ [ "$MODE" = "release" ] || die "--version / RELEASE_VERSION is only for release"
124
115
  args+=(--version "$RELEASE_VERSION")
125
116
  fi
117
+ # A bad token only surfaces as a 404 on the PUT, so check auth before anything is uploaded.
118
+ if [ "$DRY_RUN" != true ] && ! npm whoami "${NPM_ARGS[@]}" >/dev/null 2>&1; then
119
+ die "npm auth failed (npm whoami): set NPM_TOKEN or renew the token in .npmrc"
120
+ fi
126
121
 
127
122
  local resolved
128
123
  resolved="$(node scripts/ci/resolve-version.mjs "${args[@]}")"
@@ -198,7 +193,6 @@ build/
198
193
  .gitattributes
199
194
  .gitlab-ci.yml
200
195
  scripts/ci/
201
- local.properties
202
196
  EOF
203
197
  npm_publish
204
198
  echo "✅ $VERSION-debug done"
@@ -214,32 +208,12 @@ case "$MODE" in
214
208
  phase_build
215
209
  ;;
216
210
  release|beta)
217
- if [ "$MODE" = release ] && [ -z "${GITLAB_CI:-}" ] && [ "$DRY_RUN" != true ]; then
218
- die "release (npm tag latest) is published by CI from main only; locally use: bash publish.sh local"
219
- fi
220
- CHANNEL="$MODE"
221
- check_npm_auth
222
- phase_version
223
- phase_maven
224
- phase_npm
225
- section "🎉 $VERSION published (npm tag $NPM_TAG)"
226
- ;;
227
- local)
228
- [ -z "$RELEASE_VERSION" ] || die "local only publishes betas; --version / RELEASE_VERSION is for release"
229
- CHANNEL=beta
230
- BRANCH="$(git branch --show-current)"
231
- DIRTY=""
232
- [ -z "$(git status --porcelain)" ] || DIRTY=" + uncommitted changes"
233
- section "🏠 LOCAL beta from ${BRANCH:-detached HEAD} @ $(git rev-parse --short HEAD)$DIRTY"
234
- check_npm_auth
235
- # Outside CI's kits-publish lock: build first so the number is picked right before the upload.
236
- [ "$DRY_RUN" = true ] || phase_build
237
211
  phase_version
238
212
  phase_maven
239
213
  phase_npm
240
214
  section "🎉 $VERSION published (npm tag $NPM_TAG)"
241
215
  ;;
242
216
  *)
243
- die "Usage: bash publish.sh build | local [--dry-run] | beta [--dry-run] | release [--version x.y.z] (CI)"
217
+ die "Usage: bash publish.sh build | release [--version x.y.z] | beta [--dry-run]"
244
218
  ;;
245
219
  esac
@@ -0,0 +1,64 @@
1
+ import org.gradle.kotlin.dsl.maven
2
+
3
+ rootProject.name = "momo-native-kits"
4
+ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
5
+
6
+ pluginManagement {
7
+ repositories {
8
+ google {
9
+ mavenContent {
10
+ includeGroupAndSubgroups("androidx")
11
+ includeGroupAndSubgroups("com.android")
12
+ includeGroupAndSubgroups("com.google")
13
+ }
14
+ }
15
+ mavenCentral()
16
+ gradlePluginPortal()
17
+ maven {
18
+ url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
19
+ credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
20
+ }
21
+ maven {
22
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
23
+ credentials {
24
+ username = "viewer"
25
+ password = "viewer"
26
+ }
27
+ isAllowInsecureProtocol = true
28
+ }
29
+ }
30
+ }
31
+
32
+ dependencyResolutionManagement {
33
+ repositories {
34
+ google {
35
+ mavenContent {
36
+ includeGroupAndSubgroups("androidx")
37
+ includeGroupAndSubgroups("com.android")
38
+ includeGroupAndSubgroups("com.google")
39
+ }
40
+ }
41
+ mavenCentral()
42
+ maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
43
+ maven {
44
+ url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
45
+ credentials {
46
+ username = "download_packages";
47
+ password = "gldt-bjDqLpU_sPcHDuXau2ws"
48
+ }
49
+ }
50
+ maven {
51
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
52
+ credentials {
53
+ username = "viewer"
54
+ password = "viewer"
55
+ }
56
+ isAllowInsecureProtocol = true
57
+ }
58
+ }
59
+ }
60
+
61
+ include(":compose")
62
+
63
+ include(":sample:androidApp")
64
+ include(":sample:shared")