@momo-kits/native-kits 0.167.1-beta.9-debug → 0.167.1-duo-search.1

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 (189) hide show
  1. package/CLAUDE.md +36 -0
  2. package/ios/Application/ApplicationEnvironment.swift +6 -0
  3. package/ios/Application/Components.swift +1 -3
  4. package/ios/Application/HeaderRight.swift +32 -14
  5. package/ios/Application/Layout/ScreenLayout.swift +312 -0
  6. package/ios/Application/Navigation/BottomTab/BottomTab.swift +67 -10
  7. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +5 -2
  8. package/ios/Application/Navigation/BottomTab/DuoBarCompression.swift +105 -0
  9. package/ios/Application/Navigation/BottomTab/DuoTabBar.swift +304 -0
  10. package/ios/Application/Navigation/HeaderUser.swift +4 -4
  11. package/ios/Application/Navigation/NavigationContainer.swift +48 -42
  12. package/ios/Application/Navigation/Navigator.swift +122 -29
  13. package/ios/Application/Navigation/NavigatorManager.swift +13 -6
  14. package/ios/Application/Navigation/Overplay/BottomSheet.swift +41 -4
  15. package/ios/Application/Navigation/Overplay/ModalScreen.swift +7 -0
  16. package/ios/Application/Navigation/component/DuoScrollGradient.swift +54 -0
  17. package/ios/Application/Navigation/component/Header.swift +11 -6
  18. package/ios/Application/Navigation/component/HeaderBackground.swift +3 -2
  19. package/ios/Application/Navigation/component/NavigationFooter.swift +1 -1
  20. package/ios/Application/Navigation/component/NavigationHeaderRight.swift +93 -9
  21. package/ios/Application/Navigation/component/SideBar.swift +155 -0
  22. package/ios/Application/StackScreen.swift +175 -18
  23. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +59 -5
  24. package/ios/Colors+Radius+Spacing/Colors.swift +1 -1
  25. package/ios/Extensions/Color++.swift +20 -9
  26. package/ios/Extensions/OptionalEnvironmentObject.swift +12 -0
  27. package/ios/Icon/Icon.swift +14 -22
  28. package/ios/Icon/Icons.swift +1329 -0
  29. package/ios/Image/Image.swift +16 -5
  30. package/ios/Lottie/LottieView.swift +4 -2
  31. package/ios/Popup/PopupDisplay.swift +84 -67
  32. package/ios/Popup/PopupLayout.swift +45 -0
  33. package/ios/Popup/PopupNotify.swift +44 -26
  34. package/ios/Popup/PopupPromotion.swift +18 -6
  35. package/ios/Resources/dot_loading.json +558 -0
  36. package/ios/Resources/lottie_circle_loader.json +1 -0
  37. package/ios/Template/TrustBanner/TrustBanner.swift +69 -31
  38. package/ios/Typography/FontScale.swift +3 -3
  39. package/ios/native-kits.podspec +1 -1
  40. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  41. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DuoTabDemo.swift +80 -0
  42. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +2 -0
  43. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IPhoneDuoDemo.swift +173 -0
  44. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +1 -0
  45. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +2 -2
  46. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +2 -0
  47. package/package.json +1 -1
  48. package/scripts/gen-ios-icons.mjs +36 -0
  49. package/build.gradle.kts +0 -11
  50. package/compose/build.gradle.kts +0 -190
  51. package/compose/build.gradle.kts.backup +0 -190
  52. package/compose/compose.podspec +0 -47
  53. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  54. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  55. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  56. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  57. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -151
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -475
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -266
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -264
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -328
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -97
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -552
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -14
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -221
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -270
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -52
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -38
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -39
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -299
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -129
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -201
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -595
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  153. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  154. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -175
  155. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -225
  156. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  157. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  158. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -358
  159. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -83
  160. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  161. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -75
  162. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -309
  163. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -40
  164. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -364
  165. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
  166. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  167. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  168. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  169. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  170. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -71
  171. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  172. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  173. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  174. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
  175. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
  176. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  177. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  178. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  179. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  180. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -213
  181. package/gradle/libs.versions.toml +0 -69
  182. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  183. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  184. package/gradle.properties +0 -26
  185. package/gradlew +0 -252
  186. package/gradlew.bat +0 -94
  187. package/ios-demo/README.md +0 -120
  188. package/local.properties +0 -8
  189. package/settings.gradle.kts +0 -64
@@ -12,14 +12,14 @@ import SDWebImageSwiftUI
12
12
  let jsonUrl = "https://static.momocdn.net/app/json/component-kits/design_system.json"
13
13
 
14
14
  public struct TrustBannerData: Decodable {
15
- let content: [String: String]
16
- let subContent: [String: String]
17
- let pciImage: String
18
- let sslImage: String
19
- let urlConfig: String
20
- let icons: [String]
21
- let momoImage: String
22
-
15
+ public let content: [String: String]
16
+ public let subContent: [String: String]
17
+ public let pciImage: String?
18
+ public let momoImage: String?
19
+ public let sslImage: String?
20
+ public let icons: [String]?
21
+ public let urlConfig: String
22
+
23
23
  enum CodingKeys: String, CodingKey {
24
24
  case content
25
25
  case subContent
@@ -29,6 +29,38 @@ public struct TrustBannerData: Decodable {
29
29
  case momoImage
30
30
  case urlConfig = "url_config"
31
31
  }
32
+
33
+ public init(
34
+ content: [String: String] = ["vi": "", "en": ""],
35
+ subContent: [String: String] = ["vi": "", "en": ""],
36
+ pciImage: String? = nil,
37
+ momoImage: String? = nil,
38
+ sslImage: String? = nil,
39
+ icons: [String]? = nil,
40
+ urlConfig: String = ""
41
+ ) {
42
+ self.content = content
43
+ self.subContent = subContent
44
+ self.pciImage = pciImage
45
+ self.momoImage = momoImage
46
+ self.sslImage = sslImage
47
+ self.icons = icons
48
+ self.urlConfig = urlConfig
49
+ }
50
+
51
+ // Missing keys fall back to the init defaults, like the Compose data class.
52
+ public init(from decoder: Decoder) throws {
53
+ let container = try decoder.container(keyedBy: CodingKeys.self)
54
+ self.init(
55
+ content: try container.decodeIfPresent([String: String].self, forKey: .content) ?? ["vi": "", "en": ""],
56
+ subContent: try container.decodeIfPresent([String: String].self, forKey: .subContent) ?? ["vi": "", "en": ""],
57
+ pciImage: try container.decodeIfPresent(String.self, forKey: .pciImage),
58
+ momoImage: try container.decodeIfPresent(String.self, forKey: .momoImage),
59
+ sslImage: try container.decodeIfPresent(String.self, forKey: .sslImage),
60
+ icons: try container.decodeIfPresent([String].self, forKey: .icons),
61
+ urlConfig: try container.decodeIfPresent(String.self, forKey: .urlConfig) ?? ""
62
+ )
63
+ }
32
64
  }
33
65
 
34
66
  let defaultBanner = TrustBannerData(
@@ -39,15 +71,15 @@ let defaultBanner = TrustBannerData(
39
71
  "en": "Learn more"
40
72
  ],
41
73
  pciImage: "https://static.momocdn.net/app/img/kits/trustBanner/pci.png",
74
+ momoImage: "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png",
42
75
  sslImage: "https://static.momocdn.net/app/img/kits/trustBanner/ssl.png",
43
- urlConfig: "login_and_security",
44
76
  icons: [
45
77
  "https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png",
46
78
  "https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png",
47
79
  "https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png",
48
80
  "https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png"
49
81
  ],
50
- momoImage: "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png"
82
+ urlConfig: "login_and_security"
51
83
  )
52
84
 
53
85
  public struct TrustBanner: View {
@@ -60,22 +92,25 @@ public struct TrustBanner: View {
60
92
  self.onPress = onPress
61
93
  }
62
94
 
95
+ private var banner: TrustBannerData {
96
+ applicationEnvironment.config?.trustBanner ?? defaultBanner
97
+ }
98
+
63
99
  func onPressSecurity() {
64
- if (onPress != nil) {
65
- onPress!(applicationEnvironment.config?.trustBanner?.urlConfig ?? defaultBanner.urlConfig)
66
- }
100
+ onPress?(banner.urlConfig)
67
101
  }
68
-
69
-
102
+
103
+
70
104
  public var body: some View {
71
105
  HStack(alignment: .center, spacing: 8) {
72
- WebImage(url: URL(string: applicationEnvironment.config?.trustBanner?.momoImage ?? defaultBanner.momoImage))
73
- .resizable()
74
- .scaledToFit()
75
- .frame(width: 64, height: 64)
106
+ if let momoImage = banner.momoImage {
107
+ WebImage(url: URL(string: momoImage))
108
+ .resizable()
109
+ .scaledToFit()
110
+ .frame(width: 64, height: 64)
111
+ }
76
112
  VStack(alignment: .leading){
77
- Text(applicationEnvironment.config?.trustBanner?.content[localize.currentLanguage]
78
- ?? localize.translateData(defaultBanner.content))
113
+ Text(localize.translateData(banner.content))
79
114
  .foregroundColor(Color(hex: "484848"))
80
115
  .lineLimit(2)
81
116
  .font(.system(size: 13, weight: Font.Weight.regular))
@@ -84,8 +119,7 @@ public struct TrustBanner: View {
84
119
  .padding(.bottom, 8)
85
120
  HStack {
86
121
  HStack(spacing: 0) {
87
- Text(applicationEnvironment.config?.trustBanner?.subContent[localize.currentLanguage]
88
- ?? localize.translateData(defaultBanner.subContent))
122
+ Text(localize.translateData(banner.subContent))
89
123
  .foregroundColor(Colors.pink03)
90
124
  .font(.system(size: 13, weight: .bold))
91
125
  .ignoreBoldTextSetting()
@@ -98,14 +132,18 @@ public struct TrustBanner: View {
98
132
 
99
133
  Spacer()
100
134
  HStack{
101
- WebImage(url: URL(string: applicationEnvironment.config?.trustBanner?.pciImage ?? defaultBanner.pciImage))
102
- .resizable()
103
- .scaledToFit()
104
- .frame(width: 24, height: 20)
105
- WebImage(url: URL(string: applicationEnvironment.config?.trustBanner?.sslImage ?? defaultBanner.sslImage))
106
- .resizable()
107
- .scaledToFit()
108
- .frame(width: 52, height: 20)
135
+ if let pciImage = banner.pciImage {
136
+ WebImage(url: URL(string: pciImage))
137
+ .resizable()
138
+ .scaledToFit()
139
+ .frame(width: 24, height: 20)
140
+ }
141
+ if let sslImage = banner.sslImage {
142
+ WebImage(url: URL(string: sslImage))
143
+ .resizable()
144
+ .scaledToFit()
145
+ .frame(width: 52, height: 20)
146
+ }
109
147
  }
110
148
  }
111
149
 
@@ -30,9 +30,9 @@ public struct FontScale: Equatable {
30
30
  public func callAsFunction(_ size: CGFloat) -> CGFloat {
31
31
  guard useOSScaleRate else { return size * userScaleRate }
32
32
 
33
- // Device width is read live rather than snapshotted, matching Compose's
34
- // getScreenDimensions() read inside scaleSize(), so a rotation or split-view resize counts.
35
- let deviceScale = UIScreen.main.bounds.width / Self.defaultScreenSize
33
+ // Short side, not width: landscape must not inflate every font (and so every popup's height).
34
+ let bounds = UIScreen.main.bounds.size
35
+ let deviceScale = min(bounds.width, bounds.height) / Self.defaultScreenSize
36
36
 
37
37
  var deviceScaled = size
38
38
  var osScaled = size
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.167.1-beta.9'
3
+ s.version = '0.167.1-duo-search.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.167.1-beta.9'
3
+ s.version = '0.167.1-duo-search.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,80 @@
1
+ //
2
+ // DuoTabDemo.swift
3
+ // Example
4
+ //
5
+ // Mirrors RN `app/screens/IPhoneDuo/DuoTabUsage`: glass rail in the Duo side bar, floating
6
+ // glass bar when unfolded portrait. `useShortcut` gives the tallest side bar header, for the
7
+ // overlap review; `compressTabBar` folds the tab bar instead of the toolbar when the side bar
8
+ // is short (HIG "Tab bar compressed").
9
+ //
10
+
11
+ import MoMoUIKits
12
+ import SwiftUI
13
+
14
+ private let swatches = [Colors.pink03, Colors.orange03, Colors.green03]
15
+ private let history = (1...18).map { "Giao dịch #\($0)" }
16
+
17
+ struct DuoTabDemo: View {
18
+ let useShortcut: Bool
19
+ var compressTabBar = false
20
+
21
+ var body: some View {
22
+ if #available(iOS 16.0, *) {
23
+ DuoTabDemoContent(useShortcut: useShortcut, compressTabBar: compressTabBar)
24
+ } else {
25
+ Text("Requires iOS 16+").padding()
26
+ }
27
+ }
28
+ }
29
+
30
+ @available(iOS 16.0, *)
31
+ private struct DuoTabDemoContent: View {
32
+ let useShortcut: Bool
33
+ let compressTabBar: Bool
34
+
35
+ var body: some View {
36
+ BottomTab(
37
+ items: [
38
+ tab("DuoMoMo", label: "MoMo", icon: "basic_home", title: "MoMo"),
39
+ tab("DuoPromotion", label: "Ưu đãi", icon: "shopping_coupon", title: "Ưu đãi", badge: ""),
40
+ tab("DuoHistory", label: "Lịch sử GD", icon: "time_clock_reset", title: "Lịch sử giao dịch", badge: "3"),
41
+ tab("DuoMe", label: "Tôi", icon: "basic_person", title: "Tôi"),
42
+ ],
43
+ floatingButton: BottomTabFloatingButton(icon: "navigation_full_screen", label: "Quét mọi QR", onPress: {}),
44
+ compressionBehavior: compressTabBar ? .tabBar : .toolbar
45
+ )
46
+ }
47
+
48
+ private func tab(_ name: String, label: String, icon: String, title: String, badge: String? = nil) -> BottomTabItem {
49
+ BottomTabItem(
50
+ name: name,
51
+ label: label,
52
+ icon: icon,
53
+ badgeLabel: badge,
54
+ options: NavigationOptions(title: title, headerRightData: HeaderRightData(useShortcut: useShortcut)),
55
+ screen: { DuoTabList() }
56
+ )
57
+ }
58
+ }
59
+
60
+ private struct DuoTabList: View {
61
+ var body: some View {
62
+ VStack(spacing: 0) {
63
+ ForEach(history.indices, id: \.self) { index in
64
+ if index > 0 { MomoDivider() }
65
+ HStack(spacing: Spacing.M) {
66
+ RoundedRectangle(cornerRadius: Radius.S)
67
+ .fill(swatches[index % swatches.count])
68
+ .frame(width: Spacing.XL, height: Spacing.XL)
69
+ MomoText(history[index], typography: .bodyDefaultRegular)
70
+ Spacer()
71
+ }
72
+ .padding(.vertical, Spacing.M)
73
+ }
74
+ }
75
+ .padding(.horizontal, Spacing.M)
76
+ .background(Colors.black01)
77
+ .clipShape(RoundedRectangle(cornerRadius: Radius.M))
78
+ .padding(Spacing.M)
79
+ }
80
+ }
@@ -51,6 +51,7 @@ public let ScreenUsages: [ScreenUsage] = [
51
51
  ScreenUsage(title: "InputTextArea", destination: AnyView(InputTextAreaDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
52
52
  ScreenUsage(title: "InputSearch", destination: AnyView(InputSearchDemo()), icon: getIcon(icon: "FormInput"), hostsOwnChrome: true),
53
53
  ScreenUsage(title: "PopupNotify", destination: AnyView(PopupNotifyDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
54
+ ScreenUsage(title: "PopupDisplay", destination: AnyView(PopupDisplayDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
54
55
  ScreenUsage(title: "PopupPromotion", destination: AnyView(PopupPromotionDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
55
56
  ScreenUsage(title: "SnackBar", destination: AnyView(SnackBarDemo()), icon: getIcon(icon: "Popup"), hostsOwnChrome: true),
56
57
  ScreenUsage(title: "Switch", destination: AnyView(SwitchDemo()), icon: getIcon(icon: "Toggle"), hostsOwnChrome: true),
@@ -84,6 +85,7 @@ public let ScreenUsages: [ScreenUsage] = [
84
85
  ScreenUsage(title: "DateTimePicker", destination: AnyView(DateTimePickerDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
85
86
  ScreenUsage(title: "Navigation", destination: AnyView(NavigationDemo()), icon: getIcon(icon: "Layout")),
86
87
  ScreenUsage(title: "Bottom Tab", destination: AnyView(BottomTabDemo()), icon: getIcon(icon: "Layout"), hostsOwnChrome: true),
88
+ ScreenUsage(title: "iPhone Duo", destination: AnyView(IPhoneDuoDemo()), icon: getIcon(icon: "Layout")),
87
89
  ScreenUsage(title: "Animated Header", destination: AnyView(AnimatedHeaderDemo()), icon: getIcon(icon: "Layout")),
88
90
  ScreenUsage(title: "Theme", destination: AnyView(ThemeDemo()), icon: getIcon(icon: "Typography")),
89
91
  ScreenUsage(title: "Localize", destination: AnyView(LocalizeDemo()), icon: getIcon(icon: "Typography")),
@@ -0,0 +1,173 @@
1
+ //
2
+ // IPhoneDuoDemo.swift
3
+ // Example
4
+ //
5
+ // Mirrors RN `app/screens/IPhoneDuo`: the live screen layout, an extended header + search
6
+ // + footer screen, the Duo tab bars, the popup / bottom sheet behaviour and a grid to scroll.
7
+ //
8
+
9
+ import MoMoUIKits
10
+ import SwiftUI
11
+
12
+ private let gridRows: [[Int]] = [[12], [6, 6], [4, 4, 4], [3, 3, 3, 3]]
13
+
14
+ // enough rows to scroll, so the header glass and side bar can be checked
15
+ private let scrollRows: [[Int]] = Array(repeating: gridRows, count: 4).flatMap { $0 }
16
+
17
+ struct IPhoneDuoDemo: View {
18
+ var body: some View {
19
+ if #available(iOS 16.0, *) {
20
+ IPhoneDuoDemoContent()
21
+ } else {
22
+ Text("Requires iOS 16+").padding()
23
+ }
24
+ }
25
+ }
26
+
27
+ @available(iOS 16.0, *)
28
+ private struct IPhoneDuoDemoContent: View {
29
+ @EnvironmentObject private var navigator: Navigator
30
+ @Environment(\.screenLayout) private var layout
31
+
32
+ var body: some View {
33
+ VStack(alignment: .leading, spacing: Spacing.M) {
34
+ VStack(spacing: 0) {
35
+ ForEach(info, id: \.0) { label, value in
36
+ HStack {
37
+ MomoText(label, typography: .bodyDefaultRegular)
38
+ Spacer()
39
+ MomoText(value, typography: .headerSSemibold)
40
+ }
41
+ .padding(.vertical, Spacing.XS)
42
+ }
43
+ }
44
+ .padding(.horizontal, Spacing.M)
45
+
46
+ VStack(spacing: Spacing.S) {
47
+ demoButton("Extended header + footer") {
48
+ navigator.push({ DuoGridScreen() }, options: extendedOptions)
49
+ }
50
+ demoButton("Glass tab bar") {
51
+ navigator.push({ DuoTabDemo(useShortcut: false) }, options: tabOptions)
52
+ }
53
+ demoButton("Glass tab bar + useShortcut") {
54
+ navigator.push({ DuoTabDemo(useShortcut: true) }, options: tabOptions)
55
+ }
56
+ demoButton("Glass tab bar + compress tab bar") {
57
+ navigator.push({ DuoTabDemo(useShortcut: true, compressTabBar: true) }, options: tabOptions)
58
+ }
59
+ demoButton("Bottom sheet: iPhone Duo safe area") {
60
+ navigator.showBottomSheet({ BottomSheetSafeArea() }, isSurface: true, header: .title("Safe area"))
61
+ }
62
+ demoButton("PopupNotify") {
63
+ navigator.showModal {
64
+ PopupNotify(props: PopupNotifyProps(
65
+ image: "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png",
66
+ title: "Title",
67
+ description: String(repeating: "Check lại một nhịp auto chuyển sang dạng CTA. ", count: 8),
68
+ primary: PopupAction(title: "Đồng ý", onPress: { navigator.hideOverplay() }),
69
+ secondary: PopupAction(title: "Đóng", onPress: { navigator.hideOverplay() }),
70
+ onIconClose: { navigator.hideOverplay() }
71
+ ))
72
+ }
73
+ }
74
+ }
75
+ .padding(.horizontal, Spacing.M)
76
+
77
+ DuoGrid()
78
+ }
79
+ .padding(.vertical, Spacing.M)
80
+ }
81
+
82
+ private var info: [(String, String)] {
83
+ let insets = layout.insets
84
+ return [
85
+ ("iPhone Duo", layout.isIPhoneDuo ? "yes" : "no"),
86
+ ("Window", "\(Int(layout.width)) x \(Int(layout.height))"),
87
+ ("Safe area (T R B L)", "\(Int(insets.top)) \(Int(insets.trailing)) \(Int(insets.bottom)) \(Int(insets.leading))"),
88
+ ("Content inset (L R)", "\(Int(layout.insetLeft)) \(Int(layout.insetRight))"),
89
+ ("Content width", "\(Int(layout.contentWidth))"),
90
+ ("Header height", "\(Int(layout.headerHeight))"),
91
+ ("Side bar", layout.sideBar.map { "\($0.edge == .left ? "left" : "right"), \(Int($0.width))pt, top \(Int($0.top))" } ?? "none"),
92
+ ]
93
+ }
94
+
95
+ private var extendedOptions: NavigationOptions {
96
+ NavigationOptions(
97
+ title: "Extended",
98
+ headerType: .extended,
99
+ headerRightData: HeaderRightData(useShortcut: true),
100
+ footer: { AnyView(MoMoUIKits.Button(title: "Footer action", action: {}, size: .large)) }
101
+ )
102
+ }
103
+
104
+ private var tabOptions: NavigationOptions {
105
+ NavigationOptions(title: "Duo tabs", headerType: .none, scrollable: false)
106
+ }
107
+
108
+ private func demoButton(_ title: String, action: @escaping () -> Void) -> some View {
109
+ MoMoUIKits.Button(title: title, action: action, type: .secondary, size: .small)
110
+ }
111
+ }
112
+
113
+ private struct DuoGridScreen: View {
114
+ var body: some View {
115
+ DuoGrid().padding(.vertical, Spacing.M)
116
+ }
117
+ }
118
+
119
+ private struct DuoGrid: View {
120
+ var body: some View {
121
+ VStack(spacing: Spacing.M) {
122
+ ForEach(scrollRows.indices, id: \.self) { row in
123
+ SectionView {
124
+ ForEach(scrollRows[row].indices, id: \.self) { index in
125
+ let span = scrollRows[row][index]
126
+ ItemView(widthSpan: span) {
127
+ MomoText("span \(span)", typography: .descriptionDefaultRegular)
128
+ .frame(maxWidth: .infinity)
129
+ .frame(height: 48)
130
+ .background(Colors.black04)
131
+ .clipShape(RoundedRectangle(cornerRadius: Radius.S))
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+
140
+ /// Markers on the content edges show the side safe area inside the sheet.
141
+ private struct BottomSheetSafeArea: View {
142
+ @Environment(\.screenLayout) private var layout
143
+
144
+ var body: some View {
145
+ VStack(alignment: .leading, spacing: Spacing.XS) {
146
+ HStack {
147
+ marker("← content edge")
148
+ Spacer()
149
+ marker("content edge →")
150
+ }
151
+ .padding(.bottom, Spacing.S)
152
+ MomoText("Window: \(Int(layout.width)) × \(Int(layout.height))", typography: .bodyDefaultRegular)
153
+ MomoText(
154
+ "Insets: top \(Int(layout.insets.top)) · right \(Int(layout.insets.trailing)) · bottom \(Int(layout.insets.bottom)) · left \(Int(layout.insets.leading))",
155
+ typography: .bodyDefaultRegular
156
+ )
157
+ MomoText(
158
+ "On iPhone Duo: the outer display keeps a full-width sheet with content inside the side safe area; the inner display centers the sheet, still attached to the bottom edge. Other devices are unchanged.",
159
+ typography: .descriptionDefaultRegular,
160
+ color: Colors.black12
161
+ )
162
+ }
163
+ .padding(.vertical, Spacing.M)
164
+ }
165
+
166
+ private func marker(_ text: String) -> some View {
167
+ MomoText(text, typography: .labelSMedium, color: Colors.pink03)
168
+ .padding(.vertical, Spacing.XS)
169
+ .padding(.horizontal, Spacing.S)
170
+ .background(Colors.black04)
171
+ .clipShape(RoundedRectangle(cornerRadius: Radius.XS))
172
+ }
173
+ }
@@ -160,6 +160,7 @@ private struct PopupDisplayDemoContent: View {
160
160
  errorCode: errorCode,
161
161
  isShowCloseIcon: showCloseIcon
162
162
  )
163
+ .padding(.horizontal, Spacing.M)
163
164
  }
164
165
  }
165
166
  }
@@ -26,7 +26,7 @@ private struct PopupNotifyPreview: View {
26
26
  private func show() {
27
27
  navigator.showModal {
28
28
  PopupNotify(props: PopupNotifyProps(
29
- image: "https://i.imgur.com/s70S9s9.png",
29
+ image: "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png",
30
30
  title: "Title",
31
31
  description: "Check lại một nhịp auto chuyển sang dạng CTA.",
32
32
  error: "9004",
@@ -50,7 +50,7 @@ private let popupDirectionList: [PlaygroundOption] = [
50
50
  @available(iOS 16.0, *)
51
51
  private struct PopupNotifyPlayground: View {
52
52
  @EnvironmentObject private var navigator: Navigator
53
- @State private var image = "https://i.imgur.com/s70S9s9.png"
53
+ @State private var image = "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png"
54
54
  @State private var title = "Title"
55
55
  @State private var description = "Check lại một nhịp auto chuyển sang dạng CTA."
56
56
  @State private var error = "9004"
@@ -37,6 +37,7 @@ private struct PopupPromotionPreview: View {
37
37
  private func show(_ url: String) {
38
38
  navigator.showModal {
39
39
  PopupPromotion(imageUrl: url, onIconClose: { navigator.hideOverplay() }, onAction: { navigator.hideOverplay() })
40
+ .padding(.horizontal, Spacing.M)
40
41
  }
41
42
  }
42
43
  }
@@ -62,6 +63,7 @@ private struct PopupPromotionPlayground: View {
62
63
  private func show() {
63
64
  navigator.showModal {
64
65
  PopupPromotion(imageUrl: imageUrl, onIconClose: { navigator.hideOverplay() }, onAction: { navigator.hideOverplay() })
66
+ .padding(.horizontal, Spacing.M)
65
67
  }
66
68
  }
67
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.167.1-beta.9-debug",
3
+ "version": "0.167.1-duo-search.1",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},
@@ -0,0 +1,36 @@
1
+ // Generates ios/Icon/Icons.swift from the Compose icon map so both kits ship the same
2
+ // compiled-in icons. Run from anywhere: `node scripts/gen-ios-icons.mjs`.
3
+ import { readFileSync, writeFileSync } from "fs";
4
+ import { dirname, join } from "path";
5
+ import { fileURLToPath } from "url";
6
+
7
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
8
+ const source = join(root, "compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt");
9
+ const target = join(root, "ios/Icon/Icons.swift");
10
+
11
+ const kotlin = readFileSync(source, "utf8");
12
+ const kotlinString = String.raw`"((?:[^"\\]|\\.)*)"`;
13
+ const unescapeKotlin = (s) => s.replace(/\\(["\\$])/g, "$1");
14
+ const swiftString = (s) => `"${s.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
15
+
16
+ const icons = [...kotlin.matchAll(new RegExp(`^\\s*${kotlinString} to ${kotlinString}`, "gm"))]
17
+ .map(([, key, url]) => [unescapeKotlin(key), unescapeKotlin(url)]);
18
+ const noThemeBlock = kotlin.match(/val noThemeIcons = listOf\(([^)]*)\)/);
19
+ const noTheme = noThemeBlock
20
+ ? [...noThemeBlock[1].matchAll(new RegExp(kotlinString, "g"))].map(([, s]) => unescapeKotlin(s))
21
+ : [];
22
+
23
+ if (icons.length === 0) throw new Error(`No icons parsed from ${source}`);
24
+ if (new Set(icons.map(([key]) => key)).size !== icons.length) throw new Error("Duplicate icon keys");
25
+
26
+ const swift = `// Generated by scripts/gen-ios-icons.mjs from compose/.../utils/Icons.kt. Do not edit by hand.
27
+
28
+ let kitIcons: [String: String] = [
29
+ ${icons.map(([key, url]) => ` ${swiftString(key)}: ${swiftString(url)},`).join("\n")}
30
+ ]
31
+
32
+ let noThemeIcons: [String] = [${noTheme.map(swiftString).join(", ")}]
33
+ `;
34
+
35
+ writeFileSync(target, swift);
36
+ console.log(`Wrote ${icons.length} icons (${noTheme.length} untinted) to ${target}`);
package/build.gradle.kts DELETED
@@ -1,11 +0,0 @@
1
- plugins {
2
- // this is necessary to avoid the plugins to be loaded multiple times
3
- // in each subproject's classloader
4
- alias(libs.plugins.android.application) apply false
5
- alias(libs.plugins.android.library) apply false
6
- alias(libs.plugins.compose) apply false
7
- alias(libs.plugins.kotlin.compose.compiler) apply false
8
- alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
9
- alias(libs.plugins.jetbrains.kotlin.serialization) apply false
10
- alias(libs.plugins.vanniktech.mavenPublish) apply false
11
- }