@momo-kits/native-kits 0.169.13-beta.4 → 0.169.13-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.
- package/CLAUDE.md +1 -4
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +198 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +154 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +61 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1067 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +268 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +354 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +130 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +482 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +224 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +137 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +113 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +262 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +237 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +228 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +280 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +183 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +342 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +82 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +362 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +304 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +88 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +308 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +218 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +456 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +542 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +208 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +291 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +71 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +315 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +54 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +397 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +153 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +118 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +206 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +421 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +750 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +152 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +242 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +406 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +111 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +93 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +208 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +167 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +446 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +400 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +197 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +7 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +21 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +117 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +65 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +143 -0
- package/gradle/libs.versions.toml +67 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +24 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Navigation/BottomTab/BottomTabBar.swift +14 -4
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/README.md +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +16 -3
- package/package.json +1 -1
- package/settings.gradle.kts +64 -0
- package/scripts/sdui-visual/diff.py +0 -65
- package/scripts/sdui-visual/drive.py +0 -234
- package/scripts/sdui-visual/plan.json +0 -713
- package/scripts/sdui-visual/run.sh +0 -92
|
@@ -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
|
+
```
|
|
@@ -89,7 +89,18 @@ private func ctaLottie(_ animation: LottieAnimation?, offset: CGFloat) -> some V
|
|
|
89
89
|
}
|
|
90
90
|
private let badges: [(String, String?)] = [
|
|
91
91
|
("Không", nil), ("Dot \"\"", ""), ("\"0\"", "0"), ("\"5\"", "5"),
|
|
92
|
-
("\"1999\"", "1999"), ("\"Mới\"", "Mới"),
|
|
92
|
+
("\"1999\"", "1999"), ("\"Mới\"", "Mới"),
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
/// "Chữ dài" picks one of these at random on every tap.
|
|
96
|
+
private let longBadges = [
|
|
97
|
+
"Khuyến mãi lớn",
|
|
98
|
+
"Khám phá ngay",
|
|
99
|
+
"Ưu đãi cực sốc",
|
|
100
|
+
"Quà tặng hấp dẫn",
|
|
101
|
+
"Hoàn tiền mỗi ngày",
|
|
102
|
+
"Siêu sale cuối tuần",
|
|
103
|
+
"Thanh toán hóa đơn",
|
|
93
104
|
]
|
|
94
105
|
|
|
95
106
|
struct BottomTabDemoContent: View {
|
|
@@ -175,10 +186,12 @@ private struct TabContent: View {
|
|
|
175
186
|
Section(title: "Tab đang mở · \(name)") {
|
|
176
187
|
IconOptions(title: "icon", icons: icons, value: tab.icon) { icon in updateTab { $0.icon = icon } }
|
|
177
188
|
Options(title: "badgeLabel",
|
|
178
|
-
hint: "\"\" là dot, \"0\" ẩn badge, số > 99 hiện 99+, chữ
|
|
189
|
+
hint: "\"\" là dot, \"0\" ẩn badge, số > 99 hiện 99+, chữ > 5 ký tự cắt thành 5 ký tự + \"...\"",
|
|
179
190
|
options: badges.map { title, value in
|
|
180
191
|
Option(title: title, selected: tab.badgeLabel == value) { updateTab { $0.badgeLabel = value } }
|
|
181
|
-
})
|
|
192
|
+
} + [Option(title: "Chữ dài", selected: longBadges.contains(tab.badgeLabel ?? "")) {
|
|
193
|
+
updateTab { $0.badgeLabel = longBadges.randomElement() }
|
|
194
|
+
}])
|
|
182
195
|
Options(title: "showDot",
|
|
183
196
|
hint: "Hiện dot khi không có badgeLabel hoặc badgeLabel là \"0\"",
|
|
184
197
|
options: yesNo(tab.showDot) { value in updateTab { $0.showDot = value } })
|
package/package.json
CHANGED
|
@@ -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")
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# File: scripts/sdui-visual/diff.py
|
|
2
|
-
# Created At: 2026-11-10 15:30:00 +07:00
|
|
3
|
-
# Created By: AI
|
|
4
|
-
# AI Agent: Claude Code
|
|
5
|
-
# Model: claude-opus-5-5
|
|
6
|
-
"""Pixel-diff two capture folders. usage: diff.py <a> <b> <diffdir> [--noise <baseline2 dir>]
|
|
7
|
-
Status bar (top 110 px, demo-mode clock is fixed but kept out anyway) is excluded. With --noise, pixels that differed
|
|
8
|
-
between the two baseline runs of the same image are masked (inherent noise: animations, image loading)."""
|
|
9
|
-
import json, os, sys
|
|
10
|
-
from PIL import Image, ImageChops
|
|
11
|
-
|
|
12
|
-
STATUS = 110
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def load(p):
|
|
16
|
-
return Image.open(p).convert("RGB")
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def mask_of(a, b):
|
|
20
|
-
d = ImageChops.difference(a, b).convert("L").point(lambda v: 255 if v else 0)
|
|
21
|
-
return d
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def main():
|
|
25
|
-
a, b, out = sys.argv[1:4]
|
|
26
|
-
noise_dir = sys.argv[sys.argv.index("--noise") + 1] if "--noise" in sys.argv else None
|
|
27
|
-
os.makedirs(out, exist_ok=True)
|
|
28
|
-
rows = []
|
|
29
|
-
names = sorted(set(os.listdir(a)) | set(os.listdir(b)))
|
|
30
|
-
for n in names:
|
|
31
|
-
if not n.endswith(".png"):
|
|
32
|
-
continue
|
|
33
|
-
if n not in os.listdir(a) or n not in os.listdir(b):
|
|
34
|
-
rows.append((n, "MISSING", -1, -1, -1)); continue
|
|
35
|
-
ia, ib = load(f"{a}/{n}"), load(f"{b}/{n}")
|
|
36
|
-
if ia.size != ib.size:
|
|
37
|
-
rows.append((n, "SIZE", -1, -1, -1)); continue
|
|
38
|
-
w, h = ia.size
|
|
39
|
-
d = mask_of(ia, ib)
|
|
40
|
-
d.paste(0, (0, 0, w, STATUS))
|
|
41
|
-
raw = d.width * d.height - d.histogram()[0]
|
|
42
|
-
masked = raw
|
|
43
|
-
if noise_dir and os.path.exists(f"{noise_dir}/{n}"):
|
|
44
|
-
nz = mask_of(ia, load(f"{noise_dir}/{n}"))
|
|
45
|
-
keep = ImageChops.subtract(d, nz)
|
|
46
|
-
masked = keep.width * keep.height - keep.histogram()[0]
|
|
47
|
-
else:
|
|
48
|
-
keep = d
|
|
49
|
-
total = w * (h - STATUS)
|
|
50
|
-
if raw:
|
|
51
|
-
vis = ib.copy()
|
|
52
|
-
red = Image.new("RGB", ib.size, (255, 0, 0))
|
|
53
|
-
vis.paste(red, (0, 0), keep if masked else d)
|
|
54
|
-
vis.save(f"{out}/{n}")
|
|
55
|
-
rows.append((n, "OK", raw, masked, 100.0 * masked / total))
|
|
56
|
-
zero = sum(1 for r in rows if r[1] == "OK" and r[3] == 0)
|
|
57
|
-
for r in rows:
|
|
58
|
-
if r[1] != "OK" or r[2]:
|
|
59
|
-
print(f"{r[0]:40s} {r[1]:7s} raw={r[2]} beyond_noise={r[3]} ({r[4]:.4f}%)")
|
|
60
|
-
print(f"images={len(rows)} zero_beyond_noise={zero} raw_zero={sum(1 for r in rows if r[1]=='OK' and r[2]==0)}")
|
|
61
|
-
json.dump(rows, open(f"{out}/summary.json", "w"), indent=0)
|
|
62
|
-
sys.exit(0 if zero == len(rows) else 1)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
main()
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
# File: scripts/sdui-visual/drive.py
|
|
2
|
-
# Created At: 2026-11-10 15:30:00 +07:00
|
|
3
|
-
# Created By: AI
|
|
4
|
-
# AI Agent: Claude Code
|
|
5
|
-
# Model: claude-opus-5-5
|
|
6
|
-
"""Drive the sample app: open every bundled SDUI spec, capture pages + interaction states.
|
|
7
|
-
|
|
8
|
-
usage: drive.py <outdir> [--plan plan.json] [--record plan.json] [--only a,b]
|
|
9
|
-
--record: discover page counts + tap coordinates and save them (baseline run)
|
|
10
|
-
--plan: replay exactly the page counts + taps from a recorded plan
|
|
11
|
-
(a spec missing from the plan is discovered on the fly, not saved)
|
|
12
|
-
"""
|
|
13
|
-
import io, json, re, subprocess, sys, time, os
|
|
14
|
-
from PIL import Image, ImageChops
|
|
15
|
-
|
|
16
|
-
PKG = "com.myapplication.MyApplication"
|
|
17
|
-
ACT = "com.myapplication.MainActivity"
|
|
18
|
-
USAGE_KT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..",
|
|
19
|
-
"sample/shared/src/commonMain/kotlin/screens/SduiUsage.kt")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def spec_list(name):
|
|
23
|
-
"""A spec list (GALLERY / BLOCKS / SHOWCASE) exactly as the sample app shows it, read from SduiUsage.kt."""
|
|
24
|
-
src = open(USAGE_KT, encoding="utf-8").read()
|
|
25
|
-
m = re.search(r"val " + name + r" = listOf\(([^)]*)\)", src)
|
|
26
|
-
if not m:
|
|
27
|
-
raise SystemExit(f"{name} list not found in {USAGE_KT}")
|
|
28
|
-
return re.findall(r'"([^"]+)"', m.group(1))
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# same order as the app's list screen
|
|
32
|
-
ALL = spec_list("SHOWCASE") + spec_list("BLOCKS") + spec_list("GALLERY")
|
|
33
|
-
# specs with state-changing actions (setState) that can be driven by taps (inputs need typing: skipped)
|
|
34
|
-
TAPPABLE = ["button", "carousel", "check-box", "chip", "collapse", "icon-button", "information", "popup-notify", "popup-promotion",
|
|
35
|
-
"radio", "rating", "slider", "stepper", "steps", "suggest-action", "swipe", "switch", "tab-view", "title",
|
|
36
|
-
"touchable-opacity", "uploader", "community", "paylater_benefits", "paylater_history"]
|
|
37
|
-
MAX_TAPS = 4
|
|
38
|
-
SETTLE = 3.0
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def sh(*a, capture=True):
|
|
42
|
-
return subprocess.run(["adb", *a], capture_output=capture, check=False).stdout
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def shot():
|
|
46
|
-
return Image.open(io.BytesIO(sh("exec-out", "screencap", "-p"))).convert("RGB")
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def dump():
|
|
50
|
-
for _ in range(3):
|
|
51
|
-
sh("shell", "uiautomator", "dump", "/sdcard/ui.xml")
|
|
52
|
-
x = sh("shell", "cat", "/sdcard/ui.xml").decode("utf-8", "replace")
|
|
53
|
-
if "<hierarchy" in x:
|
|
54
|
-
return x
|
|
55
|
-
time.sleep(0.5)
|
|
56
|
-
return ""
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
NODE = re.compile(r'<node [^>]*>')
|
|
60
|
-
def nodes(xml):
|
|
61
|
-
out = []
|
|
62
|
-
for m in NODE.finditer(xml):
|
|
63
|
-
s = m.group(0)
|
|
64
|
-
g = lambda k: (re.search(k + r'="([^"]*)"', s) or [None, ""])[1]
|
|
65
|
-
b = re.match(r'\[(\d+),(\d+)\]\[(\d+),(\d+)\]', g("bounds"))
|
|
66
|
-
if not b:
|
|
67
|
-
continue
|
|
68
|
-
x1, y1, x2, y2 = map(int, b.groups())
|
|
69
|
-
out.append(dict(text=g("text"), desc=g("content-desc"), clickable=g("clickable") == "true", b=(x1, y1, x2, y2)))
|
|
70
|
-
return out
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def tap(x, y):
|
|
74
|
-
sh("shell", "input", "tap", str(x), str(y))
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def swipe_up(dist=1000, dur=1200):
|
|
78
|
-
sh("shell", "input", "swipe", "540", "1900", "540", str(1900 - dist), str(dur))
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def swipe_down(dist=1000, dur=300):
|
|
82
|
-
sh("shell", "input", "swipe", "540", "700", "540", str(700 + dist), str(dur))
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
def find_text(name, tries=14, up=True):
|
|
86
|
-
for _ in range(tries):
|
|
87
|
-
for n in nodes(dump()):
|
|
88
|
-
if n["text"] == name and 250 < (n["b"][1] + n["b"][3]) // 2 < 2250:
|
|
89
|
-
return n
|
|
90
|
-
if up:
|
|
91
|
-
swipe_up(700, 600)
|
|
92
|
-
else:
|
|
93
|
-
swipe_down(1500, 300)
|
|
94
|
-
time.sleep(0.6)
|
|
95
|
-
return None
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def launch_to_list():
|
|
99
|
-
sh("shell", "am", "force-stop", PKG)
|
|
100
|
-
sh("shell", "am", "start", "-n", f"{PKG}/{ACT}")
|
|
101
|
-
time.sleep(4)
|
|
102
|
-
n = find_text("SDUI", tries=25)
|
|
103
|
-
if not n:
|
|
104
|
-
raise SystemExit("SDUI entry not found")
|
|
105
|
-
x1, y1, x2, y2 = n["b"]
|
|
106
|
-
tap((x1 + x2) // 2, (y1 + y2) // 2)
|
|
107
|
-
time.sleep(2)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def to_top():
|
|
111
|
-
for _ in range(6):
|
|
112
|
-
swipe_down(1600, 200)
|
|
113
|
-
time.sleep(0.8)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def open_spec(name):
|
|
117
|
-
to_top()
|
|
118
|
-
n = find_text(name, tries=14)
|
|
119
|
-
if not n:
|
|
120
|
-
raise RuntimeError(f"spec {name} not found in list")
|
|
121
|
-
x1, y1, x2, y2 = n["b"]
|
|
122
|
-
tap((x1 + x2) // 2, (y1 + y2) // 2)
|
|
123
|
-
time.sleep(SETTLE)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def back():
|
|
127
|
-
sh("shell", "input", "keyevent", "4")
|
|
128
|
-
time.sleep(1.2)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
EXTRA = {
|
|
132
|
-
"carousel": [["hswipe", 900, 543, 150, 400], ["hswipe", 900, 543, 150, 400]],
|
|
133
|
-
"slider": [["hswipe", 257, 463, 500, 800]],
|
|
134
|
-
"swipe": [["hswipe", 900, 520, 300, 800], ["hswipe", 200, 770, 800, 800]],
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def act(a):
|
|
139
|
-
if a[0] == "tap":
|
|
140
|
-
tap(a[1], a[2])
|
|
141
|
-
elif a[0] == "scroll":
|
|
142
|
-
swipe_up(); time.sleep(0.3)
|
|
143
|
-
elif a[0] == "hswipe":
|
|
144
|
-
sh("shell", "input", "swipe", str(a[1]), str(a[2]), str(a[3]), str(a[2]), str(a[4]))
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def same(a, b):
|
|
148
|
-
return ImageChops.difference(a, b).getbbox() is None
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def run(outdir, plan, record_path, only):
|
|
152
|
-
os.makedirs(outdir, exist_ok=True)
|
|
153
|
-
launch_to_list()
|
|
154
|
-
new_plan = {}
|
|
155
|
-
for name in ALL:
|
|
156
|
-
if only and name not in only:
|
|
157
|
-
continue
|
|
158
|
-
entry = (plan or {}).get(name)
|
|
159
|
-
t0 = time.time()
|
|
160
|
-
# ---- pages
|
|
161
|
-
open_spec(name)
|
|
162
|
-
pages = []
|
|
163
|
-
img = shot(); img.save(f"{outdir}/{name}-p0.png"); pages.append(img)
|
|
164
|
-
if entry is not None:
|
|
165
|
-
for p in range(1, entry["pages"]):
|
|
166
|
-
swipe_up(); time.sleep(1.5)
|
|
167
|
-
img = shot(); img.save(f"{outdir}/{name}-p{p}.png")
|
|
168
|
-
else:
|
|
169
|
-
for p in range(1, 10):
|
|
170
|
-
swipe_up(); time.sleep(1.5)
|
|
171
|
-
img = shot()
|
|
172
|
-
if same(img, pages[-1]):
|
|
173
|
-
break
|
|
174
|
-
img.save(f"{outdir}/{name}-p{p}.png"); pages.append(img)
|
|
175
|
-
npages = entry["pages"] if entry is not None else len(pages)
|
|
176
|
-
back()
|
|
177
|
-
# ---- interaction states
|
|
178
|
-
taps = []
|
|
179
|
-
if name in TAPPABLE:
|
|
180
|
-
open_spec(name)
|
|
181
|
-
if entry is not None:
|
|
182
|
-
taps = entry["taps"]
|
|
183
|
-
for k, a in enumerate(taps):
|
|
184
|
-
act(a)
|
|
185
|
-
if a[0] == "scroll":
|
|
186
|
-
if k + 1 < len(taps) and taps[k + 1][0] != "scroll":
|
|
187
|
-
time.sleep(1.5)
|
|
188
|
-
continue
|
|
189
|
-
time.sleep(1.8)
|
|
190
|
-
shot().save(f"{outdir}/{name}-tap{k}.png")
|
|
191
|
-
else:
|
|
192
|
-
k = 0
|
|
193
|
-
for pg in range(npages if npages > 1 else 1):
|
|
194
|
-
if pg > 0 and pg != npages - 1:
|
|
195
|
-
continue
|
|
196
|
-
if pg > 0:
|
|
197
|
-
for _ in range(npages - 1):
|
|
198
|
-
a = ["scroll"]; act(a); taps.append(a)
|
|
199
|
-
time.sleep(1.5)
|
|
200
|
-
seen = set(); n_here = 0
|
|
201
|
-
for n in [n for n in nodes(dump()) if n["clickable"] and n["b"][1] > 300 and n["b"][3] < 2250]:
|
|
202
|
-
c = ((n["b"][0] + n["b"][2]) // 2, (n["b"][1] + n["b"][3]) // 2)
|
|
203
|
-
if c in seen:
|
|
204
|
-
continue
|
|
205
|
-
seen.add(c)
|
|
206
|
-
a = ["tap", c[0], c[1]]; act(a); taps.append(a); time.sleep(1.8)
|
|
207
|
-
shot().save(f"{outdir}/{name}-tap{len(taps) - 1}.png")
|
|
208
|
-
n_here += 1
|
|
209
|
-
if n_here >= MAX_TAPS:
|
|
210
|
-
break
|
|
211
|
-
for a in EXTRA.get(name, []):
|
|
212
|
-
act(a); taps.append(a); time.sleep(1.8)
|
|
213
|
-
shot().save(f"{outdir}/{name}-tap{len(taps) - 1}.png")
|
|
214
|
-
back()
|
|
215
|
-
# a tap may have opened a popup / modal: make sure we are back on the list
|
|
216
|
-
if not find_text(name, tries=1):
|
|
217
|
-
back()
|
|
218
|
-
new_plan[name] = {"pages": npages, "taps": taps}
|
|
219
|
-
print(f"{name}: pages={npages} taps={len(taps)} ({time.time() - t0:.1f}s)", flush=True)
|
|
220
|
-
if record_path:
|
|
221
|
-
json.dump(new_plan, open(record_path, "w"), indent=1)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
if __name__ == "__main__":
|
|
225
|
-
args = sys.argv[1:]
|
|
226
|
-
out = args[0]
|
|
227
|
-
plan = rec = None; only = None
|
|
228
|
-
if "--plan" in args:
|
|
229
|
-
plan = json.load(open(args[args.index("--plan") + 1]))
|
|
230
|
-
if "--record" in args:
|
|
231
|
-
rec = args[args.index("--record") + 1]
|
|
232
|
-
if "--only" in args:
|
|
233
|
-
only = set(args[args.index("--only") + 1].split(","))
|
|
234
|
-
run(out, plan, rec, only)
|