@momo-kits/native-kits 0.162.44 → 0.162.45-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 +45 -3
- package/README.md +2 -2
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +198 -0
- package/compose/build.gradle.kts.backup +198 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +19 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +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 +124 -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 +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +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 +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +18 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -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 +283 -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 +314 -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 +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +399 -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 +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +228 -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 +399 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +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/tracking/ScreenTracker.kt +127 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +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 +13 -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/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +40 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +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 +94 -0
- package/gradle/libs.versions.toml +69 -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 +17 -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 +0 -1
- 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 +160 -147
- package/ios/Input/InputPhoneNumber.swift +12 -9
- package/ios/Input/InputSearch.swift +107 -77
- package/ios/Input/InputTextArea.swift +128 -145
- package/ios/InputDropDown/InputDropDown.swift +10 -7
- package/ios/InputMoney/InputMoney.swift +33 -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 +385 -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 +140 -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 +6 -1
- 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 +106 -54
- package/ios/Title/Title.swift +6 -17
- package/ios/Tooltip/Tooltip.swift +29 -14
- package/ios/Typography/FontScale.swift +3 -3
- package/ios/Typography/Text.swift +81 -19
- package/ios/Uploader/Uploader.swift +3 -1
- package/ios/native-kits.podspec +2 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- 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/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/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.content.res.Resources
|
|
5
|
+
import android.graphics.BlurMaskFilter
|
|
6
|
+
import android.graphics.PorterDuff
|
|
7
|
+
import android.graphics.PorterDuffColorFilter
|
|
8
|
+
import android.os.Build
|
|
9
|
+
import androidx.compose.foundation.layout.Box
|
|
10
|
+
import androidx.compose.runtime.Composable
|
|
11
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
12
|
+
import androidx.compose.runtime.getValue
|
|
13
|
+
import androidx.compose.runtime.rememberUpdatedState
|
|
14
|
+
import androidx.compose.runtime.snapshotFlow
|
|
15
|
+
import androidx.compose.ui.Modifier
|
|
16
|
+
import androidx.compose.ui.graphics.Color
|
|
17
|
+
import androidx.compose.ui.graphics.NativePaint
|
|
18
|
+
import androidx.compose.ui.graphics.toArgb
|
|
19
|
+
import androidx.compose.ui.platform.LocalConfiguration
|
|
20
|
+
import androidx.compose.ui.semantics.contentDescription
|
|
21
|
+
import androidx.compose.ui.semantics.semantics
|
|
22
|
+
import androidx.compose.ui.unit.Dp
|
|
23
|
+
import androidx.compose.ui.unit.dp
|
|
24
|
+
import com.airbnb.lottie.LottieProperty
|
|
25
|
+
import com.airbnb.lottie.compose.LottieAnimation
|
|
26
|
+
import com.airbnb.lottie.compose.LottieCompositionSpec
|
|
27
|
+
import com.airbnb.lottie.compose.animateLottieCompositionAsState
|
|
28
|
+
import com.airbnb.lottie.compose.rememberLottieComposition
|
|
29
|
+
import com.airbnb.lottie.compose.rememberLottieDynamicProperties
|
|
30
|
+
import com.airbnb.lottie.compose.rememberLottieDynamicProperty
|
|
31
|
+
import vn.momo.kits.const.AppNavigationBar
|
|
32
|
+
import vn.momo.kits.const.AppStatusBar
|
|
33
|
+
import vn.momo.kits.navigation.Navigator
|
|
34
|
+
import vn.momo.kits.utils.readJson
|
|
35
|
+
import androidx.activity.compose.BackHandler as AndroidBackHandler
|
|
36
|
+
|
|
37
|
+
actual fun getPlatformName(): String = "Android"
|
|
38
|
+
|
|
39
|
+
actual fun isPhoneIdiom(): Boolean = false
|
|
40
|
+
|
|
41
|
+
@Composable
|
|
42
|
+
actual fun getScreenDimensions(): ScreenDimension {
|
|
43
|
+
val config = LocalConfiguration.current
|
|
44
|
+
return ScreenDimension(
|
|
45
|
+
config.screenWidthDp, config.screenHeightDp
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
actual fun NativePaint.setMaskFilter(blurRadius: Float) {
|
|
50
|
+
this.maskFilter = BlurMaskFilter(blurRadius, BlurMaskFilter.Blur.NORMAL)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@SuppressLint("InternalInsetResource")
|
|
54
|
+
@Composable
|
|
55
|
+
actual fun getStatusBarHeight(): Dp {
|
|
56
|
+
val resourceId = Resources.getSystem().getIdentifier(
|
|
57
|
+
"status_bar_height",
|
|
58
|
+
"dimen",
|
|
59
|
+
"android"
|
|
60
|
+
)
|
|
61
|
+
return if(resourceId > 0) Resources.getSystem().getDimensionPixelSize(resourceId).dp else 0.dp
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Composable
|
|
65
|
+
actual fun BackHandler(enabled: Boolean, onBack: () -> Unit) {
|
|
66
|
+
AndroidBackHandler(enabled = enabled, onBack = onBack)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@Composable
|
|
70
|
+
actual fun ProvideNavigationEventDispatcherOwner(navigator: Navigator, content: @Composable () -> Unit) {
|
|
71
|
+
content()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@Composable
|
|
75
|
+
actual fun getScreenHeight(): Dp {
|
|
76
|
+
return getScreenDimensions().height.dp + if (getOSVersion() >= 35) 0.dp else AppStatusBar.current + AppNavigationBar.current
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
actual fun getOSVersion(): OSVersion = OSVersion.Android(sdk = Build.VERSION.SDK_INT)
|
|
80
|
+
|
|
81
|
+
@Composable
|
|
82
|
+
actual fun LottieAnimation(
|
|
83
|
+
path: String,
|
|
84
|
+
tintColor: Color?,
|
|
85
|
+
bgColor: Color?,
|
|
86
|
+
placedAsOverlay: Boolean,
|
|
87
|
+
iterations: Int,
|
|
88
|
+
isPlaying: Boolean,
|
|
89
|
+
onEvent: ((String) -> Unit)?,
|
|
90
|
+
modifier: Modifier,
|
|
91
|
+
useCompose: Boolean
|
|
92
|
+
) {
|
|
93
|
+
if (useCompose) {
|
|
94
|
+
ComposeLottieAnimation(path, tintColor, bgColor, iterations, isPlaying, onEvent, modifier)
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
val json = readJson(path)
|
|
99
|
+
|
|
100
|
+
if (json.isEmpty()) {
|
|
101
|
+
Box(modifier)
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
val composition by rememberLottieComposition(
|
|
106
|
+
LottieCompositionSpec.JsonString(json)
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
val colorFilter = PorterDuffColorFilter(
|
|
110
|
+
tintColor?.toArgb() ?: Color.White.toArgb(),
|
|
111
|
+
PorterDuff.Mode.SRC_ATOP
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
val dynamicProperties = rememberLottieDynamicProperties(
|
|
115
|
+
rememberLottieDynamicProperty(
|
|
116
|
+
property = LottieProperty.COLOR_FILTER,
|
|
117
|
+
value = colorFilter,
|
|
118
|
+
keyPath = arrayOf("**")
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
val lottieState = animateLottieCompositionAsState(
|
|
123
|
+
composition = composition,
|
|
124
|
+
iterations = iterations,
|
|
125
|
+
isPlaying = isPlaying,
|
|
126
|
+
restartOnPlay = false,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
val currentOnEvent by rememberUpdatedState(onEvent)
|
|
130
|
+
|
|
131
|
+
LaunchedEffect(isPlaying) {
|
|
132
|
+
currentOnEvent?.invoke(if (isPlaying) LottieEvent.Start else LottieEvent.Pause)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
LaunchedEffect(lottieState) {
|
|
136
|
+
var armed = false
|
|
137
|
+
snapshotFlow { lottieState.isAtEnd }.collect { atEnd ->
|
|
138
|
+
if (!atEnd) armed = true
|
|
139
|
+
else if (armed) { armed = false; currentOnEvent?.invoke(LottieEvent.Finish) }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
LottieAnimation(
|
|
144
|
+
composition = composition,
|
|
145
|
+
progress = { lottieState.progress },
|
|
146
|
+
dynamicProperties = if (tintColor != null) dynamicProperties else null,
|
|
147
|
+
modifier = modifier
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
actual fun NativePaint.setColor(color: Color){
|
|
152
|
+
this.color = color.toArgb()
|
|
153
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
package vn.momo.kits.application
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Immutable
|
|
4
|
+
import androidx.compose.runtime.getValue
|
|
5
|
+
import androidx.compose.runtime.mutableStateOf
|
|
6
|
+
import androidx.compose.runtime.setValue
|
|
7
|
+
import androidx.compose.runtime.staticCompositionLocalOf
|
|
8
|
+
import vn.momo.kits.components.TrustBannerData
|
|
9
|
+
|
|
10
|
+
@Immutable
|
|
11
|
+
data class FeatureFlags(
|
|
12
|
+
val showBaseLineDebug: Boolean? = false,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
@Immutable
|
|
16
|
+
data class DesignSystemConfig(
|
|
17
|
+
val trustBanner: TrustBannerData? = null,
|
|
18
|
+
val headerBar: String? = null,
|
|
19
|
+
val headerGradient: String? = null,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
// App-wide holder seeded by the host (same pattern as KitFontScale), so direct NavigationContainer
|
|
23
|
+
// callers get the config without passing it. Snapshot state: a config fetched after first frame recomposes.
|
|
24
|
+
object KitDesignSystemConfig {
|
|
25
|
+
var config by mutableStateOf<DesignSystemConfig?>(null)
|
|
26
|
+
private set
|
|
27
|
+
|
|
28
|
+
fun update(config: DesignSystemConfig?) {
|
|
29
|
+
this.config = config
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Immutable
|
|
34
|
+
data class MiniAppContext(
|
|
35
|
+
val appIcon: String = "",
|
|
36
|
+
val appName: Any? = null,
|
|
37
|
+
val appId: String = "",
|
|
38
|
+
val appCode: String = "",
|
|
39
|
+
val description: Any? = null,
|
|
40
|
+
val support: Map<String, Any?> = emptyMap(),
|
|
41
|
+
val toolkitConfig: Map<String, Any?> = emptyMap(),
|
|
42
|
+
val providerId: String = "",
|
|
43
|
+
val permissions: List<Map<String, Any>>? = emptyList(),
|
|
44
|
+
val features: FeatureFlags? = null,
|
|
45
|
+
val scaleSizeMaxRate: Float? = null,
|
|
46
|
+
val userScaleRate: Float? = null,
|
|
47
|
+
val useOSScaleRate: Boolean? = null,
|
|
48
|
+
) {
|
|
49
|
+
companion object {
|
|
50
|
+
|
|
51
|
+
fun toMap(context: MiniAppContext?): Map<String, Any?> = mapOf(
|
|
52
|
+
"icon" to (context?.appIcon ?: ""),
|
|
53
|
+
"name" to context?.appName,
|
|
54
|
+
"appId" to (context?.appId ?: ""),
|
|
55
|
+
"code" to (context?.appCode ?: ""),
|
|
56
|
+
"description" to (context?.description ?: ""),
|
|
57
|
+
"support" to (context?.support ?: emptyMap()),
|
|
58
|
+
"toolkitConfig" to (context?.toolkitConfig ?: emptyMap()),
|
|
59
|
+
"providerId" to (context?.providerId ?: ""),
|
|
60
|
+
"permissions" to (context?.permissions ?: emptyList()),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
fun merge(parent: MiniAppContext?, child: MiniAppContext?): MiniAppContext? {
|
|
64
|
+
if (parent == null && child == null) return null
|
|
65
|
+
if (parent == null) return child
|
|
66
|
+
if (child == null) return parent
|
|
67
|
+
|
|
68
|
+
return MiniAppContext(
|
|
69
|
+
appIcon = parent.appIcon.ifBlank { child.appIcon },
|
|
70
|
+
appName = parent.appName ?: child.appName,
|
|
71
|
+
appId = parent.appId.ifBlank { child.appId },
|
|
72
|
+
appCode = parent.appCode.ifBlank { child.appCode },
|
|
73
|
+
description = parent.description ?: child.description,
|
|
74
|
+
support = mergeMaps(parent.support, child.support),
|
|
75
|
+
toolkitConfig = mergeMaps(parent.toolkitConfig, child.toolkitConfig),
|
|
76
|
+
providerId = parent.providerId.ifBlank { child.providerId },
|
|
77
|
+
permissions = if (!parent.permissions.isNullOrEmpty()) parent.permissions else child.permissions,
|
|
78
|
+
features = mergeFeatureFlags(parent.features, child.features),
|
|
79
|
+
scaleSizeMaxRate = parent.scaleSizeMaxRate ?: child.scaleSizeMaxRate,
|
|
80
|
+
userScaleRate = parent.userScaleRate ?: child.userScaleRate,
|
|
81
|
+
useOSScaleRate = parent.useOSScaleRate ?: child.useOSScaleRate,
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private fun mergeMaps(parent: Map<String, Any?>, child: Map<String, Any?>): Map<String, Any?> {
|
|
86
|
+
return child + parent
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private fun mergeFeatureFlags(parent: FeatureFlags?, child: FeatureFlags?): FeatureFlags? {
|
|
90
|
+
if (parent == null && child == null) return null
|
|
91
|
+
if (parent == null) return child
|
|
92
|
+
if (child == null) return parent
|
|
93
|
+
|
|
94
|
+
return FeatureFlags(
|
|
95
|
+
showBaseLineDebug = parent.showBaseLineDebug ?: child.showBaseLineDebug
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Immutable
|
|
102
|
+
data class ComponentInformation(
|
|
103
|
+
val componentName: String? = null,
|
|
104
|
+
val componentId: String? = null,
|
|
105
|
+
val params: Map<String,Any?>? = null,
|
|
106
|
+
val action: String? = null
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
var IsShowBaseLineDebug = false
|
|
110
|
+
|
|
111
|
+
val LocalContext = staticCompositionLocalOf<MiniAppContext?> {
|
|
112
|
+
null
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
val LocalComponentInformation = staticCompositionLocalOf<ComponentInformation?> {
|
|
116
|
+
null
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
val LocalDesignSystemConfig = staticCompositionLocalOf<DesignSystemConfig?> {
|
|
120
|
+
null
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@Deprecated("Max font scale is fixed at MAX_FONT_SCALE (1.5); this CompositionLocal is no longer read.")
|
|
124
|
+
val ScaleSizeMaxRate = staticCompositionLocalOf<Float?> { null }
|