@momo-kits/native-kits 0.167.1-duo.8-debug → 0.167.1-duo.9
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 +4 -1
- package/ios/Application/ApplicationEnvironment.swift +11 -0
- package/ios/Application/ComposeApi.swift +2 -1
- package/ios/Application/{Components.swift → LegacyHeader.swift} +6 -62
- package/ios/Application/Screen.swift +3 -2
- 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 +12 -20
- 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 +9 -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 +18 -0
- package/ios/Icon/Icon.swift +7 -1
- package/ios/IconButton/IconButton.swift +15 -7
- package/ios/Image/Image.swift +7 -34
- 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 +102 -75
- 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 +123 -3
- package/ios/Layout/Item.swift +5 -4
- package/ios/Layout/Section.swift +4 -100
- package/ios/Loader/Loader.swift +5 -9
- package/ios/Lottie/LottieView.swift +10 -0
- package/ios/{Application/Navigation/Overplay → Navigation}/BottomSheet.swift +61 -9
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTab.swift +60 -34
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTabBar.swift +11 -6
- package/ios/{Application → Navigation/Component}/FloatingButton.swift +14 -3
- package/ios/Navigation/Component/Header.swift +493 -0
- package/ios/Navigation/Component/HeaderBackground.swift +134 -0
- package/ios/Navigation/Component/HeaderJourney.swift +73 -0
- package/ios/Navigation/Component/HeaderLocation.swift +48 -0
- package/ios/Navigation/Component/HeaderRight.swift +386 -0
- package/ios/Navigation/Component/HeaderTitle.swift +36 -0
- package/ios/{Application/Navigation → Navigation/Component}/HeaderUser.swift +20 -23
- package/ios/{Application/Navigation/component → Navigation/Component}/SideBar.swift +49 -28
- package/ios/{Application/Navigation/Overplay → Navigation/Component}/SnackBar.swift +5 -5
- package/ios/Navigation/HostBackGestureBridge.swift +57 -0
- package/ios/Navigation/Navigation.swift +190 -0
- package/ios/{Application/Navigation → Navigation}/NavigationContainer.swift +46 -41
- package/ios/{Application/Navigation → Navigation}/Navigator.swift +65 -9
- package/ios/{Application → Navigation}/StackScreen.swift +236 -103
- 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 +79 -159
- package/ios/Popup/PopupInput.swift +10 -13
- package/ios/Popup/PopupLayout.swift +97 -2
- package/ios/Popup/PopupNotify.swift +27 -55
- package/ios/Popup/PopupPromotion.swift +22 -50
- 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/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 +41 -27
- package/ios/Title/Title.swift +6 -17
- package/ios/Tooltip/Tooltip.swift +29 -14
- package/ios/Typography/Text.swift +61 -19
- package/ios/Uploader/Uploader.swift +3 -1
- package/ios/native-kits.podspec +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +77 -1
- package/package.json +1 -1
- package/build.gradle.kts +0 -11
- package/compose/build.gradle.kts +0 -204
- package/compose/build.gradle.kts.backup +0 -204
- package/compose/compose.podspec +0 -47
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -153
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -475
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -266
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -264
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -361
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -552
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -297
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -232
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -137
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -708
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -203
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -232
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -98
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -312
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -408
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -105
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -366
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -37
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -185
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -74
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -217
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -86
- package/gradle/libs.versions.toml +0 -69
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/gradle.properties +0 -26
- package/gradlew +0 -252
- package/gradlew.bat +0 -94
- package/ios/Application/HeaderRight.swift +0 -324
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/NavigatorManager.swift +0 -29
- package/ios/Application/Navigation/component/DuoScrollGradient.swift +0 -54
- package/ios/Application/Navigation/component/Header.swift +0 -183
- package/ios/Application/Navigation/component/HeaderBackground.swift +0 -84
- 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 -280
- package/ios-demo/README.md +0 -120
- package/settings.gradle.kts +0 -64
- /package/ios/{Application/Layout → Layout}/ScreenLayout.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/DuoBarCompression.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/DuoTabBar.swift +0 -0
- /package/ios/{Application/Navigation/Overplay → Navigation}/ModalScreen.swift +0 -0
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
import Foundation
|
|
3
|
-
|
|
4
|
-
public struct HeaderRightData {
|
|
5
|
-
var useShortcut: Bool
|
|
6
|
-
var useMore: Bool
|
|
7
|
-
var tools: [ToolGroup]
|
|
8
|
-
var toolCallback: ((String) -> Void)?
|
|
9
|
-
var useSystemTools: Bool
|
|
10
|
-
var useCloseIcon: Bool
|
|
11
|
-
|
|
12
|
-
public init(
|
|
13
|
-
useShortcut: Bool = false,
|
|
14
|
-
useMore: Bool = false,
|
|
15
|
-
tools: [ToolGroup] = [],
|
|
16
|
-
toolCallback: ((String) -> Void)? = nil,
|
|
17
|
-
useSystemTools: Bool = true,
|
|
18
|
-
useCloseIcon: Bool = false
|
|
19
|
-
) {
|
|
20
|
-
self.useShortcut = useShortcut
|
|
21
|
-
self.useMore = useMore
|
|
22
|
-
self.tools = tools
|
|
23
|
-
self.toolCallback = toolCallback
|
|
24
|
-
self.useSystemTools = useSystemTools
|
|
25
|
-
self.useCloseIcon = useCloseIcon
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/// Close-circle instead of home, as RN `headerRight.useCloseIcon`.
|
|
29
|
-
var closeIcon: String { useCloseIcon ? "16_navigation_close_circle" : "16_basic_home" }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/// The Help Center mini-app hides its own help-center button.
|
|
33
|
-
func showsHelpCenter(_ context: MiniAppContext?) -> Bool {
|
|
34
|
-
context?.appId != "vn.momo.helpcenter"
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public struct Tool {
|
|
38
|
-
var key: String
|
|
39
|
-
var icon: String
|
|
40
|
-
var showBadge: Bool
|
|
41
|
-
var name: [String: String]
|
|
42
|
-
var showRightIcon: Bool
|
|
43
|
-
|
|
44
|
-
public init(
|
|
45
|
-
key: String,
|
|
46
|
-
icon: String,
|
|
47
|
-
name: [String: String] = [:],
|
|
48
|
-
showBadge: Bool = false,
|
|
49
|
-
showRightIcon: Bool = true
|
|
50
|
-
) {
|
|
51
|
-
self.key = key
|
|
52
|
-
self.icon = icon
|
|
53
|
-
self.showBadge = showBadge
|
|
54
|
-
self.name = name
|
|
55
|
-
self.showRightIcon = showRightIcon
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
func toMap() -> [String: Any] {
|
|
59
|
-
return [
|
|
60
|
-
"key": key,
|
|
61
|
-
"icon": icon,
|
|
62
|
-
"showBadge": showBadge,
|
|
63
|
-
"name": name,
|
|
64
|
-
"showRightIcon": showRightIcon
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public struct ToolGroup {
|
|
70
|
-
var title: [String: String]
|
|
71
|
-
var items: [Tool]
|
|
72
|
-
|
|
73
|
-
public init(
|
|
74
|
-
title: [String: String] = [:],
|
|
75
|
-
items: [Tool]
|
|
76
|
-
) {
|
|
77
|
-
self.title = title
|
|
78
|
-
self.items = items
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
func toMap() -> [String: Any] {
|
|
82
|
-
return [
|
|
83
|
-
"title": title,
|
|
84
|
-
"items": items.map { $0.toMap() }
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
struct NavigationButtonConfig {
|
|
90
|
-
let icon: String
|
|
91
|
-
let onPress: () -> Void
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// MARK: - Components
|
|
95
|
-
public struct HeaderRight: View {
|
|
96
|
-
public init(headerRight: HeaderRightData? = nil, tintColor: Color? = nil) {
|
|
97
|
-
self.headerRight = headerRight
|
|
98
|
-
self.tintColor = tintColor
|
|
99
|
-
}
|
|
100
|
-
var headerRight: HeaderRightData?
|
|
101
|
-
var tintColor: Color? = nil
|
|
102
|
-
|
|
103
|
-
public var body: some View {
|
|
104
|
-
HStack(alignment: .center) {
|
|
105
|
-
ToolkitHeaderRight(headerRight: headerRight, tintColor: tintColor)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
struct ToolkitHeaderRight: View {
|
|
111
|
-
var headerRight: HeaderRightData?
|
|
112
|
-
var tintColor: Color?
|
|
113
|
-
@State private var isFavorite: Bool = false
|
|
114
|
-
@State private var isLoading: Bool = false
|
|
115
|
-
// Legacy hosts inject with `.environmentObject`, containers with the keyed value; outside
|
|
116
|
-
// both this used to trap, so read the object optionally and fall back to the keyed one.
|
|
117
|
-
@OptionalEnvironmentObject private var injectedEnvironment: ApplicationEnvironment?
|
|
118
|
-
@Environment(\.applicationEnvironment) private var keyedEnvironment
|
|
119
|
-
|
|
120
|
-
private var environment: ApplicationEnvironment { injectedEnvironment ?? keyedEnvironment }
|
|
121
|
-
|
|
122
|
-
// MARK: - Actions
|
|
123
|
-
private func onPressShortcut() {
|
|
124
|
-
// onToolAction needs the app context (appId/code) so the host knows which app to (un)favorite;
|
|
125
|
-
// without it the favorite is a no-op. Mirrors onPressMore below and the Compose HeaderRight.
|
|
126
|
-
let context = environment.applicationContext
|
|
127
|
-
environment.composeApi?.request(
|
|
128
|
-
funcName: "onToolAction",
|
|
129
|
-
params: [
|
|
130
|
-
"item": ["key": "onFavorite"],
|
|
131
|
-
"context": [
|
|
132
|
-
"appId": context?.appId,
|
|
133
|
-
"code": context?.appCode,
|
|
134
|
-
"name": context?.appName,
|
|
135
|
-
"icon": context?.appIcon,
|
|
136
|
-
"description": context?.description,
|
|
137
|
-
"support": context?.support,
|
|
138
|
-
"toolkitConfig": context?.toolkitConfig,
|
|
139
|
-
"providerId": context?.providerId,
|
|
140
|
-
"permissions": context?.permissions
|
|
141
|
-
]
|
|
142
|
-
]
|
|
143
|
-
) { _ in
|
|
144
|
-
isFavorite.toggle()
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
private func onPressHelpCenter() {
|
|
149
|
-
let context = environment.applicationContext
|
|
150
|
-
let paramMap: [String: Any] = [
|
|
151
|
-
"appId": context?.appId,
|
|
152
|
-
"code": context?.appCode,
|
|
153
|
-
"name": context?.appName,
|
|
154
|
-
"icon": context?.appIcon,
|
|
155
|
-
"description": context?.description
|
|
156
|
-
]
|
|
157
|
-
environment.composeApi?.request(
|
|
158
|
-
funcName: "showHelpCenter",
|
|
159
|
-
params: paramMap
|
|
160
|
-
) { _ in }
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
private func onPressClose() {
|
|
164
|
-
environment.composeApi?.request(
|
|
165
|
-
funcName: "dismissAll",
|
|
166
|
-
params: ""
|
|
167
|
-
) { _ in }
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
private func onPressMore() {
|
|
171
|
-
let context = environment.applicationContext
|
|
172
|
-
let params: [String: Any] = [
|
|
173
|
-
"useSystemTools": headerRight?.useSystemTools,
|
|
174
|
-
"tools": headerRight?.tools.map { $0.toMap() } ?? [],
|
|
175
|
-
"context": [
|
|
176
|
-
"appId": context?.appId,
|
|
177
|
-
"code": context?.appCode,
|
|
178
|
-
"name": context?.appName,
|
|
179
|
-
"icon": context?.appIcon,
|
|
180
|
-
"description": context?.description,
|
|
181
|
-
"support": context?.support,
|
|
182
|
-
"toolkitConfig": context?.toolkitConfig,
|
|
183
|
-
"providerId": context?.providerId,
|
|
184
|
-
"permissions": context?.permissions
|
|
185
|
-
]
|
|
186
|
-
]
|
|
187
|
-
environment.composeApi?.request(
|
|
188
|
-
funcName: "showTools",
|
|
189
|
-
params: params
|
|
190
|
-
) { response in
|
|
191
|
-
do {
|
|
192
|
-
if let jsonData = response.data(using: .utf8),
|
|
193
|
-
let json = try JSONSerialization.jsonObject(with: jsonData) as? [String: Any],
|
|
194
|
-
let toolResponse = json["response"] as? String {
|
|
195
|
-
headerRight?.toolCallback?(toolResponse)
|
|
196
|
-
}
|
|
197
|
-
} catch {
|
|
198
|
-
print("Error parsing response:", error)
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// Load the current favorite state on appear so the star reflects reality; without this the button
|
|
204
|
-
// always renders "not favorited" until the user taps it. Mirrors the Compose LaunchedEffect.
|
|
205
|
-
private func loadFavoriteState() {
|
|
206
|
-
let context = environment.applicationContext
|
|
207
|
-
environment.composeApi?.request(
|
|
208
|
-
funcName: "isFavoriteApp",
|
|
209
|
-
params: ["code": context?.appCode]
|
|
210
|
-
) { response in
|
|
211
|
-
guard let data = response.data(using: .utf8),
|
|
212
|
-
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else {
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
isFavorite = (json["response"] as? Bool) ?? false
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
private func getNavigationButtonConfig() -> NavigationButtonConfig {
|
|
220
|
-
let totalTools = headerRight?.tools.reduce(0) { $0 + $1.items.count } ?? 0
|
|
221
|
-
var icon = isFavorite ? "pin_star_checked" : "pin_star"
|
|
222
|
-
var onClickHandler: () -> Void = onPressShortcut
|
|
223
|
-
|
|
224
|
-
if totalTools > 1 || headerRight?.useMore == true {
|
|
225
|
-
icon = "navigation_more_icon"
|
|
226
|
-
onClickHandler = onPressMore
|
|
227
|
-
} else if totalTools == 1, let singleTool = headerRight?.tools.first?.items.first {
|
|
228
|
-
icon = singleTool.icon
|
|
229
|
-
onClickHandler = {
|
|
230
|
-
headerRight?.toolCallback?(singleTool.key)
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
return NavigationButtonConfig(icon: icon, onPress: onClickHandler)
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
var body: some View {
|
|
238
|
-
let backgroundButtonColor: Color = tintColor == Colors.black01 ? Colors.black20.opacity(0.6) : Colors.black01.opacity(0.6)
|
|
239
|
-
let borderColor: Color = tintColor == Colors.black01 ? Colors.black01.opacity(0.2) : Colors.black20.opacity(0.2)
|
|
240
|
-
let navButtonConfig = getNavigationButtonConfig()
|
|
241
|
-
let showBadge = headerRight?.tools.contains { group in
|
|
242
|
-
group.items.contains { $0.showBadge }
|
|
243
|
-
} ?? false
|
|
244
|
-
|
|
245
|
-
HStack(alignment: .center, spacing: 0) {
|
|
246
|
-
if headerRight?.useShortcut == true {
|
|
247
|
-
NavigationButton(
|
|
248
|
-
disabled: isLoading,
|
|
249
|
-
icon: navButtonConfig.icon,
|
|
250
|
-
showBadge: showBadge,
|
|
251
|
-
onClick: navButtonConfig.onPress,
|
|
252
|
-
tintColor: tintColor
|
|
253
|
-
)
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
HStack(alignment: .center, spacing: 0) {
|
|
257
|
-
if showsHelpCenter(environment.applicationContext) {
|
|
258
|
-
Icon(source: "help_center", size: 20, color: tintColor ?? Colors.black17)
|
|
259
|
-
.padding(4)
|
|
260
|
-
.onTapGesture {
|
|
261
|
-
onPressHelpCenter()
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
Rectangle()
|
|
265
|
-
.fill(tintColor ?? Colors.black20)
|
|
266
|
-
.frame(width: 0.5, height: 12)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
Icon(source: headerRight?.closeIcon ?? "16_basic_home", size: 20, color: tintColor ?? Colors.black17)
|
|
270
|
-
.padding(4)
|
|
271
|
-
.onTapGesture {
|
|
272
|
-
onPressClose()
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
.frame(width: 65, height: 28)
|
|
276
|
-
.background(backgroundButtonColor)
|
|
277
|
-
.cornerRadius(14)
|
|
278
|
-
.overlay(
|
|
279
|
-
RoundedRectangle(cornerRadius: 14)
|
|
280
|
-
.stroke(borderColor, lineWidth: 0.2)
|
|
281
|
-
)
|
|
282
|
-
.padding(.leading, Spacing.S)
|
|
283
|
-
}
|
|
284
|
-
.onAppear {
|
|
285
|
-
loadFavoriteState()
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
struct NavigationButton: View {
|
|
291
|
-
var disabled: Bool
|
|
292
|
-
var icon: String
|
|
293
|
-
var showBadge: Bool
|
|
294
|
-
var onClick: () -> Void
|
|
295
|
-
var tintColor: Color?
|
|
296
|
-
|
|
297
|
-
var body: some View {
|
|
298
|
-
let backgroundButtonColor: Color = tintColor == Colors.black01 ? Colors.black20.opacity(0.6) : Colors.black01.opacity(0.6)
|
|
299
|
-
let borderColor: Color = tintColor == Colors.black01 ? Colors.black01.opacity(0.2) : Colors.black20.opacity(0.2)
|
|
300
|
-
|
|
301
|
-
ZStack {
|
|
302
|
-
Circle()
|
|
303
|
-
.fill(backgroundButtonColor)
|
|
304
|
-
.overlay(
|
|
305
|
-
Circle()
|
|
306
|
-
.stroke(borderColor, lineWidth: 0.2)
|
|
307
|
-
)
|
|
308
|
-
|
|
309
|
-
Icon(source: icon, size: 16, color: tintColor)
|
|
310
|
-
|
|
311
|
-
if showBadge {
|
|
312
|
-
BadgeDot(size: .small)
|
|
313
|
-
.offset(x: -2, y: -2)
|
|
314
|
-
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topTrailing)
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
.frame(width: 28, height: 28)
|
|
318
|
-
.onTapGesture {
|
|
319
|
-
if !disabled {
|
|
320
|
-
onClick()
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// HeaderBackProps.swift
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// SwiftUI mirror of Compose's `HeaderBackProps` + `PopupNotifyProps`/`PopupAction`.
|
|
6
|
-
// When `preventBack` is set, `Navigator.onBackSafe` shows a confirm popup
|
|
7
|
-
// before actually leaving the screen — same behavior as Compose.
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
import SwiftUI
|
|
11
|
-
|
|
12
|
-
/// Mirrors Compose's `PopupAction` (a titled button with an optional handler).
|
|
13
|
-
public struct PopupAction {
|
|
14
|
-
public let title: String
|
|
15
|
-
public let onPress: (() -> Void)?
|
|
16
|
-
|
|
17
|
-
public init(title: String, onPress: (() -> Void)? = nil) {
|
|
18
|
-
self.title = title
|
|
19
|
-
self.onPress = onPress
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/// Mirrors Compose's `PopupNotifyProps` as consumed by `headerBackProps.preventBack`.
|
|
24
|
-
public struct PreventBackProps {
|
|
25
|
-
public var image: String
|
|
26
|
-
public var title: String
|
|
27
|
-
public var description: String
|
|
28
|
-
public var error: String
|
|
29
|
-
public var primary: PopupAction?
|
|
30
|
-
public var secondary: PopupAction?
|
|
31
|
-
public var buttonDirection: PopupButtonDirection
|
|
32
|
-
public var isShowCloseIcon: Bool
|
|
33
|
-
public var onIconClose: (() -> Void)?
|
|
34
|
-
|
|
35
|
-
public init(
|
|
36
|
-
image: String = "",
|
|
37
|
-
title: String = "",
|
|
38
|
-
description: String = "",
|
|
39
|
-
error: String = "",
|
|
40
|
-
primary: PopupAction? = nil,
|
|
41
|
-
secondary: PopupAction? = nil,
|
|
42
|
-
buttonDirection: PopupButtonDirection = .row,
|
|
43
|
-
isShowCloseIcon: Bool = true,
|
|
44
|
-
onIconClose: (() -> Void)? = nil
|
|
45
|
-
) {
|
|
46
|
-
self.image = image
|
|
47
|
-
self.title = title
|
|
48
|
-
self.description = description
|
|
49
|
-
self.error = error
|
|
50
|
-
self.primary = primary
|
|
51
|
-
self.secondary = secondary
|
|
52
|
-
self.buttonDirection = buttonDirection
|
|
53
|
-
self.isShowCloseIcon = isShowCloseIcon
|
|
54
|
-
self.onIconClose = onIconClose
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/// Mirrors Compose's `HeaderBackProps`.
|
|
59
|
-
public struct HeaderBackProps {
|
|
60
|
-
/// When non-nil, a confirm popup is shown before the back navigation runs.
|
|
61
|
-
public var preventBack: PreventBackProps?
|
|
62
|
-
|
|
63
|
-
public init(preventBack: PreventBackProps? = nil) {
|
|
64
|
-
self.preventBack = preventBack
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// HeaderTitle.swift
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// SwiftUI mirror of Compose's `sealed class HeaderTitle` (navigation/component/Header.kt).
|
|
6
|
-
// The header can show either a plain title (`.default`) or a rich "user" title
|
|
7
|
-
// with an avatar group, subtitle, inline icons and a status dot (`.user`).
|
|
8
|
-
// (Compose's `Location`/`Journey` variants are not rendered yet, so they are
|
|
9
|
-
// omitted here for parity with the implemented `HeaderUser`.)
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
import SwiftUI
|
|
13
|
-
|
|
14
|
-
/// Data backing a `.user` header title (mirrors `HeaderTitle.User`).
|
|
15
|
-
public struct HeaderUserData {
|
|
16
|
-
public var title: String
|
|
17
|
-
public var subTitle: String?
|
|
18
|
-
public var image: [String]?
|
|
19
|
-
public var dotColor: Color?
|
|
20
|
-
public var tintColor: Color?
|
|
21
|
-
public var onPress: (() -> Void)?
|
|
22
|
-
public var icons: [String]
|
|
23
|
-
public var isLoading: Bool
|
|
24
|
-
|
|
25
|
-
public init(
|
|
26
|
-
title: String,
|
|
27
|
-
subTitle: String? = nil,
|
|
28
|
-
image: [String]? = nil,
|
|
29
|
-
dotColor: Color? = nil,
|
|
30
|
-
tintColor: Color? = nil,
|
|
31
|
-
onPress: (() -> Void)? = nil,
|
|
32
|
-
icons: [String] = [],
|
|
33
|
-
isLoading: Bool = false
|
|
34
|
-
) {
|
|
35
|
-
self.title = title
|
|
36
|
-
self.subTitle = subTitle
|
|
37
|
-
self.image = image
|
|
38
|
-
self.dotColor = dotColor
|
|
39
|
-
self.tintColor = tintColor
|
|
40
|
-
self.onPress = onPress
|
|
41
|
-
self.icons = icons
|
|
42
|
-
self.isLoading = isLoading
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/// Mirrors Compose's `HeaderTitle` sealed class.
|
|
47
|
-
public enum HeaderTitle {
|
|
48
|
-
case `default`(String)
|
|
49
|
-
case user(HeaderUserData)
|
|
50
|
-
|
|
51
|
-
/// Plain title text, when this is a `.default` title (used by the legacy
|
|
52
|
-
/// string-based `Header`/`NavigationOptions` paths).
|
|
53
|
-
public var defaultTitle: String? {
|
|
54
|
-
if case let .default(text) = self { return text }
|
|
55
|
-
return nil
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// NavigationOptions.swift
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// SwiftUI mirror of Compose's NavigationOptions.
|
|
6
|
-
// Each option lines up with a parameter on the existing `Screen` view,
|
|
7
|
-
// so NavigationContainer can auto-wrap a registered screen body in `Screen(options)`.
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
import SwiftUI
|
|
11
|
-
|
|
12
|
-
public struct NavigationOptions {
|
|
13
|
-
public var screenName: String?
|
|
14
|
-
public var title: String
|
|
15
|
-
/// Rich header title (mirrors Compose's `headerTitle`). When set to `.user`
|
|
16
|
-
/// the header renders an avatar group instead of `title`; `.default` keeps
|
|
17
|
-
/// the plain `title` text.
|
|
18
|
-
public var headerTitle: HeaderTitle?
|
|
19
|
-
public var titlePosition: TitlePosition
|
|
20
|
-
public var headerType: HeaderType
|
|
21
|
-
/// Mirrors Compose's `HeaderType.Extended/Default(useAnimated = ...)`: when true
|
|
22
|
-
/// and `inputSearchProps` is set, the search bar animates into the header on scroll.
|
|
23
|
-
public var useAnimated: Bool
|
|
24
|
-
public var headerTransparent: Bool
|
|
25
|
-
public var fullScreenContent: Bool
|
|
26
|
-
public var hiddenBack: Bool
|
|
27
|
-
public var backgroundColor: Color?
|
|
28
|
-
public var tintColor: Color?
|
|
29
|
-
public var scrollable: Bool
|
|
30
|
-
/// Mirrors Compose's `ScrollData.scrollToTopCallback`: invoked when the
|
|
31
|
-
/// screen is asked to scroll to top (e.g. on a status-bar tap).
|
|
32
|
-
public var scrollToTopCallback: (() -> Void)?
|
|
33
|
-
public var useAvoidKeyboard: Bool
|
|
34
|
-
/// Mirrors Compose's `KeyboardOptions.keyboardShouldPersistTaps`: when true,
|
|
35
|
-
/// tapping anywhere on the screen dismisses the keyboard.
|
|
36
|
-
public var keyboardShouldPersistTaps: Bool
|
|
37
|
-
/// Mirrors Compose's `HeaderBackProps`: drives the prevent-back confirm popup.
|
|
38
|
-
public var headerBackProps: HeaderBackProps?
|
|
39
|
-
/// Typed toolkit data for the default header right control (mirrors
|
|
40
|
-
/// Compose's `HeaderRight.Toolkit`). Use `headerRight` for `.custom` and nil
|
|
41
|
-
/// for `.none`.
|
|
42
|
-
public var headerRightData: HeaderRightData?
|
|
43
|
-
public var headerRight: (() -> any View)?
|
|
44
|
-
public var footer: (() -> AnyView)?
|
|
45
|
-
public var animatedHeader: AnimatedHeader?
|
|
46
|
-
public var layoutOffset: CGFloat
|
|
47
|
-
public var inputSearchProps: InputSearchProps?
|
|
48
|
-
public var fabProps: FabProps?
|
|
49
|
-
public var onBackHandler: (() -> Void)?
|
|
50
|
-
|
|
51
|
-
public init(
|
|
52
|
-
screenName: String? = nil,
|
|
53
|
-
title: String = "Stack",
|
|
54
|
-
headerTitle: HeaderTitle? = nil,
|
|
55
|
-
titlePosition: TitlePosition = .left,
|
|
56
|
-
headerType: HeaderType = .default,
|
|
57
|
-
useAnimated: Bool = false,
|
|
58
|
-
headerTransparent: Bool = false,
|
|
59
|
-
fullScreenContent: Bool = false,
|
|
60
|
-
hiddenBack: Bool = false,
|
|
61
|
-
backgroundColor: Color? = nil,
|
|
62
|
-
tintColor: Color? = Colors.black17,
|
|
63
|
-
scrollable: Bool = true,
|
|
64
|
-
scrollToTopCallback: (() -> Void)? = nil,
|
|
65
|
-
useAvoidKeyboard: Bool = true,
|
|
66
|
-
keyboardShouldPersistTaps: Bool = false,
|
|
67
|
-
headerBackProps: HeaderBackProps? = nil,
|
|
68
|
-
headerRightData: HeaderRightData? = nil,
|
|
69
|
-
headerRight: (() -> any View)? = { HeaderRight() },
|
|
70
|
-
footer: (() -> AnyView)? = nil,
|
|
71
|
-
animatedHeader: AnimatedHeader? = nil,
|
|
72
|
-
layoutOffset: CGFloat = 56,
|
|
73
|
-
inputSearchProps: InputSearchProps? = nil,
|
|
74
|
-
fabProps: FabProps? = nil,
|
|
75
|
-
onBackHandler: (() -> Void)? = nil
|
|
76
|
-
) {
|
|
77
|
-
self.screenName = screenName
|
|
78
|
-
self.title = title
|
|
79
|
-
self.headerTitle = headerTitle
|
|
80
|
-
self.titlePosition = titlePosition
|
|
81
|
-
self.headerType = headerType
|
|
82
|
-
self.useAnimated = useAnimated
|
|
83
|
-
self.headerTransparent = headerTransparent
|
|
84
|
-
self.fullScreenContent = fullScreenContent
|
|
85
|
-
self.hiddenBack = hiddenBack
|
|
86
|
-
self.backgroundColor = backgroundColor
|
|
87
|
-
self.tintColor = tintColor
|
|
88
|
-
self.scrollable = scrollable
|
|
89
|
-
self.scrollToTopCallback = scrollToTopCallback
|
|
90
|
-
self.useAvoidKeyboard = useAvoidKeyboard
|
|
91
|
-
self.keyboardShouldPersistTaps = keyboardShouldPersistTaps
|
|
92
|
-
self.headerBackProps = headerBackProps
|
|
93
|
-
self.headerRightData = headerRightData
|
|
94
|
-
self.headerRight = headerRight
|
|
95
|
-
self.footer = footer
|
|
96
|
-
self.animatedHeader = animatedHeader
|
|
97
|
-
self.layoutOffset = layoutOffset
|
|
98
|
-
self.inputSearchProps = inputSearchProps
|
|
99
|
-
self.fabProps = fabProps
|
|
100
|
-
self.onBackHandler = onBackHandler
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
extension NavigationOptions {
|
|
105
|
-
var resolvedHeaderRight: (() -> any View)? {
|
|
106
|
-
guard let headerRightData else { return headerRight }
|
|
107
|
-
return { HeaderRight(headerRight: headerRightData, tintColor: tintColor) }
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
|
|
3
|
-
@available(iOS 16.0, *)
|
|
4
|
-
public final class NavigatorManager {
|
|
5
|
-
public static let shared = NavigatorManager()
|
|
6
|
-
private init() {}
|
|
7
|
-
|
|
8
|
-
// Weak: a container torn down while its cover is up never reports its disappearance.
|
|
9
|
-
private var navigators: [WeakNavigator] = []
|
|
10
|
-
|
|
11
|
-
public func push(_ navigator: Navigator) {
|
|
12
|
-
navigators.removeAll { $0.value == nil }
|
|
13
|
-
guard !navigators.contains(where: { $0.value === navigator }) else { return }
|
|
14
|
-
navigators.append(WeakNavigator(value: navigator))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public func remove(_ navigator: Navigator) {
|
|
18
|
-
navigators.removeAll { $0.value == nil || $0.value === navigator }
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public func checkCanPop() -> Bool { navigators.contains { $0.value != nil } }
|
|
22
|
-
|
|
23
|
-
public func pop() { navigators.last { $0.value != nil }?.value?.onBackSafe() }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@available(iOS 16.0, *)
|
|
27
|
-
private struct WeakNavigator {
|
|
28
|
-
weak var value: Navigator?
|
|
29
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// DuoScrollGradient.swift
|
|
3
|
-
// MoMoUIKits
|
|
4
|
-
//
|
|
5
|
-
// Port of RN `DuoScrollGradient` (Components/DuoGlassBackground.tsx): with the iPhone Duo
|
|
6
|
-
// glass header the content scrolls under the bar, so the header gradient is drawn under it.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
import SwiftUI
|
|
10
|
-
|
|
11
|
-
// extended headers run their gradient this far below the header, as off Duo
|
|
12
|
-
private let extendedGradientExtra: CGFloat = 52
|
|
13
|
-
// scroll distance over which the extended gradient collapses to the header
|
|
14
|
-
private let extendedCollapseDistance: CGFloat = 100
|
|
15
|
-
|
|
16
|
-
struct DuoScrollGradient: View {
|
|
17
|
-
let scrollOffset: CGFloat
|
|
18
|
-
let headerHeight: CGFloat
|
|
19
|
-
let extended: Bool
|
|
20
|
-
/// Quick return header: the gradient leaves with the content instead of fading.
|
|
21
|
-
var followScroll = false
|
|
22
|
-
|
|
23
|
-
@Environment(\.appTheme) private var theme
|
|
24
|
-
|
|
25
|
-
private var scroll: CGFloat { max(scrollOffset, 0) }
|
|
26
|
-
|
|
27
|
-
var body: some View {
|
|
28
|
-
Group {
|
|
29
|
-
if followScroll {
|
|
30
|
-
gradient
|
|
31
|
-
.frame(height: headerHeight + (extended ? extendedGradientExtra : 0))
|
|
32
|
-
.offset(y: -scroll)
|
|
33
|
-
} else {
|
|
34
|
-
// fades out on scroll as the extended header does off Duo; extended also collapses
|
|
35
|
-
let progress = min(scroll / extendedCollapseDistance, 1)
|
|
36
|
-
gradient
|
|
37
|
-
.frame(height: headerHeight + (extended ? extendedGradientExtra * (1 - progress) : 0))
|
|
38
|
-
.opacity(1 - min(scroll / extendedGradientExtra, 1))
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
|
|
42
|
-
.ignoresSafeArea()
|
|
43
|
-
.allowsHitTesting(false)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/// The fade spans the gradient box.
|
|
47
|
-
private var gradient: LinearGradient {
|
|
48
|
-
LinearGradient(
|
|
49
|
-
colors: [theme.colors.gradient, theme.colors.gradient.opacity(0)],
|
|
50
|
-
startPoint: .top,
|
|
51
|
-
endPoint: .bottom
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
}
|