@momo-kits/native-kits 0.300.3 → 0.300.4-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 +51 -7
- package/README.md +2 -2
- package/build.gradle.kts +13 -0
- package/compose/build.gradle.kts +197 -0
- package/compose/build.gradle.kts.backup +197 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +20 -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 +153 -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 +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1071 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +65 -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 +357 -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 +128 -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 +542 -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 +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +189 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +478 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +265 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +223 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +185 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -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 +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +361 -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 +308 -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 +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +330 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +220 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -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 +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +560 -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 +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +501 -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 +236 -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 +17 -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 +287 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +306 -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 +52 -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 +338 -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 +137 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +215 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +404 -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 +732 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +233 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +217 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +97 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +377 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +455 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +103 -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 +413 -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/HelpCenterRequest.kt +37 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +192 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +135 -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 +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +74 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +20 -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 +118 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +44 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +62 -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 +36 -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 +66 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +217 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +138 -0
- package/gradle/libs.versions.toml +68 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Application/ApplicationEnvironment.swift +24 -6
- package/ios/Application/DesignSystemKits.swift +100 -0
- package/ios/Application/DesignSystemKitsPayload.swift +68 -0
- package/ios/Application/MaxApi.swift +30 -3
- package/ios/Avatar/Avatar.swift +4 -3
- package/ios/Badge/Badge.swift +6 -4
- package/ios/Badge/BadgeDot.swift +1 -1
- package/ios/Badge/BadgeRibbon.swift +8 -2
- package/ios/Button/Button.swift +15 -12
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +64 -18
- package/ios/Carousel/Carousel.swift +29 -12
- package/ios/Checkbox/Checkbox.swift +7 -3
- package/ios/Chip/Chip.swift +5 -4
- package/ios/Collapse/Collapse.swift +70 -19
- package/ios/Colors+Radius+Spacing/Colors.swift +10 -1
- package/ios/Colors+Radius+Spacing/Radius.swift +6 -0
- package/ios/DateTimePicker/DateTimePicker.swift +54 -20
- package/ios/DateTimePicker/WheelPicker.swift +103 -105
- package/ios/Divider/Divider.swift +37 -4
- package/ios/Extensions/Color++.swift +38 -9
- package/ios/Extensions/OptionalEnvironmentObject.swift +12 -0
- package/ios/Extensions/SkeletonUICompat.swift +11 -0
- package/ios/Icon/Icon.swift +21 -23
- package/ios/Icon/Icons.swift +1329 -0
- package/ios/IconButton/IconButton.swift +15 -7
- package/ios/Image/Image.swift +7 -23
- package/ios/Information/Information.swift +27 -9
- package/ios/Input/ErrorView.swift +2 -2
- package/ios/Input/Input.swift +171 -148
- package/ios/Input/InputPhoneNumber.swift +10 -9
- package/ios/Input/InputSearch.swift +107 -78
- package/ios/Input/InputTextArea.swift +133 -148
- package/ios/InputDropDown/InputDropDown.swift +10 -7
- package/ios/InputMoney/InputMoney.swift +32 -11
- package/ios/InputOTP/InputOTP.swift +22 -12
- package/ios/Layout/Card.swift +50 -0
- package/ios/Layout/GridContext.swift +187 -3
- package/ios/Layout/Item.swift +5 -4
- package/ios/Layout/ScreenLayout.swift +415 -0
- package/ios/Layout/Section.swift +4 -100
- package/ios/Loader/Loader.swift +5 -9
- package/ios/Lottie/LottieView.swift +14 -2
- package/ios/{Application/Navigation/Overplay → Navigation}/BottomSheet.swift +169 -29
- package/ios/Navigation/BottomTab/BottomTab.swift +332 -0
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTabBar.swift +18 -7
- package/ios/Navigation/BottomTab/DuoBarCompression.swift +104 -0
- package/ios/Navigation/BottomTab/DuoTabBar.swift +329 -0
- package/ios/{Application → Navigation/Component}/FloatingButton.swift +43 -54
- package/ios/Navigation/Component/Header.swift +545 -0
- package/ios/Navigation/Component/HeaderBackground.swift +154 -0
- package/ios/Navigation/Component/HeaderJourney.swift +73 -0
- package/ios/Navigation/Component/HeaderLocation.swift +48 -0
- package/ios/Navigation/Component/HeaderRight.swift +425 -0
- package/ios/Navigation/Component/HeaderTitle.swift +36 -0
- package/ios/{Application/Navigation → Navigation/Component}/HeaderUser.swift +21 -24
- package/ios/Navigation/Component/SideBar.swift +183 -0
- package/ios/{Application/Navigation/Overplay → Navigation/Component}/SnackBar.swift +8 -8
- package/ios/Navigation/HostBackGestureBridge.swift +78 -0
- package/ios/{Application/Navigation/Overplay → Navigation}/ModalScreen.swift +9 -2
- package/ios/Navigation/Navigation.swift +204 -0
- package/ios/Navigation/NavigationContainer.swift +195 -0
- package/ios/{Application/Navigation → Navigation}/Navigator.swift +207 -107
- package/ios/Navigation/StackScreen.swift +930 -0
- package/ios/Navigation/StackTransition.swift +400 -0
- package/ios/Navigation/SwipeBackHaptic.swift +33 -0
- package/ios/{Application/Navigation → Navigation}/Tracking/ScreenTracker.swift +12 -5
- package/ios/OTPKeyboard/OTPKeyboard.swift +8 -11
- package/ios/Pagination/PaginationScroll.swift +2 -2
- package/ios/Popup/PopupDisplay.swift +72 -135
- package/ios/Popup/PopupInput.swift +10 -13
- package/ios/Popup/PopupLayout.swift +138 -0
- package/ios/Popup/PopupNotify.swift +59 -69
- package/ios/Popup/PopupPromotion.swift +31 -47
- package/ios/PopupView/FullscreenPopup.swift +13 -19
- package/ios/PopupView/PopupView.swift +1 -1
- package/ios/PopupView/Utils++.swift +0 -8
- package/ios/ProgressInfo/ProgressInfo.swift +4 -2
- package/ios/Radio/Radio.swift +2 -1
- package/ios/Rating/Rating.swift +9 -1
- package/ios/Resources/dot_loading.json +558 -0
- package/ios/Resources/lottie_circle_loader.json +1 -0
- package/ios/ScrollIndicator/ScrollIndicator.swift +11 -10
- package/ios/Skeleton/Skeleton.swift +22 -27
- package/ios/Slider/Slider.swift +16 -18
- package/ios/Stepper/Stepper.swift +7 -3
- package/ios/Steps/Steps.swift +8 -6
- package/ios/SuggestAction/SuggestAction.swift +5 -0
- package/ios/Swipeable/SwipeCell.swift +10 -6
- package/ios/Switch/Switch.swift +22 -20
- package/ios/TabView/TabView.swift +102 -21
- package/ios/Tag/Tag.swift +15 -4
- package/ios/Template/Logo/Logo.swift +2 -1
- package/ios/Template/TrustBanner/TrustBanner.swift +109 -55
- package/ios/Title/Title.swift +6 -17
- package/ios/Tooltip/Tooltip.swift +29 -14
- package/ios/Typography/FontScale.swift +17 -14
- package/ios/Typography/Text.swift +156 -20
- package/ios/Typography/Typography.swift +2 -2
- package/ios/Uploader/Uploader.swift +3 -1
- package/ios/native-kits.podspec +2 -3
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -3
- package/ios-demo/README.md +120 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DuoTabDemo.swift +80 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +2 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IPhoneDuoDemo.swift +173 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +77 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +2 -2
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +2 -0
- package/package.json +1 -1
- package/publish.sh +19 -2
- package/scripts/gen-ios-icons.mjs +36 -0
- package/settings.gradle.kts +64 -0
- package/ios/Application/Components.swift +0 -270
- package/ios/Application/ComposeApi.swift +0 -22
- package/ios/Application/HeaderRight.swift +0 -306
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +0 -104
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/NavigationContainer.swift +0 -213
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/NavigatorManager.swift +0 -22
- package/ios/Application/Navigation/component/Header.swift +0 -178
- package/ios/Application/Navigation/component/HeaderBackground.swift +0 -83
- package/ios/Application/Navigation/component/HeaderColor.swift +0 -65
- package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +0 -11
- package/ios/Application/Navigation/component/NavigationFooter.swift +0 -90
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +0 -196
- package/ios/Application/Screen.swift +0 -250
- package/ios/Application/StackScreen.swift +0 -492
- package/ios/Typography/FontScaleStore.swift +0 -58
- package/ios/Typography/KitDesignSystem.swift +0 -17
- /package/ios/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
package/gradlew
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Copyright © 2015-2021 the original authors.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
19
|
+
#
|
|
20
|
+
|
|
21
|
+
##############################################################################
|
|
22
|
+
#
|
|
23
|
+
# Gradle start up script for POSIX generated by Gradle.
|
|
24
|
+
#
|
|
25
|
+
# Important for running:
|
|
26
|
+
#
|
|
27
|
+
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
28
|
+
# noncompliant, but you have some other compliant shell such as ksh or
|
|
29
|
+
# bash, then to run this script, type that shell name before the whole
|
|
30
|
+
# command line, like:
|
|
31
|
+
#
|
|
32
|
+
# ksh Gradle
|
|
33
|
+
#
|
|
34
|
+
# Busybox and similar reduced shells will NOT work, because this script
|
|
35
|
+
# requires all of these POSIX shell features:
|
|
36
|
+
# * functions;
|
|
37
|
+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
38
|
+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
39
|
+
# * compound commands having a testable exit status, especially «case»;
|
|
40
|
+
# * various built-in commands including «command», «set», and «ulimit».
|
|
41
|
+
#
|
|
42
|
+
# Important for patching:
|
|
43
|
+
#
|
|
44
|
+
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
45
|
+
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
46
|
+
#
|
|
47
|
+
# The "traditional" practice of packing multiple parameters into a
|
|
48
|
+
# space-separated string is a well documented source of bugs and security
|
|
49
|
+
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
50
|
+
# options in "$@", and eventually passing that to Java.
|
|
51
|
+
#
|
|
52
|
+
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
53
|
+
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
54
|
+
# see the in-line comments for details.
|
|
55
|
+
#
|
|
56
|
+
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
57
|
+
# Darwin, MinGW, and NonStop.
|
|
58
|
+
#
|
|
59
|
+
# (3) This script is generated from the Groovy template
|
|
60
|
+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
61
|
+
# within the Gradle project.
|
|
62
|
+
#
|
|
63
|
+
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
64
|
+
#
|
|
65
|
+
##############################################################################
|
|
66
|
+
|
|
67
|
+
# Attempt to set APP_HOME
|
|
68
|
+
|
|
69
|
+
# Resolve links: $0 may be a link
|
|
70
|
+
app_path=$0
|
|
71
|
+
|
|
72
|
+
# Need this for daisy-chained symlinks.
|
|
73
|
+
while
|
|
74
|
+
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
75
|
+
[ -h "$app_path" ]
|
|
76
|
+
do
|
|
77
|
+
ls=$( ls -ld "$app_path" )
|
|
78
|
+
link=${ls#*' -> '}
|
|
79
|
+
case $link in #(
|
|
80
|
+
/*) app_path=$link ;; #(
|
|
81
|
+
*) app_path=$APP_HOME$link ;;
|
|
82
|
+
esac
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
# This is normally unused
|
|
86
|
+
# shellcheck disable=SC2034
|
|
87
|
+
APP_BASE_NAME=${0##*/}
|
|
88
|
+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
|
89
|
+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
|
90
|
+
' "$PWD" ) || exit
|
|
91
|
+
|
|
92
|
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
93
|
+
MAX_FD=maximum
|
|
94
|
+
|
|
95
|
+
warn () {
|
|
96
|
+
echo "$*"
|
|
97
|
+
} >&2
|
|
98
|
+
|
|
99
|
+
die () {
|
|
100
|
+
echo
|
|
101
|
+
echo "$*"
|
|
102
|
+
echo
|
|
103
|
+
exit 1
|
|
104
|
+
} >&2
|
|
105
|
+
|
|
106
|
+
# OS specific support (must be 'true' or 'false').
|
|
107
|
+
cygwin=false
|
|
108
|
+
msys=false
|
|
109
|
+
darwin=false
|
|
110
|
+
nonstop=false
|
|
111
|
+
case "$( uname )" in #(
|
|
112
|
+
CYGWIN* ) cygwin=true ;; #(
|
|
113
|
+
Darwin* ) darwin=true ;; #(
|
|
114
|
+
MSYS* | MINGW* ) msys=true ;; #(
|
|
115
|
+
NONSTOP* ) nonstop=true ;;
|
|
116
|
+
esac
|
|
117
|
+
|
|
118
|
+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# Determine the Java command to use to start the JVM.
|
|
122
|
+
if [ -n "$JAVA_HOME" ] ; then
|
|
123
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
124
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
125
|
+
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
126
|
+
else
|
|
127
|
+
JAVACMD=$JAVA_HOME/bin/java
|
|
128
|
+
fi
|
|
129
|
+
if [ ! -x "$JAVACMD" ] ; then
|
|
130
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
131
|
+
|
|
132
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
133
|
+
location of your Java installation."
|
|
134
|
+
fi
|
|
135
|
+
else
|
|
136
|
+
JAVACMD=java
|
|
137
|
+
if ! command -v java >/dev/null 2>&1
|
|
138
|
+
then
|
|
139
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
140
|
+
|
|
141
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
142
|
+
location of your Java installation."
|
|
143
|
+
fi
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# Increase the maximum file descriptors if we can.
|
|
147
|
+
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
148
|
+
case $MAX_FD in #(
|
|
149
|
+
max*)
|
|
150
|
+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
151
|
+
# shellcheck disable=SC2039,SC3045
|
|
152
|
+
MAX_FD=$( ulimit -H -n ) ||
|
|
153
|
+
warn "Could not query maximum file descriptor limit"
|
|
154
|
+
esac
|
|
155
|
+
case $MAX_FD in #(
|
|
156
|
+
'' | soft) :;; #(
|
|
157
|
+
*)
|
|
158
|
+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
159
|
+
# shellcheck disable=SC2039,SC3045
|
|
160
|
+
ulimit -n "$MAX_FD" ||
|
|
161
|
+
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
162
|
+
esac
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
# Collect all arguments for the java command, stacking in reverse order:
|
|
166
|
+
# * args from the command line
|
|
167
|
+
# * the main class name
|
|
168
|
+
# * -classpath
|
|
169
|
+
# * -D...appname settings
|
|
170
|
+
# * --module-path (only if needed)
|
|
171
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
172
|
+
|
|
173
|
+
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
174
|
+
if "$cygwin" || "$msys" ; then
|
|
175
|
+
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
176
|
+
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
177
|
+
|
|
178
|
+
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
179
|
+
|
|
180
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
181
|
+
for arg do
|
|
182
|
+
if
|
|
183
|
+
case $arg in #(
|
|
184
|
+
-*) false ;; # don't mess with options #(
|
|
185
|
+
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
186
|
+
[ -e "$t" ] ;; #(
|
|
187
|
+
*) false ;;
|
|
188
|
+
esac
|
|
189
|
+
then
|
|
190
|
+
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
191
|
+
fi
|
|
192
|
+
# Roll the args list around exactly as many times as the number of
|
|
193
|
+
# args, so each arg winds up back in the position where it started, but
|
|
194
|
+
# possibly modified.
|
|
195
|
+
#
|
|
196
|
+
# NB: a `for` loop captures its iteration list before it begins, so
|
|
197
|
+
# changing the positional parameters here affects neither the number of
|
|
198
|
+
# iterations, nor the values presented in `arg`.
|
|
199
|
+
shift # remove old arg
|
|
200
|
+
set -- "$@" "$arg" # push replacement arg
|
|
201
|
+
done
|
|
202
|
+
fi
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
206
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
207
|
+
|
|
208
|
+
# Collect all arguments for the java command:
|
|
209
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
210
|
+
# and any embedded shellness will be escaped.
|
|
211
|
+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
212
|
+
# treated as '${Hostname}' itself on the command line.
|
|
213
|
+
|
|
214
|
+
set -- \
|
|
215
|
+
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
216
|
+
-classpath "$CLASSPATH" \
|
|
217
|
+
org.gradle.wrapper.GradleWrapperMain \
|
|
218
|
+
"$@"
|
|
219
|
+
|
|
220
|
+
# Stop when "xargs" is not available.
|
|
221
|
+
if ! command -v xargs >/dev/null 2>&1
|
|
222
|
+
then
|
|
223
|
+
die "xargs is not available"
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
# Use "xargs" to parse quoted args.
|
|
227
|
+
#
|
|
228
|
+
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
229
|
+
#
|
|
230
|
+
# In Bash we could simply go:
|
|
231
|
+
#
|
|
232
|
+
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
233
|
+
# set -- "${ARGS[@]}" "$@"
|
|
234
|
+
#
|
|
235
|
+
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
236
|
+
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
237
|
+
# character that might be a shell metacharacter, then use eval to reverse
|
|
238
|
+
# that process (while maintaining the separation between arguments), and wrap
|
|
239
|
+
# the whole thing up as a single "set" statement.
|
|
240
|
+
#
|
|
241
|
+
# This will of course break if any of these variables contains a newline or
|
|
242
|
+
# an unmatched quote.
|
|
243
|
+
#
|
|
244
|
+
|
|
245
|
+
eval "set -- $(
|
|
246
|
+
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
247
|
+
xargs -n1 |
|
|
248
|
+
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
249
|
+
tr '\n' ' '
|
|
250
|
+
)" '"$@"'
|
|
251
|
+
|
|
252
|
+
exec "$JAVACMD" "$@"
|
package/gradlew.bat
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@rem
|
|
2
|
+
@rem Copyright 2015 the original author or authors.
|
|
3
|
+
@rem
|
|
4
|
+
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
@rem you may not use this file except in compliance with the License.
|
|
6
|
+
@rem You may obtain a copy of the License at
|
|
7
|
+
@rem
|
|
8
|
+
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
@rem
|
|
10
|
+
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
@rem See the License for the specific language governing permissions and
|
|
14
|
+
@rem limitations under the License.
|
|
15
|
+
@rem
|
|
16
|
+
@rem SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
@rem
|
|
18
|
+
|
|
19
|
+
@if "%DEBUG%"=="" @echo off
|
|
20
|
+
@rem ##########################################################################
|
|
21
|
+
@rem
|
|
22
|
+
@rem Gradle startup script for Windows
|
|
23
|
+
@rem
|
|
24
|
+
@rem ##########################################################################
|
|
25
|
+
|
|
26
|
+
@rem Set local scope for the variables with windows NT shell
|
|
27
|
+
if "%OS%"=="Windows_NT" setlocal
|
|
28
|
+
|
|
29
|
+
set DIRNAME=%~dp0
|
|
30
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
31
|
+
@rem This is normally unused
|
|
32
|
+
set APP_BASE_NAME=%~n0
|
|
33
|
+
set APP_HOME=%DIRNAME%
|
|
34
|
+
|
|
35
|
+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
36
|
+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
37
|
+
|
|
38
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
39
|
+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
40
|
+
|
|
41
|
+
@rem Find java.exe
|
|
42
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
43
|
+
|
|
44
|
+
set JAVA_EXE=java.exe
|
|
45
|
+
%JAVA_EXE% -version >NUL 2>&1
|
|
46
|
+
if %ERRORLEVEL% equ 0 goto execute
|
|
47
|
+
|
|
48
|
+
echo. 1>&2
|
|
49
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
|
50
|
+
echo. 1>&2
|
|
51
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
52
|
+
echo location of your Java installation. 1>&2
|
|
53
|
+
|
|
54
|
+
goto fail
|
|
55
|
+
|
|
56
|
+
:findJavaFromJavaHome
|
|
57
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
|
58
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
59
|
+
|
|
60
|
+
if exist "%JAVA_EXE%" goto execute
|
|
61
|
+
|
|
62
|
+
echo. 1>&2
|
|
63
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
|
64
|
+
echo. 1>&2
|
|
65
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
66
|
+
echo location of your Java installation. 1>&2
|
|
67
|
+
|
|
68
|
+
goto fail
|
|
69
|
+
|
|
70
|
+
:execute
|
|
71
|
+
@rem Setup the command line
|
|
72
|
+
|
|
73
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@rem Execute Gradle
|
|
77
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
78
|
+
|
|
79
|
+
:end
|
|
80
|
+
@rem End local scope for the variables with windows NT shell
|
|
81
|
+
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
82
|
+
|
|
83
|
+
:fail
|
|
84
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
85
|
+
rem the _cmd.exe /c_ return code!
|
|
86
|
+
set EXIT_CODE=%ERRORLEVEL%
|
|
87
|
+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
88
|
+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
89
|
+
exit /b %EXIT_CODE%
|
|
90
|
+
|
|
91
|
+
:mainEnd
|
|
92
|
+
if "%OS%"=="Windows_NT" endlocal
|
|
93
|
+
|
|
94
|
+
:omega
|
|
@@ -17,8 +17,8 @@ public class MiniAppContext {
|
|
|
17
17
|
public var toolkitConfig: [String: Any] = [:]
|
|
18
18
|
public var providerId: String = "momo"
|
|
19
19
|
public var permissions: [[String: Any]] = []
|
|
20
|
-
// Per-mini-app font-scale override; nil falls back to
|
|
21
|
-
// MiniAppContext.userScaleRate / useOSScaleRate, which win per field over
|
|
20
|
+
// Per-mini-app font-scale override; nil falls back to DesignSystemKits. Mirrors Compose's
|
|
21
|
+
// MiniAppContext.userScaleRate / useOSScaleRate, which win per field over DesignSystemKits.
|
|
22
22
|
public var userScaleRate: CGFloat? = nil
|
|
23
23
|
public var useOSScaleRate: Bool? = nil
|
|
24
24
|
|
|
@@ -37,10 +37,17 @@ public class MiniAppContext {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
public var
|
|
43
|
-
public var
|
|
40
|
+
// Value type so DesignSystemKitsConfigs can dedupe host pushes; mirrors Compose's DesignSystemConfig.
|
|
41
|
+
public struct KitConfig: Equatable {
|
|
42
|
+
public var trustBanner: TrustBannerData?
|
|
43
|
+
public var headerBar: String?
|
|
44
|
+
public var headerGradient: String?
|
|
45
|
+
|
|
46
|
+
public init(trustBanner: TrustBannerData? = nil, headerBar: String? = nil, headerGradient: String? = nil) {
|
|
47
|
+
self.trustBanner = trustBanner
|
|
48
|
+
self.headerBar = headerBar
|
|
49
|
+
self.headerGradient = headerGradient
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
public class ApplicationEnvironment: ObservableObject {
|
|
@@ -59,6 +66,17 @@ public class ApplicationEnvironment: ObservableObject {
|
|
|
59
66
|
}
|
|
60
67
|
}
|
|
61
68
|
|
|
69
|
+
extension ApplicationEnvironment {
|
|
70
|
+
/// Closes the mini app: through `composeApi` as before, else `maxApi` (Compose `maxApi.dismiss`).
|
|
71
|
+
func requestDismiss() {
|
|
72
|
+
if let composeApi {
|
|
73
|
+
composeApi.requestCallback(funcName: "dismiss", params: nil, onResponse: nil)
|
|
74
|
+
} else {
|
|
75
|
+
maxApi?.dismiss(completion: nil)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
62
80
|
private struct ApplicationEnvironmentKey: EnvironmentKey {
|
|
63
81
|
static let defaultValue = ApplicationEnvironment()
|
|
64
82
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// File: ios/Application/DesignSystemKits.swift
|
|
2
|
+
// Created At: 2026-10-02 14:17:29 +07:00
|
|
3
|
+
// Created By: AI
|
|
4
|
+
// AI Agent: Claude Code
|
|
5
|
+
// Model: claude-opus-5-5
|
|
6
|
+
|
|
7
|
+
// AI-GENERATED START: app-wide design-system holder mirroring Compose's DesignSystemKits
|
|
8
|
+
import SwiftUI
|
|
9
|
+
|
|
10
|
+
/// Host-owned design-system inputs; mirrors Compose's `DesignSystemKitsConfigs` field for field.
|
|
11
|
+
public struct DesignSystemKitsConfigs: Equatable {
|
|
12
|
+
public var userScaleRate: CGFloat
|
|
13
|
+
public var useOSScaleRate: Bool
|
|
14
|
+
public var isWhiteList: Bool
|
|
15
|
+
public var designSystemConfig: KitConfig?
|
|
16
|
+
|
|
17
|
+
public init(
|
|
18
|
+
userScaleRate: CGFloat = 1,
|
|
19
|
+
useOSScaleRate: Bool = true,
|
|
20
|
+
isWhiteList: Bool = false,
|
|
21
|
+
designSystemConfig: KitConfig? = nil
|
|
22
|
+
) {
|
|
23
|
+
self.userScaleRate = userScaleRate
|
|
24
|
+
self.useOSScaleRate = useOSScaleRate
|
|
25
|
+
self.isWhiteList = isWhiteList
|
|
26
|
+
self.designSystemConfig = designSystemConfig
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// App-wide holder for the SwiftUI kit, mirroring Compose's `DesignSystemKits`. The kit is sandboxed from the
|
|
31
|
+
/// host, so the host pushes `setConfigs(_:)` at startup and on every change; the OS Dynamic Type factor is
|
|
32
|
+
/// tracked here. Views re-render on change as long as the subtree got `.momoFontScale()` (`NavigationContainer`
|
|
33
|
+
/// applies it). Swift reserves `init`, so there is no `init(source:)` twin: the host observes and pushes.
|
|
34
|
+
public final class DesignSystemKits: ObservableObject {
|
|
35
|
+
public static let shared = DesignSystemKits()
|
|
36
|
+
|
|
37
|
+
@Published private var configs = DesignSystemKitsConfigs()
|
|
38
|
+
@Published public private(set) var osFontScale: CGFloat = DesignSystemKits.currentOsFontScale()
|
|
39
|
+
|
|
40
|
+
private init() {
|
|
41
|
+
NotificationCenter.default.addObserver(
|
|
42
|
+
self,
|
|
43
|
+
selector: #selector(contentSizeCategoryDidChange),
|
|
44
|
+
name: UIContentSizeCategory.didChangeNotification,
|
|
45
|
+
object: nil
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public func setConfigs(_ configs: DesignSystemKitsConfigs) {
|
|
50
|
+
onMain {
|
|
51
|
+
// Re-assigning an unchanged value would still publish and invalidate every kit subtree.
|
|
52
|
+
guard self.configs != configs else { return }
|
|
53
|
+
self.configs = configs
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public func getConfigs() -> DesignSystemKitsConfigs {
|
|
58
|
+
configs
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public var fontScale: FontScale {
|
|
62
|
+
FontScale(
|
|
63
|
+
userScaleRate: configs.userScaleRate,
|
|
64
|
+
useOSScaleRate: configs.useOSScaleRate,
|
|
65
|
+
osFontScale: osFontScale
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@objc private func contentSizeCategoryDidChange() {
|
|
70
|
+
let next = Self.currentOsFontScale()
|
|
71
|
+
guard next != osFontScale else { return }
|
|
72
|
+
osFontScale = next
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/// Same factor Compose's iOS `ProvideOsFontScale` derives from
|
|
76
|
+
/// `UIFont.preferredFont(forTextStyle: .body).pointSize / 17`, so both iOS surfaces scale alike.
|
|
77
|
+
static func currentOsFontScale() -> CGFloat {
|
|
78
|
+
let base = UIFont.systemFont(ofSize: UIFont.labelFontSize)
|
|
79
|
+
return UIFontMetrics.default.scaledFont(for: base).pointSize / base.pointSize
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/// Synchronous when already on main — an async hop would defer the change by a frame.
|
|
83
|
+
private func onMain(_ work: @escaping () -> Void) {
|
|
84
|
+
if Thread.isMainThread { work() } else { DispatchQueue.main.async(execute: work) }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private struct DesignSystemKitsConfigsKey: EnvironmentKey {
|
|
89
|
+
/// Computed, never stored: an un-injected subtree still reads the live holder, just not reactively.
|
|
90
|
+
static var defaultValue: DesignSystemKitsConfigs { DesignSystemKits.shared.getConfigs() }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public extension EnvironmentValues {
|
|
94
|
+
/// Injected by `.momoFontScale()`; never set it directly (same trap as `\.momoFontScale`).
|
|
95
|
+
var designSystemKitsConfigs: DesignSystemKitsConfigs {
|
|
96
|
+
get { self[DesignSystemKitsConfigsKey.self] }
|
|
97
|
+
set { self[DesignSystemKitsConfigsKey.self] = newValue }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// AI-GENERATED END: app-wide design-system holder mirroring Compose's DesignSystemKits
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// File: ios/Application/DesignSystemKitsPayload.swift
|
|
2
|
+
// Created At: 2026-10-02 15:40:00 +07:00
|
|
3
|
+
// Created By: AI
|
|
4
|
+
// AI Agent: Claude Code
|
|
5
|
+
// Model: claude-opus-5-5
|
|
6
|
+
|
|
7
|
+
// AI-GENERATED START: JSON entry point for hosts that can't share Swift types with the kit
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
public extension DesignSystemKits {
|
|
11
|
+
/// Applies configs pushed as JSON by a host that can't share Swift types with the kit (e.g. the KMP bridge).
|
|
12
|
+
/// Invalid JSON is ignored and the current configs are kept.
|
|
13
|
+
func setConfigs(json: String) {
|
|
14
|
+
guard let data = json.data(using: .utf8),
|
|
15
|
+
let payload = try? JSONDecoder().decode(DesignSystemKitsPayload.self, from: data) else { return }
|
|
16
|
+
setConfigs(payload.configs)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Wire format; field names match the host's serializer (momo-app HostDesignSystemKits / DesignSystemData.kt).
|
|
21
|
+
private struct DesignSystemKitsPayload: Decodable {
|
|
22
|
+
let userScaleRate: CGFloat
|
|
23
|
+
let useOSScaleRate: Bool
|
|
24
|
+
let isWhiteList: Bool
|
|
25
|
+
let designSystemConfig: KitConfigPayload?
|
|
26
|
+
|
|
27
|
+
var configs: DesignSystemKitsConfigs {
|
|
28
|
+
DesignSystemKitsConfigs(
|
|
29
|
+
userScaleRate: userScaleRate,
|
|
30
|
+
useOSScaleRate: useOSScaleRate,
|
|
31
|
+
isWhiteList: isWhiteList,
|
|
32
|
+
designSystemConfig: designSystemConfig?.kitConfig
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private struct KitConfigPayload: Decodable {
|
|
38
|
+
let trustBanner: TrustBannerPayload?
|
|
39
|
+
let headerBar: String?
|
|
40
|
+
let headerGradient: String?
|
|
41
|
+
|
|
42
|
+
var kitConfig: KitConfig {
|
|
43
|
+
KitConfig(trustBanner: trustBanner?.trustBannerData, headerBar: headerBar, headerGradient: headerGradient)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private struct TrustBannerPayload: Decodable {
|
|
48
|
+
let content: [String: String]
|
|
49
|
+
let subContent: [String: String]
|
|
50
|
+
let pciImage: String?
|
|
51
|
+
let sslImage: String?
|
|
52
|
+
let urlConfig: String?
|
|
53
|
+
let icons: [String]?
|
|
54
|
+
let momoImage: String?
|
|
55
|
+
|
|
56
|
+
var trustBannerData: TrustBannerData {
|
|
57
|
+
TrustBannerData(
|
|
58
|
+
content: content,
|
|
59
|
+
subContent: subContent,
|
|
60
|
+
pciImage: pciImage,
|
|
61
|
+
momoImage: momoImage,
|
|
62
|
+
sslImage: sslImage,
|
|
63
|
+
icons: icons,
|
|
64
|
+
urlConfig: urlConfig ?? ""
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// AI-GENERATED END: JSON entry point for hosts that can't share Swift types with the kit
|
|
@@ -5,14 +5,41 @@
|
|
|
5
5
|
// Swift mirror of the host-app bridge exposed on Kotlin as `vn.momo.maxapi.IMaxApi`
|
|
6
6
|
// (`LocalMaxApi`). `IMaxApi` itself is an external compiled dependency with no
|
|
7
7
|
// source in this repo, so this protocol intentionally exposes only the methods
|
|
8
|
-
// this kit's Kotlin source actually calls
|
|
9
|
-
//
|
|
8
|
+
// this kit's Kotlin source actually calls — not a full guess at IMaxApi's real surface.
|
|
9
|
+
// Callbacks carry IMaxApi's `["response": …]` payload.
|
|
10
10
|
//
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import UIKit
|
|
13
13
|
|
|
14
14
|
public protocol MaxApi {
|
|
15
15
|
func track(eventName: String, params: [String: Any?])
|
|
16
16
|
func dismiss(completion: (() -> Void)?)
|
|
17
17
|
func getLanguage(callback: @escaping ([String: Any?]?) -> Void)
|
|
18
|
+
/// `type` is the IMaxApi vibration name (`"light"`, …).
|
|
19
|
+
func triggerEventVibration(_ type: String)
|
|
20
|
+
// Toolkit (Compose `HeaderRight.Toolkit`).
|
|
21
|
+
func isFavoriteApp(_ params: [String: Any?], callback: @escaping ([String: Any?]?) -> Void)
|
|
22
|
+
func onToolAction(_ params: [String: Any?], callback: @escaping ([String: Any?]?) -> Void)
|
|
23
|
+
func showTools(_ params: [String: Any?], callback: @escaping ([String: Any?]?) -> Void)
|
|
24
|
+
func showHelpCenter(_ params: [String: Any?], callback: @escaping ([String: Any?]?) -> Void)
|
|
25
|
+
/// Back to the host home, closing every mini app.
|
|
26
|
+
func dismissAll(completion: (() -> Void)?)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public extension MaxApi {
|
|
30
|
+
/// Hosts that don't bridge haptics still get the system light tick.
|
|
31
|
+
func triggerEventVibration(_ type: String) {
|
|
32
|
+
UIImpactFeedbackGenerator(style: .light).impactOccurred()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Hosts that don't bridge the toolkit keep it inert, as before these joined the protocol.
|
|
36
|
+
func isFavoriteApp(_ params: [String: Any?], callback: @escaping ([String: Any?]?) -> Void) {}
|
|
37
|
+
func onToolAction(_ params: [String: Any?], callback: @escaping ([String: Any?]?) -> Void) {}
|
|
38
|
+
func showTools(_ params: [String: Any?], callback: @escaping ([String: Any?]?) -> Void) {}
|
|
39
|
+
func showHelpCenter(_ params: [String: Any?], callback: @escaping ([String: Any?]?) -> Void) {}
|
|
40
|
+
|
|
41
|
+
/// Without a home to return to, closing this mini app is the closest thing.
|
|
42
|
+
func dismissAll(completion: (() -> Void)?) {
|
|
43
|
+
dismiss(completion: completion)
|
|
44
|
+
}
|
|
18
45
|
}
|
package/ios/Avatar/Avatar.swift
CHANGED
|
@@ -74,12 +74,12 @@ public struct Avatar: View {
|
|
|
74
74
|
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
|
|
75
75
|
.overlay(
|
|
76
76
|
RoundedRectangle(cornerRadius: cornerRadius)
|
|
77
|
-
.
|
|
77
|
+
.strokeBorder(theme.colors.border.default, lineWidth: 1)
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
// Badge icons — outside clip so they are not cut by border
|
|
81
81
|
if shouldShowIconTop {
|
|
82
|
-
ImageView(LOGO_MOMO_URL)
|
|
82
|
+
ImageView(LOGO_MOMO_URL, contentMode: .fill)
|
|
83
83
|
.frame(width: badgeSizeDp, height: badgeSizeDp)
|
|
84
84
|
.clipShape(RoundedRectangle(cornerRadius: badgeCornerRadius))
|
|
85
85
|
.offset(x: 1, y: -1)
|
|
@@ -92,7 +92,7 @@ public struct Avatar: View {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
if shouldShowIconBottom {
|
|
95
|
-
ImageView(iconSupport)
|
|
95
|
+
ImageView(iconSupport, contentMode: .fill)
|
|
96
96
|
.frame(width: badgeSizeDp, height: badgeSizeDp)
|
|
97
97
|
.clipShape(RoundedRectangle(cornerRadius: badgeCornerRadius))
|
|
98
98
|
.offset(x: 1, y: 1)
|
|
@@ -107,6 +107,7 @@ public struct Avatar: View {
|
|
|
107
107
|
.frame(width: size.sizeDp, height: size.sizeDp)
|
|
108
108
|
.accessibilityElement(children: .ignore)
|
|
109
109
|
.accessibilityLabel(automationId)
|
|
110
|
+
.accessibilityIdentifier(automationId)
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
// MARK: Internal
|
package/ios/Badge/Badge.swift
CHANGED
|
@@ -33,7 +33,8 @@ public struct Badge: View {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
private func formatTitle(_ text: String) -> String {
|
|
36
|
-
|
|
36
|
+
// Digits too long for Int are well over 99.
|
|
37
|
+
if isNumber(text), (Int(text) ?? .max) > 99 {
|
|
37
38
|
return "99+"
|
|
38
39
|
}
|
|
39
40
|
return text
|
|
@@ -54,14 +55,15 @@ public struct Badge: View {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
public var body: some View {
|
|
57
|
-
MomoText(formatTitle(label), typography: .actionXxsBold, color: Colors.black01)
|
|
58
|
+
MomoText(formatTitle(label), typography: .actionXxsBold, color: Colors.black01, maxLines: 1)
|
|
58
59
|
.padding(.horizontal, Spacing.XS)
|
|
59
|
-
.frame(minWidth: fontScale(16)
|
|
60
|
+
.frame(minWidth: fontScale(16))
|
|
61
|
+
.frame(height: fontScale(16))
|
|
60
62
|
.background(badgeColor)
|
|
61
63
|
.cornerRadius(Radius.M)
|
|
62
64
|
.overlay(
|
|
63
65
|
RoundedRectangle(cornerRadius: Radius.M)
|
|
64
|
-
.
|
|
66
|
+
.strokeBorder(Colors.black01, lineWidth: 1)
|
|
65
67
|
)
|
|
66
68
|
}
|
|
67
69
|
}
|