@momo-kits/native-kits 0.169.10-beta.1-debug → 0.169.10

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.
Files changed (189) hide show
  1. package/ios/Application/DesignSystemKits.swift +2 -3
  2. package/ios/Application/LanguageSource.swift +2 -3
  3. package/ios/Application/Localize.swift +4 -7
  4. package/ios/Application/LocalizeModifier.swift +2 -3
  5. package/ios/Badge/Badge.swift +5 -7
  6. package/ios/Button/Button.swift +2 -3
  7. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +3 -5
  8. package/ios/Carousel/Carousel.swift +2 -3
  9. package/ios/Collapse/Collapse.swift +17 -11
  10. package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
  11. package/ios/Icon/Icon.swift +2 -3
  12. package/ios/IconButton/IconButton.swift +2 -3
  13. package/ios/Input/InputSearch.swift +6 -23
  14. package/ios/Layout/ModalLayout.swift +2 -3
  15. package/ios/Layout/ScreenLayout.swift +10 -12
  16. package/ios/Layout/Section.swift +2 -3
  17. package/ios/Navigation/BottomSheet.swift +6 -9
  18. package/ios/Navigation/BottomTab/BottomTab.swift +6 -9
  19. package/ios/Navigation/BottomTab/BottomTabBar.swift +4 -6
  20. package/ios/Navigation/BottomTab/CurvedContainer.swift +2 -3
  21. package/ios/Navigation/BottomTab/DuoBarCompression.swift +2 -3
  22. package/ios/Navigation/BottomTab/DuoTabBar.swift +6 -6
  23. package/ios/Navigation/BottomTab/TabBarMetrics.swift +4 -6
  24. package/ios/Navigation/Component/Header.swift +46 -31
  25. package/ios/Navigation/Component/HeaderJourney.swift +1 -2
  26. package/ios/Navigation/Component/HeaderLocation.swift +1 -2
  27. package/ios/Navigation/Component/HeaderRight.swift +15 -18
  28. package/ios/Navigation/Component/HeaderUser.swift +1 -2
  29. package/ios/Navigation/Component/SideBar.swift +15 -7
  30. package/ios/Navigation/HostBackGestureBridge.swift +2 -3
  31. package/ios/Navigation/ModalScreen.swift +13 -11
  32. package/ios/Navigation/Navigation.swift +3 -9
  33. package/ios/Navigation/NavigationContainer.swift +4 -6
  34. package/ios/Navigation/Navigator.swift +12 -18
  35. package/ios/Navigation/StackScreen.swift +25 -40
  36. package/ios/Navigation/StackTransition.swift +7 -6
  37. package/ios/Skeleton/Skeleton.swift +3 -6
  38. package/ios/Steps/Steps.swift +20 -15
  39. package/ios/TabView/TabView.swift +2 -3
  40. package/ios/Title/Title.swift +1 -3
  41. package/ios/Typography/FontScale.swift +6 -9
  42. package/ios/Typography/Text.swift +2 -3
  43. package/ios/Typography/Typography.swift +3 -4
  44. package/ios/native-kits.podspec +1 -1
  45. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  46. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +2 -11
  47. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -11
  48. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +1 -1
  49. package/package.json +1 -1
  50. package/build.gradle.kts +0 -11
  51. package/compose/build.gradle.kts +0 -198
  52. package/compose/compose.podspec +0 -47
  53. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  54. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  55. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  56. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  57. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -154
  58. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
  59. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1067
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -267
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -482
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -224
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -195
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -473
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -113
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -263
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -228
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -280
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -183
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -40
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -82
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -39
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -363
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -307
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -88
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -306
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -457
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -205
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -89
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -542
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -120
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -201
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -210
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -12
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -292
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +0 -67
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -184
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -316
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -397
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -153
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -118
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -747
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -242
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -400
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -100
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -207
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -132
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -167
  153. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -446
  154. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
  155. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  156. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  157. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -398
  158. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  159. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  160. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -197
  161. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  162. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  163. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  164. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -114
  165. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  166. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -76
  167. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
  168. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -22
  169. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  170. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  171. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  172. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  173. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  174. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  175. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  176. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  177. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  178. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -218
  179. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
  180. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -144
  181. package/gradle/libs.versions.toml +0 -67
  182. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  183. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  184. package/gradle.properties +0 -24
  185. package/gradlew +0 -252
  186. package/gradlew.bat +0 -94
  187. package/ios/Layout/HeaderLayout.swift +0 -67
  188. package/ios-demo/README.md +0 -120
  189. package/settings.gradle.kts +0 -64
@@ -1,144 +0,0 @@
1
- package vn.momo.kits.platform
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.DisposableEffect
5
- import androidx.compose.runtime.getValue
6
- import androidx.compose.runtime.mutableStateOf
7
- import androidx.compose.runtime.remember
8
- import androidx.compose.runtime.setValue
9
- import androidx.compose.ui.uikit.LocalUIViewController
10
- import androidx.compose.ui.unit.dp
11
- import kotlinx.cinterop.BetaInteropApi
12
- import kotlinx.cinterop.CFunction
13
- import kotlinx.cinterop.COpaquePointer
14
- import kotlinx.cinterop.ExperimentalForeignApi
15
- import kotlinx.cinterop.interpretCPointer
16
- import kotlinx.cinterop.interpretObjCPointer
17
- import kotlinx.cinterop.interpretObjCPointerOrNull
18
- import kotlinx.cinterop.invoke
19
- import kotlinx.cinterop.objcPtr
20
- import kotlinx.cinterop.reinterpret
21
- import kotlinx.cinterop.readValue
22
- import kotlinx.cinterop.useContents
23
- import platform.CoreGraphics.CGRectZero
24
- import platform.Foundation.NSArray
25
- import platform.Foundation.NSSelectorFromString
26
- import platform.Foundation.NSValue
27
- import platform.Foundation.valueForKey
28
- import platform.UIKit.CGRectValue
29
- import platform.UIKit.UIView
30
- import platform.UIKit.UIViewAutoresizingFlexibleHeight
31
- import platform.UIKit.UIViewAutoresizingFlexibleWidth
32
- import platform.darwin.NSObject
33
- import platform.Foundation.NSClassFromString
34
- import platform.posix.RTLD_DEFAULT
35
- import platform.posix.dlsym
36
-
37
- // The API is newer than the SDK Kotlin/Native binds, so it is reached through the runtime.
38
- @OptIn(ExperimentalForeignApi::class)
39
- private val regionsOfKind = NSSelectorFromString("reservedRegionsOfKind:")
40
-
41
- @OptIn(ExperimentalForeignApi::class)
42
- private val regionsOfKindOptions = NSSelectorFromString("reservedRegionsOfKind:options:")
43
-
44
- // a hinge never goes away, so a positive answer is kept for every later container
45
- private var isKnownFoldable = false
46
-
47
- @OptIn(ExperimentalForeignApi::class, BetaInteropApi::class)
48
- private fun regionKind(name: String): Any? {
49
- // a class object fails `as? NSObjectProtocol` (K/N checks it as an instance), so it is reinterpreted
50
- val kindClass = NSClassFromString("UIViewReservedRegionKind")
51
- ?.let { interpretObjCPointer<NSObject>(it.objcPtr()) } ?: return null
52
- return kindClass.performSelector(NSSelectorFromString(name))
53
- }
54
-
55
- // performSelector cannot pass the NSUInteger options, so objc_msgSend is called with the method's own signature.
56
- @OptIn(ExperimentalForeignApi::class)
57
- private val msgSendRegionsOfKindOptions = dlsym(RTLD_DEFAULT, "objc_msgSend")
58
- ?.reinterpret<CFunction<(COpaquePointer?, COpaquePointer?, COpaquePointer?, ULong) -> COpaquePointer?>>()
59
-
60
- // Apple's foldable check: only a device with a hinge reports a `.division` region, inactive while
61
- // flat (UIViewReservedRegionQueryOptionsIncludeInactive) but still there. Screen size cannot tell it
62
- // apart from a large iPhone in landscape or a narrowed window.
63
- @OptIn(ExperimentalForeignApi::class)
64
- private fun UIView.hasDivisionRegion(): Boolean {
65
- if (window == null || !respondsToSelector(regionsOfKindOptions)) return false
66
- val msgSend = msgSendRegionsOfKindOptions ?: return false
67
- val kind = regionKind("divisionRegionKind") as? NSObject ?: return false
68
- val result = msgSend(
69
- interpretCPointer(objcPtr()),
70
- regionsOfKindOptions,
71
- interpretCPointer(kind.objcPtr()),
72
- 1uL,
73
- )
74
- val regions = interpretObjCPointerOrNull<NSArray>(result?.rawValue ?: return false)
75
- return (regions?.count ?: 0uL) > 0uL
76
- }
77
-
78
- // Active regions only: a division region is active while the device is half folded.
79
- @OptIn(ExperimentalForeignApi::class)
80
- private fun UIView.activeRegions(kindName: String, target: UIView): List<ReservedRegion> {
81
- if (window == null || !respondsToSelector(regionsOfKind)) return emptyList()
82
- val kind = regionKind(kindName) ?: return emptyList()
83
- val regions = when (val result = performSelector(regionsOfKind, withObject = kind)) {
84
- is List<*> -> result
85
- is NSArray -> List(result.count.toInt()) { result.objectAtIndex(it.toULong()) }
86
- else -> return emptyList()
87
- }
88
- return regions.mapNotNull { region ->
89
- val frame = ((region as? NSObject)?.valueForKey("frame") as? NSValue)?.CGRectValue ?: return@mapNotNull null
90
- convertRect(frame, toView = target).useContents {
91
- ReservedRegion(origin.x.dp, origin.y.dp, size.width.dp, size.height.dp)
92
- }
93
- }
94
- }
95
-
96
- // Invisible full-size probe: reading the regions in layoutSubviews makes UIKit run it again
97
- // when they change, so nothing polls.
98
- @OptIn(ExperimentalForeignApi::class)
99
- private class ReservedRegionsProbe(
100
- private val onChange: (ReservedRegions) -> Unit,
101
- ) : UIView(frame = CGRectZero.readValue()) {
102
- private var last: ReservedRegions? = null
103
-
104
- init {
105
- userInteractionEnabled = false
106
- autoresizingMask = UIViewAutoresizingFlexibleWidth or UIViewAutoresizingFlexibleHeight
107
- }
108
-
109
- override fun layoutSubviews() {
110
- super.layoutSubviews()
111
- // re-read until found: the window may not report the hinge on the first pass
112
- if (!isKnownFoldable) isKnownFoldable = hasDivisionRegion()
113
- val host = superview
114
- val regions = ReservedRegions(
115
- occlusion = host?.let { activeRegions("occlusionRegionKind", it) } ?: emptyList(),
116
- isFoldable = isKnownFoldable,
117
- division = host?.takeIf { isKnownFoldable }?.let { activeRegions("divisionRegionKind", it).firstOrNull() },
118
- )
119
- if (regions != last) {
120
- last = regions
121
- onChange(regions)
122
- }
123
- }
124
-
125
- override fun didMoveToWindow() {
126
- super.didMoveToWindow()
127
- setNeedsLayout()
128
- }
129
- }
130
-
131
- @OptIn(ExperimentalForeignApi::class)
132
- @Composable
133
- internal actual fun rememberReservedRegions(): ReservedRegions {
134
- if (!isPhoneIdiom()) return ReservedRegions()
135
- val host = LocalUIViewController.current.view
136
- var regions by remember { mutableStateOf(ReservedRegions(isFoldable = isKnownFoldable)) }
137
- DisposableEffect(host) {
138
- val probe = ReservedRegionsProbe { regions = it }
139
- probe.setFrame(host.bounds)
140
- host.insertSubview(probe, atIndex = 0)
141
- onDispose { probe.removeFromSuperview() }
142
- }
143
- return regions
144
- }
@@ -1,67 +0,0 @@
1
- [versions]
2
- android-compileSdk = "37"
3
- android-minSdk = "24"
4
- android-targetSdk = "36"
5
- ktor-version = "3.0.0-rc-1"
6
- coroutines = "1.9.0"
7
- kotlin = "2.3.10"
8
- kSerialize = "1.7.1"
9
- compose = "1.10.3"
10
- navigation-multiplatform = "2.9.2"
11
- coil3-multiplatform = "3.0.0-alpha10"
12
- androidGradlePlugin = "8.13.2"
13
- r8 = "8.9.35"
14
- kotlinx-datetime = "0.7.1"
15
- airbnb-lottie = "5.2.0"
16
- compottie = "2.1.0"
17
- androidx-activity = "1.9.1"
18
- androidx-appcompat = "1.7.0"
19
- material = "1.10.0"
20
- maxapi = "0.1.1"
21
- vanniktechMavenPublish = "0.34.0"
22
- kits = "0.167.1-duo.1"
23
- nativemaxapi = "0.0.6"
24
- gif-image = "0.1.2"
25
-
26
- [libraries]
27
- ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor-version" }
28
- ktor-client-darwin = { group = "io.ktor", name = "ktor-client-darwin", version.ref = "ktor-version" }
29
- ktor-client-okhttp = { group = "io.ktor", name = "ktor-client-okhttp", version.ref = "ktor-version" }
30
- jetbrains-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
31
- jetbrains-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
32
- jetbrains-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }
33
- jetbrains-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization", version.ref = "kSerialize" }
34
- jetbrains-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kSerialize" }
35
- kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinx-datetime" }
36
- compose-ui-backhandler = { module = "org.jetbrains.compose.ui:ui-backhandler", version.ref = "compose" }
37
- navigation-multiplatform = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigation-multiplatform" }
38
- coil-multiplatform-core = { module = "io.coil-kt.coil3:coil-core", version.ref = "coil3-multiplatform" }
39
- coil-multiplatform-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil3-multiplatform" }
40
- coil-multiplatform-network-ktor = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coil3-multiplatform" }
41
- r8 = { module = "com.android.tools:r8", version.ref = "r8" }
42
- airbnb-lottie = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "airbnb-lottie" }
43
- # Depend on compottie-core (not the `compottie` umbrella). The umbrella drags in the
44
- # separate `keight` umbrella artifact, which collides with `keight-core` on the
45
- # `findRoot__at__ScriptRuntime` symbol (duplicate symbol at the iOS `ld` link of
46
- # shared.framework). compottie-core pulls only `keight-core` (which declares
47
- # keight.js.JsAny, so the earlier unlinked-symbol error stays fixed too).
48
- compottie = { module = "io.github.alexzhirkevich:compottie-core", version.ref = "compottie" }
49
- native-max-api = { group = "vn.momo.maxapi", name = "NativeMaxApi", version.ref = "nativemaxapi" }
50
- kits = { module = "vn.momo.kits:kits", version.ref = "kits" }
51
- androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
52
- androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
53
- material = { module = "com.google.android.material:material", version.ref = "material" }
54
-
55
- gif-image = { module = "vn.momo.kits:gif-image", version.ref = "gif-image" }
56
- [plugins]
57
- jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
58
- jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
59
- jetbrains-kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
60
- jetbrains-kotlin-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
61
- jetbrains-kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
62
- jetbrains-kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
63
- kotlin-compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
64
- compose = { id = "org.jetbrains.compose", version.ref = "compose" }
65
- android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
66
- android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
67
- vanniktech-mavenPublish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktechMavenPublish" }
Binary file
@@ -1,8 +0,0 @@
1
- #Thu Jul 31 17:05:40 ICT 2025
2
- distributionBase=GRADLE_USER_HOME
3
- distributionPath=wrapper/dists
4
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
5
- networkTimeout=10000
6
- validateDistributionUrl=true
7
- zipStoreBase=GRADLE_USER_HOME
8
- zipStorePath=wrapper/dists
package/gradle.properties DELETED
@@ -1,24 +0,0 @@
1
- #Kotlin
2
- kotlin.code.style=official
3
- kotlin.daemon.jvmargs=-Xmx6144M
4
-
5
- #Gradle
6
- org.gradle.jvmargs=-Xmx8192M -Dfile.encoding=UTF-8
7
- org.gradle.configuration-cache=false
8
- org.gradle.caching=true
9
-
10
- #Android
11
- android.nonTransitiveRClass=true
12
- android.useAndroidX=true
13
-
14
- #KMP
15
- kotlin.apple.xcodeCompatibility.nowarn=true
16
-
17
- # Publishing
18
- name="ComposeKits"
19
- group=vn.momo.kits
20
- artifact.id=kits
21
- version=0.169.10-beta.1
22
-
23
- repo=GitLab
24
- url=https://artifacts.mservice.com.vn/repository/maven-momo-app/
package/gradlew DELETED
@@ -1,252 +0,0 @@
1
- #!/bin/sh
2
-
3
- #
4
- # Copyright © 2015-2021 the original authors.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # https://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
- # SPDX-License-Identifier: Apache-2.0
19
- #
20
-
21
- ##############################################################################
22
- #
23
- # Gradle start up script for POSIX generated by Gradle.
24
- #
25
- # Important for running:
26
- #
27
- # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
- # noncompliant, but you have some other compliant shell such as ksh or
29
- # bash, then to run this script, type that shell name before the whole
30
- # command line, like:
31
- #
32
- # ksh Gradle
33
- #
34
- # Busybox and similar reduced shells will NOT work, because this script
35
- # requires all of these POSIX shell features:
36
- # * functions;
37
- # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
- # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
- # * compound commands having a testable exit status, especially «case»;
40
- # * various built-in commands including «command», «set», and «ulimit».
41
- #
42
- # Important for patching:
43
- #
44
- # (2) This script targets any POSIX shell, so it avoids extensions provided
45
- # by Bash, Ksh, etc; in particular arrays are avoided.
46
- #
47
- # The "traditional" practice of packing multiple parameters into a
48
- # space-separated string is a well documented source of bugs and security
49
- # problems, so this is (mostly) avoided, by progressively accumulating
50
- # options in "$@", and eventually passing that to Java.
51
- #
52
- # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
- # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54
- # see the in-line comments for details.
55
- #
56
- # There are tweaks for specific operating systems such as AIX, CygWin,
57
- # Darwin, MinGW, and NonStop.
58
- #
59
- # (3) This script is generated from the Groovy template
60
- # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
- # within the Gradle project.
62
- #
63
- # You can find Gradle at https://github.com/gradle/gradle/.
64
- #
65
- ##############################################################################
66
-
67
- # Attempt to set APP_HOME
68
-
69
- # Resolve links: $0 may be a link
70
- app_path=$0
71
-
72
- # Need this for daisy-chained symlinks.
73
- while
74
- APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75
- [ -h "$app_path" ]
76
- do
77
- ls=$( ls -ld "$app_path" )
78
- link=${ls#*' -> '}
79
- case $link in #(
80
- /*) app_path=$link ;; #(
81
- *) app_path=$APP_HOME$link ;;
82
- esac
83
- done
84
-
85
- # This is normally unused
86
- # shellcheck disable=SC2034
87
- APP_BASE_NAME=${0##*/}
88
- # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
- APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90
- ' "$PWD" ) || exit
91
-
92
- # Use the maximum available, or set MAX_FD != -1 to use that value.
93
- MAX_FD=maximum
94
-
95
- warn () {
96
- echo "$*"
97
- } >&2
98
-
99
- die () {
100
- echo
101
- echo "$*"
102
- echo
103
- exit 1
104
- } >&2
105
-
106
- # OS specific support (must be 'true' or 'false').
107
- cygwin=false
108
- msys=false
109
- darwin=false
110
- nonstop=false
111
- case "$( uname )" in #(
112
- CYGWIN* ) cygwin=true ;; #(
113
- Darwin* ) darwin=true ;; #(
114
- MSYS* | MINGW* ) msys=true ;; #(
115
- NONSTOP* ) nonstop=true ;;
116
- esac
117
-
118
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
119
-
120
-
121
- # Determine the Java command to use to start the JVM.
122
- if [ -n "$JAVA_HOME" ] ; then
123
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
124
- # IBM's JDK on AIX uses strange locations for the executables
125
- JAVACMD=$JAVA_HOME/jre/sh/java
126
- else
127
- JAVACMD=$JAVA_HOME/bin/java
128
- fi
129
- if [ ! -x "$JAVACMD" ] ; then
130
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
131
-
132
- Please set the JAVA_HOME variable in your environment to match the
133
- location of your Java installation."
134
- fi
135
- else
136
- JAVACMD=java
137
- if ! command -v java >/dev/null 2>&1
138
- then
139
- die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
140
-
141
- Please set the JAVA_HOME variable in your environment to match the
142
- location of your Java installation."
143
- fi
144
- fi
145
-
146
- # Increase the maximum file descriptors if we can.
147
- if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
148
- case $MAX_FD in #(
149
- max*)
150
- # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
151
- # shellcheck disable=SC2039,SC3045
152
- MAX_FD=$( ulimit -H -n ) ||
153
- warn "Could not query maximum file descriptor limit"
154
- esac
155
- case $MAX_FD in #(
156
- '' | soft) :;; #(
157
- *)
158
- # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
159
- # shellcheck disable=SC2039,SC3045
160
- ulimit -n "$MAX_FD" ||
161
- warn "Could not set maximum file descriptor limit to $MAX_FD"
162
- esac
163
- fi
164
-
165
- # Collect all arguments for the java command, stacking in reverse order:
166
- # * args from the command line
167
- # * the main class name
168
- # * -classpath
169
- # * -D...appname settings
170
- # * --module-path (only if needed)
171
- # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
172
-
173
- # For Cygwin or MSYS, switch paths to Windows format before running java
174
- if "$cygwin" || "$msys" ; then
175
- APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
176
- CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
177
-
178
- JAVACMD=$( cygpath --unix "$JAVACMD" )
179
-
180
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
181
- for arg do
182
- if
183
- case $arg in #(
184
- -*) false ;; # don't mess with options #(
185
- /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
186
- [ -e "$t" ] ;; #(
187
- *) false ;;
188
- esac
189
- then
190
- arg=$( cygpath --path --ignore --mixed "$arg" )
191
- fi
192
- # Roll the args list around exactly as many times as the number of
193
- # args, so each arg winds up back in the position where it started, but
194
- # possibly modified.
195
- #
196
- # NB: a `for` loop captures its iteration list before it begins, so
197
- # changing the positional parameters here affects neither the number of
198
- # iterations, nor the values presented in `arg`.
199
- shift # remove old arg
200
- set -- "$@" "$arg" # push replacement arg
201
- done
202
- fi
203
-
204
-
205
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
206
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207
-
208
- # Collect all arguments for the java command:
209
- # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210
- # and any embedded shellness will be escaped.
211
- # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212
- # treated as '${Hostname}' itself on the command line.
213
-
214
- set -- \
215
- "-Dorg.gradle.appname=$APP_BASE_NAME" \
216
- -classpath "$CLASSPATH" \
217
- org.gradle.wrapper.GradleWrapperMain \
218
- "$@"
219
-
220
- # Stop when "xargs" is not available.
221
- if ! command -v xargs >/dev/null 2>&1
222
- then
223
- die "xargs is not available"
224
- fi
225
-
226
- # Use "xargs" to parse quoted args.
227
- #
228
- # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
229
- #
230
- # In Bash we could simply go:
231
- #
232
- # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
233
- # set -- "${ARGS[@]}" "$@"
234
- #
235
- # but POSIX shell has neither arrays nor command substitution, so instead we
236
- # post-process each arg (as a line of input to sed) to backslash-escape any
237
- # character that might be a shell metacharacter, then use eval to reverse
238
- # that process (while maintaining the separation between arguments), and wrap
239
- # the whole thing up as a single "set" statement.
240
- #
241
- # This will of course break if any of these variables contains a newline or
242
- # an unmatched quote.
243
- #
244
-
245
- eval "set -- $(
246
- printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
247
- xargs -n1 |
248
- sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
249
- tr '\n' ' '
250
- )" '"$@"'
251
-
252
- exec "$JAVACMD" "$@"
package/gradlew.bat DELETED
@@ -1,94 +0,0 @@
1
- @rem
2
- @rem Copyright 2015 the original author or authors.
3
- @rem
4
- @rem Licensed under the Apache License, Version 2.0 (the "License");
5
- @rem you may not use this file except in compliance with the License.
6
- @rem You may obtain a copy of the License at
7
- @rem
8
- @rem https://www.apache.org/licenses/LICENSE-2.0
9
- @rem
10
- @rem Unless required by applicable law or agreed to in writing, software
11
- @rem distributed under the License is distributed on an "AS IS" BASIS,
12
- @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- @rem See the License for the specific language governing permissions and
14
- @rem limitations under the License.
15
- @rem
16
- @rem SPDX-License-Identifier: Apache-2.0
17
- @rem
18
-
19
- @if "%DEBUG%"=="" @echo off
20
- @rem ##########################################################################
21
- @rem
22
- @rem Gradle startup script for Windows
23
- @rem
24
- @rem ##########################################################################
25
-
26
- @rem Set local scope for the variables with windows NT shell
27
- if "%OS%"=="Windows_NT" setlocal
28
-
29
- set DIRNAME=%~dp0
30
- if "%DIRNAME%"=="" set DIRNAME=.
31
- @rem This is normally unused
32
- set APP_BASE_NAME=%~n0
33
- set APP_HOME=%DIRNAME%
34
-
35
- @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36
- for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37
-
38
- @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39
- set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40
-
41
- @rem Find java.exe
42
- if defined JAVA_HOME goto findJavaFromJavaHome
43
-
44
- set JAVA_EXE=java.exe
45
- %JAVA_EXE% -version >NUL 2>&1
46
- if %ERRORLEVEL% equ 0 goto execute
47
-
48
- echo. 1>&2
49
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50
- echo. 1>&2
51
- echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52
- echo location of your Java installation. 1>&2
53
-
54
- goto fail
55
-
56
- :findJavaFromJavaHome
57
- set JAVA_HOME=%JAVA_HOME:"=%
58
- set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59
-
60
- if exist "%JAVA_EXE%" goto execute
61
-
62
- echo. 1>&2
63
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64
- echo. 1>&2
65
- echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66
- echo location of your Java installation. 1>&2
67
-
68
- goto fail
69
-
70
- :execute
71
- @rem Setup the command line
72
-
73
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74
-
75
-
76
- @rem Execute Gradle
77
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78
-
79
- :end
80
- @rem End local scope for the variables with windows NT shell
81
- if %ERRORLEVEL% equ 0 goto mainEnd
82
-
83
- :fail
84
- rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85
- rem the _cmd.exe /c_ return code!
86
- set EXIT_CODE=%ERRORLEVEL%
87
- if %EXIT_CODE% equ 0 set EXIT_CODE=1
88
- if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89
- exit /b %EXIT_CODE%
90
-
91
- :mainEnd
92
- if "%OS%"=="Windows_NT" endlocal
93
-
94
- :omega
@@ -1,67 +0,0 @@
1
- // Top navigation spec (Figma "Top Navigation · Màn hình gập"). Mirrors Compose `layout/HeaderLayout.kt`
2
- // and RN; keep the three in sync.
3
-
4
- import SwiftUI
5
-
6
- /// Header spec values, in points. Public so custom header rights and extensions can match them.
7
- public enum HeaderLayoutMetrics {
8
- public static let buttonSize: CGFloat = 32
9
- public static let iconSize: CGFloat = 20
10
- public static let pillWidth: CGFloat = 72
11
- public static let searchHeight: CGFloat = 32
12
- public static let titleGap: CGFloat = Spacing.S
13
- public static let sidePadding: CGFloat = Spacing.M
14
- /// shortcut + gap + help/home pill
15
- public static let clusterWidth: CGFloat = buttonSize + titleGap + pillWidth
16
- public static let frameMaxWidth: CGFloat = 600
17
- /// Banner image width on every device: wide windows keep the phone size, centered.
18
- public static let bannerWidth: CGFloat = 375
19
- }
20
-
21
- /// How a screen lays out its content on wide windows; the header row follows it.
22
- public enum ContentLayout: Equatable {
23
- /// 12 column grid: the header keeps the 12pt side padding.
24
- case grid
25
- /// One column of at most `HeaderLayoutMetrics.frameMaxWidth`, centered: the header row sits in the same frame.
26
- case stretch
27
- }
28
-
29
- /// Header geometry for a window; see `ScreenLayout.headerLayout(_:)`.
30
- public struct HeaderLayout: Equatable {
31
- /// Short side >= 600, iPhone Duo excluded (it has its own layout).
32
- public let isWide: Bool
33
- /// Banner kept at `HeaderLayoutMetrics.bannerWidth`, centered: wide windows plus the iPhone Duo inner display.
34
- public let isBannerCentered: Bool
35
- /// Padding from each side of the safe area to the header row (back, title / search, right cluster).
36
- public let frameInset: CGFloat
37
- /// Width of the header row, so tabs and other header extensions can line up with it.
38
- public let frameWidth: CGFloat
39
- }
40
-
41
- public extension ScreenLayout {
42
- func headerLayout(_ contentLayout: ContentLayout = .grid) -> HeaderLayout {
43
- let isLargeWindow = min(width, height) >= ModalMetrics.foldableMinWidth
44
- let isWide = !isIPhoneDuo && !isDuoDevice && isLargeWindow
45
- let safeWidth = width - insets.leading - insets.trailing
46
- let frameInset = isWide && contentLayout == .stretch
47
- ? max(HeaderLayoutMetrics.sidePadding, (safeWidth - HeaderLayoutMetrics.frameMaxWidth) / 2)
48
- : HeaderLayoutMetrics.sidePadding
49
- return HeaderLayout(
50
- isWide: isWide,
51
- isBannerCentered: isLargeWindow,
52
- frameInset: frameInset,
53
- frameWidth: safeWidth - frameInset * 2)
54
- }
55
- }
56
-
57
- private struct ContentLayoutKey: EnvironmentKey {
58
- static let defaultValue: ContentLayout = .grid
59
- }
60
-
61
- public extension EnvironmentValues {
62
- /// The enclosing screen's `NavigationOptions.contentLayout`, set by `StackScreen`.
63
- var contentLayout: ContentLayout {
64
- get { self[ContentLayoutKey.self] }
65
- set { self[ContentLayoutKey.self] = newValue }
66
- }
67
- }