@momo-kits/native-kits 0.300.7 → 0.300.8-beta.1-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +12 -8
- package/README.md +8 -7
- package/build.gradle.kts +13 -0
- package/compose/build.gradle.kts +195 -0
- package/compose/build.gradle.kts.backup +195 -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/KitsBinding.kt +60 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsHost.kt +32 -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 +55 -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 +212 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +422 -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 +244 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +398 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +103 -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 +387 -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 +33 -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/component/ToolkitRequests.kt +38 -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 +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/commonTest/kotlin/vn/momo/kits/application/KitsHostTest.kt +44 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +39 -0
- package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +53 -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 +31 -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 +66 -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/Application/ApplicationEnvironment.swift +6 -4
- package/ios/Application/DesignSystemKits.swift +59 -13
- package/ios/Application/DesignSystemKitsPayload.swift +0 -8
- package/ios/Application/LanguageSource.swift +2 -11
- package/ios/Application/Localize.swift +8 -35
- package/ios/Application/LocalizeModifier.swift +2 -11
- package/ios/Application/MaxApi.swift +3 -11
- package/ios/Avatar/Avatar.swift +0 -1
- package/ios/Badge/Badge.swift +5 -8
- package/ios/Badge/BadgeRibbon.swift +2 -5
- package/ios/Button/Button.swift +4 -8
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +5 -7
- package/ios/Carousel/Carousel.swift +4 -17
- package/ios/Checkbox/Checkbox.swift +0 -2
- package/ios/Collapse/Collapse.swift +17 -11
- package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
- package/ios/DateTimePicker/DateTimePicker.swift +4 -10
- package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
- package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
- package/ios/DateTimePicker/WheelPicker.swift +2 -4
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
- package/ios/Extensions/Color++.swift +2 -4
- package/ios/Extensions/SkeletonUICompat.swift +0 -8
- package/ios/Icon/Icon.swift +3 -6
- package/ios/IconButton/IconButton.swift +2 -5
- package/ios/Input/ErrorView.swift +0 -7
- package/ios/Input/Input.swift +9 -20
- package/ios/Input/InputPhoneNumber.swift +37 -20
- package/ios/Input/InputSearch.swift +23 -12
- package/ios/Input/InputTextArea.swift +4 -13
- package/ios/InputDropDown/InputDropDown.swift +1 -11
- package/ios/InputMoney/InputMoney.swift +9 -28
- package/ios/InputOTP/InputOTP.swift +2 -9
- package/ios/Layout/HeaderLayout.swift +72 -0
- package/ios/Layout/Item.swift +1 -2
- package/ios/Layout/ModalLayout.swift +144 -0
- package/ios/Layout/ScreenLayout.swift +48 -31
- package/ios/Layout/Section.swift +2 -3
- package/ios/Loader/Loader.swift +3 -12
- package/ios/Lottie/LottieView.swift +0 -11
- package/ios/Navigation/BottomSheet.swift +73 -94
- package/ios/Navigation/BottomTab/BottomTab.swift +58 -73
- package/ios/Navigation/BottomTab/BottomTabBar.swift +286 -121
- package/ios/Navigation/BottomTab/CurvedContainer.swift +52 -54
- package/ios/Navigation/BottomTab/DuoBarCompression.swift +5 -12
- package/ios/Navigation/BottomTab/DuoTabBar.swift +67 -202
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +97 -0
- package/ios/Navigation/Component/FloatingButton.swift +4 -11
- package/ios/Navigation/Component/Header.swift +35 -54
- package/ios/Navigation/Component/HeaderBackground.swift +2 -8
- package/ios/Navigation/Component/HeaderJourney.swift +4 -8
- package/ios/Navigation/Component/HeaderLocation.swift +4 -8
- package/ios/Navigation/Component/HeaderRight.swift +20 -22
- package/ios/Navigation/Component/HeaderTitle.swift +1 -6
- package/ios/Navigation/Component/HeaderUser.swift +4 -10
- package/ios/Navigation/Component/SideBar.swift +6 -21
- package/ios/Navigation/Component/SnackBar.swift +9 -13
- package/ios/Navigation/HostBackGestureBridge.swift +2 -9
- package/ios/Navigation/ModalScreen.swift +24 -13
- package/ios/Navigation/Navigation.swift +35 -19
- package/ios/Navigation/NavigationContainer.swift +4 -15
- package/ios/Navigation/Navigator.swift +21 -39
- package/ios/Navigation/StackScreen.swift +64 -51
- package/ios/Navigation/StackTransition.swift +7 -14
- package/ios/Navigation/SwipeBackHaptic.swift +2 -7
- package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
- package/ios/Pagination/PaginationDot.swift +0 -9
- package/ios/Pagination/PaginationNumber.swift +1 -9
- package/ios/Pagination/PaginationScroll.swift +2 -14
- package/ios/Pagination/PaginationWhiteDot.swift +1 -10
- package/ios/Popup/PopupDisplay.swift +7 -5
- package/ios/Popup/PopupInput.swift +6 -4
- package/ios/Popup/PopupLayout.swift +17 -9
- package/ios/Popup/PopupNotify.swift +32 -25
- package/ios/PopupView/FullscreenPopup.swift +3 -4
- package/ios/PopupView/PopupView.swift +2 -2
- package/ios/PopupView/Utils++.swift +1 -2
- package/ios/ProgressInfo/ProgressInfo.swift +2 -13
- package/ios/Skeleton/Skeleton.swift +5 -16
- package/ios/Slider/Slider.swift +5 -12
- package/ios/StatusBarTap/StatusBarTap.h +2 -3
- package/ios/StatusBarTap/StatusBarTap.m +3 -16
- package/ios/Stepper/Stepper.swift +8 -27
- package/ios/Steps/Steps.swift +29 -26
- package/ios/Swipeable/SwipeCell.swift +2 -2
- package/ios/Swipeable/SwipeCellModel.swift +3 -6
- package/ios/TabView/TabView.swift +14 -28
- package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
- package/ios/Title/Title.swift +1 -3
- package/ios/Tooltip/Tooltip.swift +4 -9
- package/ios/Typography/FontScale.swift +79 -24
- package/ios/Typography/Text.swift +6 -12
- package/ios/Typography/Typography.swift +8 -11
- package/ios/Uploader/Uploader.swift +2 -17
- package/ios-demo/README.md +120 -0
- package/ios-demo/Resources/tabbar_scan_qr_button.json +1 -0
- package/ios-demo/Resources/tabbar_scan_qr_label.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +11 -2
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +296 -59
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +15 -4
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +114 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +29 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +16 -0
- package/package.json +1 -1
- package/publish.sh +8 -2
- package/scripts/ci/build-swiftui.sh +22 -0
- package/scripts/ci/resolve-version.mjs +144 -0
- package/settings.gradle.kts +63 -0
package/CLAUDE.md
CHANGED
|
@@ -42,19 +42,19 @@ xcodebuild -project sample/iosApp/Pods/Pods.xcodeproj -scheme MoMoUIKits -sdk ip
|
|
|
42
42
|
-destination 'generic/platform=iOS Simulator' build
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Publishing is automated (`publish.sh` +
|
|
45
|
+
Publishing is automated (`.gitlab-ci.yml` → `publish.sh`; see `PUBLISH_GUIDE.md`): `main` → npm latest + 1 patch (tag `latest`; a manual run with `RELEASE_VERSION` sets the sprint version), other branches on `[ci build]` → `<npm latest + 1 patch>-beta.N`. The version is never stored in the repo — `scripts/ci/resolve-version.mjs` bases it on npm and only takes a number free on **both** npm (incl. `-debug`) and GitLab Maven. Locally, `bash publish.sh local` publishes a beta of the working tree as is (uncommitted changes too, any branch; same beta numbering); `release` is CI-only. Do not publish unless asked; `bash publish.sh local --dry-run` shows the version and packs the tarballs without uploading.
|
|
46
46
|
|
|
47
47
|
## Architecture essentials
|
|
48
48
|
|
|
49
49
|
- **Entry point:** wrap content in `NavigationContainer(...)` from `navigation/`. It builds the `Navigator`, takes a host-supplied `Localize` (falls back to an empty one), and provides the CompositionLocals below. The legacy `Screen` / `ApplicationContainer` / `ComposeApi` stack has been removed on both sides — don't reintroduce it.
|
|
50
|
-
- **Configuration flows via CompositionLocals**, not params. Public ones: `AppTheme`, `AppStatusBar`, `AppNavigationBar` (`const/Theme.kt`); `ApplicationContext`, `AppConfig`, `AppLanguage`, `LocalLocalize` (`application/`); `LocalNavigator`, `
|
|
50
|
+
- **Configuration flows via CompositionLocals**, not params. Public ones: `AppTheme`, `AppStatusBar`, `AppNavigationBar` (`const/Theme.kt`); `ApplicationContext`, `AppConfig`, `AppLanguage`, `LocalLocalize` (`application/`); `LocalNavigator`, `LocalKitsBinding` (`navigation/`). Read with `X.current`.
|
|
51
51
|
- **`DesignSystemKits`** (`application/DesignSystemKits.kt`) is the single app-wide holder for the host-owned design-system inputs: font scale (`userScaleRate` / `useOSScaleRate`), whitelist (`isWhiteList`) and the remote `DesignSystemConfig`, bundled as `DesignSystemKitsConfigs`. The host calls `DesignSystemKits.init(source)` once at startup with its `DesignSystemKitsSource` (sync `getConfigs()` seed + `configsFlow`); `init` is idempotent. Without a source, call `setConfigs(...)` directly. Read with `getConfigs()` (snapshot state, recomposes); non-Compose observers use `configsFlow`.
|
|
52
52
|
- **SwiftUI twin:** `ios/Application/DesignSystemKits.swift` mirrors it field for field (`DesignSystemKitsConfigs` with `designSystemConfig: KitConfig?`, `setConfigs` / `getConfigs`), plus the OS Dynamic Type factor (`osFontScale`). There is no `init(source:)` (Swift reserves `init`): the host observes its own bridge and pushes. A host that can't share Swift types (the KMP bridge) calls `DesignSystemKits.shared.setConfigs(json:)` (`ios/Application/DesignSystemKitsPayload.swift`); the JSON field names are a contract with momo-app's serializer (`HostDesignSystemKits.observeConfigsJson`, payload classes in `DesignSystemData.kt`) — change both together. Invalid JSON is ignored. The SwiftUI kit can't link the Kotlin `kits` framework (a second Kotlin/Native runtime would hold a second, never-initialized singleton), so the render-time logic — `FontScale` formula, Dynamic Type observation — is intentionally duplicated in Swift; only values flow across.
|
|
53
53
|
- **Design-system config** (`trustBanner`, `headerBar`, `headerGradient`): `NavigationContainer` provides it as `LocalDesignSystemConfig` (param `designSystemConfig` → parent → `DesignSystemKits`) and applies `headerBar` as the header image when the theme has none.
|
|
54
54
|
- **Platform code** goes through `expect`/`actual` in `platform/` — never reference Android/iOS APIs from `commonMain` directly.
|
|
55
|
-
- **
|
|
55
|
+
- **Host bridge:** `KitsBinding` (`application/KitsBinding.kt`, exposed as `LocalKitsBinding`) lists the only host services the kit calls; the host adapts its MaxApi to it. The kit must not depend on NativeMaxApi, common-model or foundation-model — add a binding method with kit-owned types instead. Callbacks fire on success only; pending `KitsRequest`s are cancelled when their composition is disposed. Containers borrow the binding and must not close it.
|
|
56
56
|
- Navigation uses a runtime `DynamicScreenRegistry`; overlays (modal/bottom-sheet/snackbar) go through `Navigator` + `OverplayComponentRegistry`.
|
|
57
|
-
- **iOS swipe-back:** the host owns the only edge-pan recogniser and replays it through `HostBackGestureBridge` (`navigation/HostBackGestureBridge.kt`; the kit framework is never exported, so the host reaches it through its own Koin-provided facade): `checkCanPop` / `canPopInner` / `pop` route the back into the kit stack, `started` / `progressed` / `completed` / `cancelled` seek the NavHost transition, `shouldUseFloatingArrowBack` is set by bottom tabs. `NavigationContainer` attaches itself automatically (`AttachHostBackGesture`, iOS only, detached by identity on dispose) — hosts need no wrapper and no `setNavigator`. `
|
|
57
|
+
- **iOS swipe-back:** the host owns the only edge-pan recogniser and replays it through `HostBackGestureBridge` (`navigation/HostBackGestureBridge.kt`; the kit framework is never exported, so the host reaches it through its own Koin-provided facade): `checkCanPop` / `canPopInner` / `pop` route the back into the kit stack, `started` / `progressed` / `completed` / `cancelled` seek the NavHost transition, `shouldUseFloatingArrowBack` is set by bottom tabs. `NavigationContainer` attaches itself automatically (`AttachHostBackGesture`, iOS only, detached by identity on dispose) — hosts need no wrapper and no `setNavigator`. `binding` is optional: a container uses the one passed in, then the enclosing container's, then `KitsHost.binding` — the host installs it once with `KitsHost.install`, and packages that only render kit screens pass none (before an install it does nothing).
|
|
58
58
|
|
|
59
59
|
## SwiftUI kit (`ios/`)
|
|
60
60
|
|
|
@@ -71,17 +71,20 @@ Publishing is automated (`publish.sh` + GitLab CI on `[ci build]` / `main`). Do
|
|
|
71
71
|
## Screen layout / iPhone Duo (port of RN `useScreenLayout`, momo-kits !664)
|
|
72
72
|
|
|
73
73
|
- `layout/ScreenLayout.kt`: `getScreenLayout()` returns window size, raw top/bottom + side insets, `contentWidth`, header geometry, the iPhone Duo `sideBar` and `duoTopInset`. `NavigationContainer` computes it once and provides `LocalScreenLayout`; reactive to fold/unfold and rotation (window size + `WindowInsets`). Metrics (`DuoMetrics`, 72pt iPhone header floor, 20pt status-bar threshold) mirror RN `Layout/utils.ts` — change both together.
|
|
74
|
-
- iPhone-only: everything gates on `isPhoneIdiom()` (`platform/`), never on "iOS", so iPad windows keep the regular layout. Two detectors, as in RN: `isIPhoneDuo` (window aspect < 1.6 or asymmetric side insets) drives layout; `isIPhoneDuoDevice` (Apple's foldable check: a `.division` reserved region, queried with include-inactive; Swift also latches on `UIHingeInteraction
|
|
74
|
+
- iPhone-only: everything gates on `isPhoneIdiom()` (`platform/`), never on "iOS", so iPad windows keep the regular layout. Two detectors, as in RN: `isIPhoneDuo` (window aspect < 1.6 or asymmetric side insets) drives layout; `isIPhoneDuoDevice` (Apple's foldable check: a `.division` reserved region, queried with include-inactive; Swift also latches on `UIHingeInteraction`; or asymmetric side insets, since the outer display reports no hinge) drives popups, modal and bottom sheet.
|
|
75
75
|
- Header height is `headerHeight` (not `AppStatusBar + HEADER_HEIGHT`); the bar row is `headerBarHeight` and starts `headerStatusBarHeight` below the window top. When the status bar is off the top edge (iPhone landscape, iPhone Duo) `headerStatusBarHeight` is 0 so the title stays centered — except on the Duo outer display: in portrait the header is 76pt and the row starts at 14pt so the title centers on the camera punchout; in landscape the row centers on the camera when it sits at the top end of the strip (else on the back button) and the header reaches 8pt below the back button.
|
|
76
76
|
- iPhone Duo inner display in portrait (status bar on top): the header row shares the status bar band — `headerHeight` 94pt (2 × the clock digits' y 47), `headerStatusBarHeight` 0 — and `ScreenLayout.statusBarClearance` keeps it between the clock / battery clusters (from reserved regions, else 128pt on the right). Back and toolkit use the 48pt side bar controls laid out horizontally (`ToolkitLayout.SideBarRow`); the collapsed search and a centered title stay clear of the clusters. Port of momo-kits `90af33ba2`.
|
|
77
77
|
- iPhone Duo with a side strip ≥ 60pt: back + toolkit leave the bar for `HeaderSideBar` (`navigation/component/SideBar.kt`, 48pt glass controls); custom header-right stays in the bar. `sideBar.top` is 170pt in portrait, 120pt on the inner display in landscape (height ≥ 600), 24pt on the outer display in landscape, or below the header when the status bar is on top; UIKit's `statusBarFrame` is useless on Duo. Unlike RN the column is clamped above footer (24pt gap) / rail (12pt gap).
|
|
78
78
|
- Reserved regions (iOS 27.1 `reservedRegionsOfKind:`, reached through the ObjC runtime so older SDKs still build): a probe `UIView` (`platform/ReservedRegions.ios.kt` on the Compose root view; `ReservedRegionsProbe` inside SwiftUI `momoScreenLayout()`) re-reads them in `layoutSubviews`, which UIKit re-runs when they change. They push `sideBar.top` below the status cluster as it grows for calls / Live Activities, and `sideBar.bottom` (≥ 24pt) above a camera at the bottom end of the strip.
|
|
79
79
|
- Tab bar on Duo is `bottomtab/DuoTabBar.kt`: a rail in the side strip (`sideBar.bottom` above the window bottom, QR below it) or, without a side bar, a floating bar spanning 6/8 grid columns. Both overlay the content; `duoFloatingTabBarInset` pads tab content, footer and FAB.
|
|
80
|
+
- Duo tab selection motion (`bottomtab/DuoLiquidSelection.kt` / `ios/Navigation/BottomTab/DuoLiquidSelection.swift`, port of RN `useLiquidSelection.ts`, momo-kits !682): press lifts the lens, a drag past 10pt takes over (Compose: the bar's `pointerInput` consumes and so cancels the tab's clickable; SwiftUI: one `DragGesture` over the bar, tabs are not `Button`s), long press calls `BottomTab(onTabLongPress)` and release still selects, Reduce Motion (`platform/ReduceMotion`) falls back to a plain slide. SwiftUI integrates the lens spring on a display link because the stretch and the tabs' active tint read it every frame. Constants mirror RN — change both together.
|
|
80
81
|
- Bar compression (`bottomtab/DuoBarCompression.kt`, HIG "Vertical controls"): when toolbar + rail don't fit in the strip, one is compressed — the toolkit into a `navigation_menu` button, the rail into one button showing the current tab — and tapping it swaps them; `BottomTab(compressionBehavior)` picks which starts compressed. If neither fits beside the other compressed, both rest compressed and a tap opens one for a moment. Side bar columns report their full height (0 when the screen puts nothing there) so the decision follows each screen's toolkit.
|
|
81
82
|
- Glass header: on Duo with a side bar, Default/Extended headers without search and with a `ScrollState` let content scroll under the bar (`usesDuoGlassHeader`); the bar fades in a translucent surface + hairline over 16pt (Compose has no backdrop blur — RN's fallback look), the gradient leaves with the content.
|
|
82
83
|
- Quick return header: glass headers and Animated headers (with a `ScrollState`) on the Duo side bar layout slide out with the content and back in on a reverse scroll; a half-shown header settles in or out once the scroll stops. The side bar is drawn apart from the header, so it stays put.
|
|
83
|
-
- Overlays on
|
|
84
|
+
- Overlays on foldables (`layout/ModalLayout.kt` / `ios/Layout/ModalLayout.swift`, Figma "Modal - Foldable Guideline", constants shared with RN): foldable = `isIPhoneDuoDevice` or a window short side ≥ 600, so phones (landscape too) keep their look. The resolver returns the placement (safe area, so left of the Duo control column; right of an active vertical division when a Duo is half folded — Swift also needs `UIHingeInteraction` `.partiallyOpen`; Android half fold stays flat), popup geometry (width clamp(placement − 2·margin, 280, 450), margin 24 or 12 on the Duo outer display / half fold, max height min(600, placement − 48), radius 24; only the PopupNotify description scrolls) and sheet geometry (width min(placement − 24, 653) ≥ 296, bottom anchored, max height window − top inset − 12, min height 230, radius 24 top). Scrim is black 20% over the whole window on foldables (0.6 on phones). Snackbars keep clear of the strip. On every device (RN parity) popup close and sheet header back / close are `ModalIconButton`: 32pt circle on `background.surface` with a 1pt `border.default` stroke, 20pt `text.default` icon; the popup close sits inside the card 12pt from the top right (`PopupPromotion` keeps its close under the image), the default sheet header is 56 tall, 12 padding, 8 gap.
|
|
85
|
+
- Bottom sheet on Duo: stays in the placement, never on or under the side strip; back / close stay in the header row (no side column). `BottomHeader.Title(onBack)` / `.title(onBack:)` closes the sheet, then runs (RN `leftOptions.onPressIconLeft`).
|
|
84
86
|
- Font scale deliberately uses the short side (`min(w, h)`), unlike RN which reads the window width — landscape must not inflate every font.
|
|
87
|
+
- Font scale measures the **window**, never `UIScreen.main`: on iPhone Duo the main screen stays on one display while the window follows the one in use. Compose iOS `getScreenDimensions()` reads `LocalWindowInfo.containerSize` (recomposes on fold/unfold); SwiftUI `DesignSystemKits` KVO-observes each `UIWindowScene.effectiveGeometry` and republishes `windowShortSide`.
|
|
85
88
|
- `StackScreen` pads content/footer/search/FAB by the side insets and provides an inset-consumed layout to its content; a bottom-tab root stays full width (tab bar + each tab's StackScreen handle insets). Grid columns use `contentWidth`.
|
|
86
89
|
|
|
87
90
|
## i18n / Localize (port of RN `Localize`)
|
|
@@ -104,12 +107,13 @@ The SwiftUI port differs from Compose in one important way: **it follows the hos
|
|
|
104
107
|
|
|
105
108
|
## Font scale (`scaleSize`)
|
|
106
109
|
|
|
107
|
-
One formula, both platforms: the device-width scale (`width / 375`, capped at `+5pt`) and the OS Dynamic Type scale (capped at `1.5×`) are computed independently and the **larger wins**. When `useOSScaleRate` is false neither applies — the size is just multiplied by `userScaleRate`.
|
|
110
|
+
One formula, both platforms: the device-width scale (`width / 375`, capped at `+5pt`) and the OS Dynamic Type scale (capped at `1.5×`) are computed independently and the **larger wins**. When `useOSScaleRate` is false neither applies — the size is just multiplied by `userScaleRate`. The OS scale is capped at 1.5 by default; `MiniAppContext.scaleSizeMaxRate` (both sides) or `ScaleSizeScope(rate)` (Compose; SwiftUI also `.scaleSizeMaxRate(_:)`) caps a subtree at size × rate on both paths, nearest scope wins, null/nil lifts it (RN `ScaleSizeProvider`). The `ScaleSizeMaxRate` CompositionLocal is deprecated and not read.
|
|
108
111
|
|
|
109
112
|
- **Compose** — `const/Typography.kt` (`scaleSize` overloads for `Float`/`Dp`/`TextUnit`/`TextStyle`). The `TextUnit` overload divides by `density.fontScale` so Compose's own `sp` scaling isn't applied twice. Inputs: `LocalContext.current` (`MiniAppContext.userScaleRate` / `useOSScaleRate`, per-field) falling back to `DesignSystemKits.getConfigs()`. On iOS, `platform/OsFontScale.ios.kt` observes `UIContentSizeCategoryDidChangeNotification` and overrides `LocalDensity` — Compose MP otherwise reads `fontScale` once at `ComposeUIViewController` creation. Wired at `NavigationContainer`.
|
|
110
113
|
- **SwiftUI** — `ios/Typography/FontScale.swift`. `FontScale` is an immutable snapshot with `callAsFunction`, so a view reads `@Environment(\.momoFontScale) private var fontScale` and calls `fontScale(16)`. `DesignSystemKits.shared` is the `ObservableObject` holding the host inputs and the OS factor (it observes `UIContentSizeCategory.didChangeNotification`); the host pushes them with `setConfigs(_:)`.
|
|
111
114
|
- **Never set `\.momoFontScale` directly** — same trap as `\.localize`. Inject via `.momoFontScale(_:context:)`, which holds `DesignSystemKits` as `@ObservedObject`; that is what re-publishes the snapshot. It also injects `\.designSystemKitsConfigs`, which `MomoText` (whitelist font) and `TrustBanner` (fallback after `ApplicationEnvironment.config`) read so a host push re-renders them. `NavigationContainer` does it (passing `MiniAppContext` so the per-mini-app override applies); a bare `UIHostingController` root must too. The environment default reads the live store, so an un-injected subtree still gets correct values — just not live ones.
|
|
112
115
|
- The global `scaleSize(_:)` and `Font.appFont(size:)` remain for call sites that can't read the environment (UIKit bridges, free functions). They are **not** reactive. `Font.header_default_bold` & friends are computed `static var`s for the same reason — as stored `static let`s they froze the scale at first access. `UIViewRepresentable`s should read `context.environment.momoFontScale` instead, and re-apply the font in `updateUIView`, not only in `makeUIView`.
|
|
116
|
+
- **Bottom tab bar** — `BottomTab` caps the whole bar once at its root at `TabBarMetrics.LABEL_MAX_SCALE` / `labelMaxScale` (1.2, RN wraps `renderTabBar` in `ScaleSizeProvider`), so labels fit the fixed-height slots and the notch; the tab badge nests a scope of 1 to keep its design size. Consumer `iconContent` / `labelContent` sit under the same cap.
|
|
113
117
|
|
|
114
118
|
## Code conventions
|
|
115
119
|
|
|
@@ -132,7 +136,7 @@ Prefer one tight line at the surprising spot over a paragraph. Match the (low) c
|
|
|
132
136
|
## Gotchas
|
|
133
137
|
|
|
134
138
|
- **Resource qualifier drift:** the generated Compose `Res` namespace is `vn.momo.uikits.resources`, but `utils/Resources.kt` and `platform/Platform.ios.kt` reference `vn.momo.compose.resources`. Keep bundled strings/dictionaries as plain Kotlin (the `defaultLanguage` map in `Localize.kt`), not `composeResources/values`, to avoid iOS framework resource-loading issues.
|
|
135
|
-
- `LiteScreen` keeps its own `application.HeaderType` enum (`DEFAULT`/`EXTENDED`/`NONE`), unrelated to the sealed `navigation.component.HeaderType`; its toolkit is the navigation `Toolkit` (through `
|
|
139
|
+
- `LiteScreen` keeps its own `application.HeaderType` enum (`DEFAULT`/`EXTENDED`/`NONE`), unrelated to the sealed `navigation.component.HeaderType`; its toolkit is the navigation `Toolkit` (through `LocalKitsBinding`).
|
|
136
140
|
- iOS strings/maps must survive Kotlin/Native framework packaging — keep them compiled-in, not loaded from resource bundles.
|
|
137
141
|
|
|
138
142
|
## Code comments
|
package/README.md
CHANGED
|
@@ -114,7 +114,6 @@ NavigationContainer(
|
|
|
114
114
|
options = NavigationOptions(headerTitle = HeaderTitle.Default("Home")),
|
|
115
115
|
applicationContext = miniAppContext,
|
|
116
116
|
config = KitConfig(trustBanner = defaultBanner),
|
|
117
|
-
maxApi = maxApi, // IMaxApi implementation từ host
|
|
118
117
|
setNavigator = { navigator = it }
|
|
119
118
|
)
|
|
120
119
|
```
|
|
@@ -175,11 +174,13 @@ fun SuccessState() {
|
|
|
175
174
|
|
|
176
175
|
- `shared/build.gradle.kts` đã bật `coreLibraryDesugaringEnabled` để tương thích `compottie-dot`/`compottie-network` với `minSdk = 24`.
|
|
177
176
|
- Nếu animation dùng asset/font nội bộ, kết hợp `compottie-resources` (`rememberResourcesAssetsManager`, `rememberResourcesFontManager`) để trỏ về `composeResources`.
|
|
178
|
-
###
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
### KitsBinding (host bridge)
|
|
178
|
+
|
|
179
|
+
Kits không phụ thuộc NativeMaxApi hay model của host. Host cài `KitsBinding` một lần bằng
|
|
180
|
+
`KitsHost.install(binding)` (`vn.momo.kits.application`); `NavigationContainer` / `WidgetContainer`
|
|
181
|
+
dùng binding truyền vào, rồi của container bao ngoài, rồi `KitsHost.binding` (chưa cài thì không làm gì),
|
|
182
|
+
nên package chỉ dùng kits không cần binding riêng. Host tự chuyển sang bridge của mình (MaxApi): dismiss, trackEvent, getLanguage, haptic, toolkit (favorite,
|
|
183
|
+
`showToolkit(tools, useSystemTools)` trả `actionKey`), Help Center và log lỗi. Callback chỉ gọi khi
|
|
184
|
+
thành công; request đang chờ (`KitsRequest`) được hủy khi composition bị gỡ. Kits không đóng binding.
|
|
184
185
|
|
|
185
186
|
Chạy `./gradlew :compose:testAndroidHostTest` để kiểm tra hủy request và callback đến muộn.
|
package/build.gradle.kts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
// AI-GENERATED START: use the AGP 9 Kotlin Multiplatform Android library target
|
|
6
|
+
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
|
|
7
|
+
// AI-GENERATED END: use the AGP 9 Kotlin Multiplatform Android library target
|
|
8
|
+
alias(libs.plugins.compose) apply false
|
|
9
|
+
alias(libs.plugins.kotlin.compose.compiler) apply false
|
|
10
|
+
alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
|
|
11
|
+
alias(libs.plugins.jetbrains.kotlin.serialization) apply false
|
|
12
|
+
alias(libs.plugins.vanniktech.mavenPublish) apply false
|
|
13
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// import com.vanniktech.maven.publish.JavadocJar
|
|
2
|
+
// import com.vanniktech.maven.publish.KotlinMultiplatform
|
|
3
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
4
|
+
|
|
5
|
+
plugins {
|
|
6
|
+
alias(libs.plugins.jetbrains.kotlin.multiplatform)
|
|
7
|
+
// AI-GENERATED START: use the AGP 9 Kotlin Multiplatform Android library target
|
|
8
|
+
alias(libs.plugins.android.kotlin.multiplatform.library)
|
|
9
|
+
// AI-GENERATED END: use the AGP 9 Kotlin Multiplatform Android library target
|
|
10
|
+
alias(libs.plugins.compose)
|
|
11
|
+
alias(libs.plugins.kotlin.compose.compiler)
|
|
12
|
+
// alias(libs.plugins.vanniktech.mavenPublish)
|
|
13
|
+
id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
|
|
14
|
+
kotlin("plugin.serialization")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
val gitlabName: String = findProperty("name") as String? ?: ""
|
|
18
|
+
val gitlabRepo: String = findProperty("repo") as String? ?: ""
|
|
19
|
+
val gitlabUrl: String = findProperty("url") as String? ?: ""
|
|
20
|
+
val gitlabGroup: String = findProperty("group") as String? ?: ""
|
|
21
|
+
val gitlabArtifactId: String = findProperty("artifact.id") as String? ?: ""
|
|
22
|
+
val gitlabVersion: String = findProperty("version") as String? ?: ""
|
|
23
|
+
val gitlabUser: String = findProperty("gitlab.user") as String? ?: ""
|
|
24
|
+
val gitlabKey: String = findProperty("gitlab.password") as String? ?: ""
|
|
25
|
+
|
|
26
|
+
kotlin {
|
|
27
|
+
// AI-GENERATED START: configure the AGP 9 Android target and host tests
|
|
28
|
+
android {
|
|
29
|
+
namespace = "vn.momo.kits.kits"
|
|
30
|
+
compileSdk = 36
|
|
31
|
+
minSdk = 24
|
|
32
|
+
androidResources.enable = true
|
|
33
|
+
withHostTest {}
|
|
34
|
+
compilerOptions {
|
|
35
|
+
jvmTarget.set(JvmTarget.JVM_17)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// AI-GENERATED END: configure the AGP 9 Android target and host tests
|
|
39
|
+
|
|
40
|
+
val fwName = gitlabArtifactId
|
|
41
|
+
val iosTargets = listOf(iosArm64(), iosSimulatorArm64())
|
|
42
|
+
iosTargets.forEach {
|
|
43
|
+
it.binaries.framework {
|
|
44
|
+
baseName = fwName
|
|
45
|
+
binaryOption("bundleId", "$gitlabGroup.$fwName")
|
|
46
|
+
isStatic = true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
cocoapods {
|
|
51
|
+
version = "0.300.8-beta.1-debug"
|
|
52
|
+
summary = "IOS Shared module"
|
|
53
|
+
homepage = "https://momo.vn"
|
|
54
|
+
ios.deploymentTarget = "15.0"
|
|
55
|
+
|
|
56
|
+
framework {
|
|
57
|
+
baseName = fwName
|
|
58
|
+
isStatic = true
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
pod("lottie-ios") {
|
|
62
|
+
moduleName = "Lottie"
|
|
63
|
+
version = "4.4.3"
|
|
64
|
+
extraOpts += listOf("-compiler-option", "-fmodules")
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
sourceSets {
|
|
69
|
+
all {
|
|
70
|
+
languageSettings.optIn("vn.momo.kits.modifier.InternalApi")
|
|
71
|
+
}
|
|
72
|
+
commonMain.dependencies {
|
|
73
|
+
implementation(compose.runtime)
|
|
74
|
+
implementation(compose.material)
|
|
75
|
+
implementation(compose.material3)
|
|
76
|
+
implementation(compose.components.resources)
|
|
77
|
+
implementation(libs.compose.ui.backhandler)
|
|
78
|
+
implementation(libs.ktor.client.core)
|
|
79
|
+
implementation(libs.jetbrains.coroutines.core)
|
|
80
|
+
implementation(libs.navigation.multiplatform)
|
|
81
|
+
implementation(libs.coil.multiplatform.compose)
|
|
82
|
+
implementation(libs.coil.multiplatform.core)
|
|
83
|
+
implementation(libs.coil.multiplatform.network.ktor)
|
|
84
|
+
api(libs.jetbrains.serialization.json)
|
|
85
|
+
implementation(libs.kotlinx.datetime)
|
|
86
|
+
implementation(libs.compottie)
|
|
87
|
+
implementation(libs.gif.image)
|
|
88
|
+
}
|
|
89
|
+
androidMain.dependencies {
|
|
90
|
+
implementation(libs.ktor.client.okhttp)
|
|
91
|
+
implementation(libs.airbnb.lottie)
|
|
92
|
+
}
|
|
93
|
+
iosMain.dependencies {
|
|
94
|
+
implementation(libs.ktor.client.darwin)
|
|
95
|
+
}
|
|
96
|
+
// AI-GENERATED START: verify toolkit request ownership
|
|
97
|
+
commonTest.dependencies {
|
|
98
|
+
implementation(kotlin("test"))
|
|
99
|
+
}
|
|
100
|
+
// AI-GENERATED END: verify toolkit request ownership
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
repositories {
|
|
105
|
+
google {
|
|
106
|
+
mavenContent {
|
|
107
|
+
includeGroupAndSubgroups("androidx")
|
|
108
|
+
includeGroupAndSubgroups("com.android")
|
|
109
|
+
includeGroupAndSubgroups("com.google")
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
mavenCentral()
|
|
113
|
+
maven {
|
|
114
|
+
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
115
|
+
credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
|
|
116
|
+
}
|
|
117
|
+
maven {
|
|
118
|
+
url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
|
|
119
|
+
credentials {
|
|
120
|
+
username = "viewer"
|
|
121
|
+
password = "viewer"
|
|
122
|
+
}
|
|
123
|
+
isAllowInsecureProtocol = true
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
compose {
|
|
128
|
+
resources {
|
|
129
|
+
publicResClass = true
|
|
130
|
+
packageOfResClass = "vn.momo.uikits.resources"
|
|
131
|
+
generateResClass = always
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// publishing {
|
|
136
|
+
// repositories {
|
|
137
|
+
// maven {
|
|
138
|
+
// name = "${gitlabRepo}Packages"
|
|
139
|
+
// credentials {
|
|
140
|
+
// username = gitlabUser
|
|
141
|
+
// password = gitlabKey
|
|
142
|
+
// }
|
|
143
|
+
// url = uri("$gitlabUrl")
|
|
144
|
+
// }
|
|
145
|
+
// }
|
|
146
|
+
// }
|
|
147
|
+
|
|
148
|
+
// mavenPublishing {
|
|
149
|
+
// configure(
|
|
150
|
+
// KotlinMultiplatform(
|
|
151
|
+
// javadocJar = JavadocJar.Empty(),
|
|
152
|
+
// // AI-GENERATED START: the AGP KMP target publishes a single Android variant
|
|
153
|
+
// sourcesJar = true,
|
|
154
|
+
// // AI-GENERATED END: the AGP KMP target publishes a single Android variant
|
|
155
|
+
// )
|
|
156
|
+
// )
|
|
157
|
+
//
|
|
158
|
+
// repositories {
|
|
159
|
+
// maven {
|
|
160
|
+
// name = "${gitlabRepo}Packages"
|
|
161
|
+
// credentials { username = gitlabUser; password = gitlabKey }
|
|
162
|
+
// url = uri("$gitlabUrl")
|
|
163
|
+
// }
|
|
164
|
+
// }
|
|
165
|
+
//
|
|
166
|
+
// coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
|
|
167
|
+
//
|
|
168
|
+
// pom {
|
|
169
|
+
// name = "$gitlabName Klib"
|
|
170
|
+
// description = "$gitlabName"
|
|
171
|
+
// url = "https://gitlab.mservice.com.vn"
|
|
172
|
+
// licenses {
|
|
173
|
+
// license {
|
|
174
|
+
// name = "The Apache License, Version 2.0"
|
|
175
|
+
// url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
176
|
+
// distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
177
|
+
// }
|
|
178
|
+
// }
|
|
179
|
+
// developers {
|
|
180
|
+
// developer {
|
|
181
|
+
// id = "kotlin-hands-on"
|
|
182
|
+
// name = "Kotlin Developer Advocate"
|
|
183
|
+
// url = "https://github.com/kotlin-hands-on/"
|
|
184
|
+
// }
|
|
185
|
+
// }
|
|
186
|
+
// }
|
|
187
|
+
// }
|
|
188
|
+
|
|
189
|
+
// Xcode 27 rejects iOS < 15; KGP's synthetic Podfile only raises pods to 12 (KT-57741), leaving lottie-ios at 13.
|
|
190
|
+
tasks.named("podGenIos") {
|
|
191
|
+
doLast {
|
|
192
|
+
val podfile = layout.buildDirectory.file("cocoapods/synthetic/ios/Podfile").get().asFile
|
|
193
|
+
podfile.writeText(podfile.readText().replace("major < 12 ||", "major < 15 ||").replace("#{12}", "#{15}"))
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import com.vanniktech.maven.publish.JavadocJar
|
|
2
|
+
import com.vanniktech.maven.publish.KotlinMultiplatform
|
|
3
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
4
|
+
|
|
5
|
+
plugins {
|
|
6
|
+
alias(libs.plugins.jetbrains.kotlin.multiplatform)
|
|
7
|
+
// AI-GENERATED START: use the AGP 9 Kotlin Multiplatform Android library target
|
|
8
|
+
alias(libs.plugins.android.kotlin.multiplatform.library)
|
|
9
|
+
// AI-GENERATED END: use the AGP 9 Kotlin Multiplatform Android library target
|
|
10
|
+
alias(libs.plugins.compose)
|
|
11
|
+
alias(libs.plugins.kotlin.compose.compiler)
|
|
12
|
+
alias(libs.plugins.vanniktech.mavenPublish)
|
|
13
|
+
id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
|
|
14
|
+
kotlin("plugin.serialization")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
val gitlabName: String = findProperty("name") as String? ?: ""
|
|
18
|
+
val gitlabRepo: String = findProperty("repo") as String? ?: ""
|
|
19
|
+
val gitlabUrl: String = findProperty("url") as String? ?: ""
|
|
20
|
+
val gitlabGroup: String = findProperty("group") as String? ?: ""
|
|
21
|
+
val gitlabArtifactId: String = findProperty("artifact.id") as String? ?: ""
|
|
22
|
+
val gitlabVersion: String = findProperty("version") as String? ?: ""
|
|
23
|
+
val gitlabUser: String = findProperty("gitlab.user") as String? ?: ""
|
|
24
|
+
val gitlabKey: String = findProperty("gitlab.password") as String? ?: ""
|
|
25
|
+
|
|
26
|
+
kotlin {
|
|
27
|
+
// AI-GENERATED START: configure the AGP 9 Android target and host tests
|
|
28
|
+
android {
|
|
29
|
+
namespace = "$gitlabGroup.$gitlabArtifactId"
|
|
30
|
+
compileSdk = libs.versions.android.compileSdk.get().toInt()
|
|
31
|
+
minSdk = libs.versions.android.minSdk.get().toInt()
|
|
32
|
+
androidResources.enable = true
|
|
33
|
+
withHostTest {}
|
|
34
|
+
compilerOptions {
|
|
35
|
+
jvmTarget.set(JvmTarget.JVM_17)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// AI-GENERATED END: configure the AGP 9 Android target and host tests
|
|
39
|
+
|
|
40
|
+
val fwName = gitlabArtifactId
|
|
41
|
+
val iosTargets = listOf(iosArm64(), iosSimulatorArm64())
|
|
42
|
+
iosTargets.forEach {
|
|
43
|
+
it.binaries.framework {
|
|
44
|
+
baseName = fwName
|
|
45
|
+
binaryOption("bundleId", "$gitlabGroup.$fwName")
|
|
46
|
+
isStatic = true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
cocoapods {
|
|
51
|
+
version = gitlabVersion
|
|
52
|
+
summary = "IOS Shared module"
|
|
53
|
+
homepage = "https://momo.vn"
|
|
54
|
+
ios.deploymentTarget = "15.0"
|
|
55
|
+
|
|
56
|
+
framework {
|
|
57
|
+
baseName = fwName
|
|
58
|
+
isStatic = true
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
pod("lottie-ios") {
|
|
62
|
+
moduleName = "Lottie"
|
|
63
|
+
version = "4.4.3"
|
|
64
|
+
extraOpts += listOf("-compiler-option", "-fmodules")
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
sourceSets {
|
|
69
|
+
all {
|
|
70
|
+
languageSettings.optIn("vn.momo.kits.modifier.InternalApi")
|
|
71
|
+
}
|
|
72
|
+
commonMain.dependencies {
|
|
73
|
+
implementation(compose.runtime)
|
|
74
|
+
implementation(compose.material)
|
|
75
|
+
implementation(compose.material3)
|
|
76
|
+
implementation(compose.components.resources)
|
|
77
|
+
implementation(libs.compose.ui.backhandler)
|
|
78
|
+
implementation(libs.ktor.client.core)
|
|
79
|
+
implementation(libs.jetbrains.coroutines.core)
|
|
80
|
+
implementation(libs.navigation.multiplatform)
|
|
81
|
+
implementation(libs.coil.multiplatform.compose)
|
|
82
|
+
implementation(libs.coil.multiplatform.core)
|
|
83
|
+
implementation(libs.coil.multiplatform.network.ktor)
|
|
84
|
+
api(libs.jetbrains.serialization.json)
|
|
85
|
+
implementation(libs.kotlinx.datetime)
|
|
86
|
+
implementation(libs.compottie)
|
|
87
|
+
implementation(libs.gif.image)
|
|
88
|
+
}
|
|
89
|
+
androidMain.dependencies {
|
|
90
|
+
implementation(libs.ktor.client.okhttp)
|
|
91
|
+
implementation(libs.airbnb.lottie)
|
|
92
|
+
}
|
|
93
|
+
iosMain.dependencies {
|
|
94
|
+
implementation(libs.ktor.client.darwin)
|
|
95
|
+
}
|
|
96
|
+
// AI-GENERATED START: verify toolkit request ownership
|
|
97
|
+
commonTest.dependencies {
|
|
98
|
+
implementation(kotlin("test"))
|
|
99
|
+
}
|
|
100
|
+
// AI-GENERATED END: verify toolkit request ownership
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
repositories {
|
|
105
|
+
google {
|
|
106
|
+
mavenContent {
|
|
107
|
+
includeGroupAndSubgroups("androidx")
|
|
108
|
+
includeGroupAndSubgroups("com.android")
|
|
109
|
+
includeGroupAndSubgroups("com.google")
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
mavenCentral()
|
|
113
|
+
maven {
|
|
114
|
+
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
115
|
+
credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
|
|
116
|
+
}
|
|
117
|
+
maven {
|
|
118
|
+
url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
|
|
119
|
+
credentials {
|
|
120
|
+
username = "viewer"
|
|
121
|
+
password = "viewer"
|
|
122
|
+
}
|
|
123
|
+
isAllowInsecureProtocol = true
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
compose {
|
|
128
|
+
resources {
|
|
129
|
+
publicResClass = true
|
|
130
|
+
packageOfResClass = "vn.momo.uikits.resources"
|
|
131
|
+
generateResClass = always
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
publishing {
|
|
136
|
+
repositories {
|
|
137
|
+
maven {
|
|
138
|
+
name = "${gitlabRepo}Packages"
|
|
139
|
+
credentials {
|
|
140
|
+
username = gitlabUser
|
|
141
|
+
password = gitlabKey
|
|
142
|
+
}
|
|
143
|
+
url = uri("$gitlabUrl")
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
mavenPublishing {
|
|
149
|
+
configure(
|
|
150
|
+
KotlinMultiplatform(
|
|
151
|
+
javadocJar = JavadocJar.Empty(),
|
|
152
|
+
// AI-GENERATED START: the AGP KMP target publishes a single Android variant
|
|
153
|
+
sourcesJar = true,
|
|
154
|
+
// AI-GENERATED END: the AGP KMP target publishes a single Android variant
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
repositories {
|
|
159
|
+
maven {
|
|
160
|
+
name = "${gitlabRepo}Packages"
|
|
161
|
+
credentials { username = gitlabUser; password = gitlabKey }
|
|
162
|
+
url = uri("$gitlabUrl")
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
|
|
167
|
+
|
|
168
|
+
pom {
|
|
169
|
+
name = "$gitlabName Klib"
|
|
170
|
+
description = "$gitlabName"
|
|
171
|
+
url = "https://gitlab.mservice.com.vn"
|
|
172
|
+
licenses {
|
|
173
|
+
license {
|
|
174
|
+
name = "The Apache License, Version 2.0"
|
|
175
|
+
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
176
|
+
distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
developers {
|
|
180
|
+
developer {
|
|
181
|
+
id = "kotlin-hands-on"
|
|
182
|
+
name = "Kotlin Developer Advocate"
|
|
183
|
+
url = "https://github.com/kotlin-hands-on/"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Xcode 27 rejects iOS < 15; KGP's synthetic Podfile only raises pods to 12 (KT-57741), leaving lottie-ios at 13.
|
|
190
|
+
tasks.named("podGenIos") {
|
|
191
|
+
doLast {
|
|
192
|
+
val podfile = layout.buildDirectory.file("cocoapods/synthetic/ios/Podfile").get().asFile
|
|
193
|
+
podfile.writeText(podfile.readText().replace("major < 12 ||", "major < 15 ||").replace("#{12}", "#{15}"))
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Pod::Spec.new do |spec|
|
|
2
|
+
spec.name = 'compose'
|
|
3
|
+
spec.version = '0.300.6-debug'
|
|
4
|
+
spec.homepage = 'https://momo.vn'
|
|
5
|
+
spec.source = { :http=> ''}
|
|
6
|
+
spec.authors = ''
|
|
7
|
+
spec.license = ''
|
|
8
|
+
spec.summary = 'IOS Shared module'
|
|
9
|
+
spec.vendored_frameworks = 'build/cocoapods/framework/kits.framework'
|
|
10
|
+
spec.libraries = 'c++'
|
|
11
|
+
spec.ios.deployment_target = '15.0'
|
|
12
|
+
spec.dependency 'lottie-ios', '4.4.3'
|
|
13
|
+
if !Dir.exist?('build/cocoapods/framework/kits.framework') || Dir.empty?('build/cocoapods/framework/kits.framework')
|
|
14
|
+
raise "
|
|
15
|
+
Kotlin framework 'kits' doesn't exist yet, so a proper Xcode project can't be generated.
|
|
16
|
+
'pod install' should be executed after running ':generateDummyFramework' Gradle task:
|
|
17
|
+
./gradlew :compose:generateDummyFramework
|
|
18
|
+
Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)"
|
|
19
|
+
end
|
|
20
|
+
spec.xcconfig = {
|
|
21
|
+
'ENABLE_USER_SCRIPT_SANDBOXING' => 'NO',
|
|
22
|
+
}
|
|
23
|
+
spec.pod_target_xcconfig = {
|
|
24
|
+
'KOTLIN_PROJECT_PATH' => ':compose',
|
|
25
|
+
'PRODUCT_MODULE_NAME' => 'kits',
|
|
26
|
+
}
|
|
27
|
+
spec.script_phases = [
|
|
28
|
+
{
|
|
29
|
+
:name => 'Build compose',
|
|
30
|
+
:execution_position => :before_compile,
|
|
31
|
+
:shell_path => '/bin/sh',
|
|
32
|
+
:script => <<-SCRIPT
|
|
33
|
+
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
|
|
34
|
+
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
|
|
35
|
+
exit 0
|
|
36
|
+
fi
|
|
37
|
+
set -ev
|
|
38
|
+
REPO_ROOT="$PODS_TARGET_SRCROOT"
|
|
39
|
+
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
|
|
40
|
+
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
|
|
41
|
+
-Pkotlin.native.cocoapods.archs="$ARCHS" \
|
|
42
|
+
-Pkotlin.native.cocoapods.configuration="$CONFIGURATION"
|
|
43
|
+
SCRIPT
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
spec.resources = ['build/compose/cocoapods/compose-resources']
|
|
47
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package vn.momo.kits.const
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.runtime.remember
|
|
5
|
+
import androidx.compose.ui.platform.LocalContext
|
|
6
|
+
import androidx.compose.ui.text.font.Font
|
|
7
|
+
import androidx.compose.ui.text.font.FontFamily
|
|
8
|
+
import androidx.compose.ui.text.font.FontWeight
|
|
9
|
+
|
|
10
|
+
@Composable
|
|
11
|
+
internal actual fun hostFontFamily(fileName: String, weight: FontWeight): FontFamily? {
|
|
12
|
+
val assets = LocalContext.current.applicationContext.assets
|
|
13
|
+
return remember(fileName, weight) {
|
|
14
|
+
val path = "fonts/$fileName"
|
|
15
|
+
// Font(path, assetManager) only fails later at render time, so check the asset exists first.
|
|
16
|
+
val exists = runCatching { assets.open(path).close() }.isSuccess
|
|
17
|
+
if (exists) FontFamily(Font(path = path, assetManager = assets, weight = weight)) else null
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.runtime.State
|
|
5
|
+
import androidx.compose.runtime.mutableStateOf
|
|
6
|
+
import androidx.compose.runtime.remember
|
|
7
|
+
|
|
8
|
+
// No passive observer at androidx.activity 1.10.x; a second callback would steal the gesture.
|
|
9
|
+
@Composable
|
|
10
|
+
actual fun rememberBackGestureProgress(): State<Float?> = remember { mutableStateOf(null) }
|
|
11
|
+
|
|
12
|
+
actual fun reportFloatingArrowBack(shouldUse: Boolean) = Unit
|