@momo-kits/native-kits 0.168.1-beta.37-debug → 0.168.1-beta.38-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 +2 -3
- package/compose/build.gradle.kts +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +81 -72
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +13 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +163 -54
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +12 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +4 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +18 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +34 -27
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +319 -167
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +79 -71
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +93 -326
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -2
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +3 -2
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +3 -9
- package/ios/Input/Input.swift +1 -3
- package/ios/Input/InputTextArea.swift +1 -3
- package/ios/Layout/ScreenLayout.swift +24 -28
- package/ios/Navigation/BottomSheet.swift +157 -29
- package/ios/Navigation/BottomTab/BottomTab.swift +48 -67
- package/ios/Navigation/BottomTab/BottomTabBar.swift +280 -132
- package/ios/Navigation/BottomTab/CurvedContainer.swift +51 -47
- package/ios/Navigation/BottomTab/DuoTabBar.swift +72 -292
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +84 -0
- package/ios/Navigation/Component/HeaderRight.swift +1 -1
- package/ios/Navigation/ModalScreen.swift +7 -18
- package/ios/Navigation/StackScreen.swift +3 -1
- package/ios/Popup/PopupDisplay.swift +2 -4
- package/ios/Popup/PopupInput.swift +2 -4
- package/ios/Popup/PopupLayout.swift +9 -10
- package/ios/Popup/PopupNotify.swift +23 -26
- package/ios-demo/Resources/tabbar_scan_qr_button.json +1 -0
- package/ios-demo/Resources/tabbar_scan_qr_label.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +272 -59
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -103
- package/package.json +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +0 -187
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoLiquidSelection.kt +0 -380
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
- package/ios/Layout/ModalLayout.swift +0 -152
- package/ios/Navigation/BottomTab/DuoLiquidSelection.swift +0 -364
package/CLAUDE.md
CHANGED
|
@@ -77,12 +77,11 @@ Publishing is automated (`publish.sh` + GitLab CI on `[ci build]` / `main`). Do
|
|
|
77
77
|
- iPhone Duo with a side strip ≥ 60pt: back + toolkit leave the bar for `HeaderSideBar` (`navigation/component/SideBar.kt`, 48pt glass controls); custom header-right stays in the bar. `sideBar.top` is 170pt in portrait, 120pt on the inner display in landscape (height ≥ 600), 24pt on the outer display in landscape, or below the header when the status bar is on top; UIKit's `statusBarFrame` is useless on Duo. Unlike RN the column is clamped above footer (24pt gap) / rail (12pt gap).
|
|
78
78
|
- Reserved regions (iOS 27.1 `reservedRegionsOfKind:`, reached through the ObjC runtime so older SDKs still build): a probe `UIView` (`platform/ReservedRegions.ios.kt` on the Compose root view; `ReservedRegionsProbe` inside SwiftUI `momoScreenLayout()`) re-reads them in `layoutSubviews`, which UIKit re-runs when they change. They push `sideBar.top` below the status cluster as it grows for calls / Live Activities, and `sideBar.bottom` (≥ 24pt) above a camera at the bottom end of the strip.
|
|
79
79
|
- Tab bar on Duo is `bottomtab/DuoTabBar.kt`: a rail in the side strip (`sideBar.bottom` above the window bottom, QR below it) or, without a side bar, a floating bar spanning 6/8 grid columns. Both overlay the content; `duoFloatingTabBarInset` pads tab content, footer and FAB.
|
|
80
|
-
- Duo tab selection motion (`bottomtab/DuoLiquidSelection.kt` / `ios/Navigation/BottomTab/DuoLiquidSelection.swift`, port of RN `useLiquidSelection.ts`, momo-kits !682): press lifts the lens, a drag past 10pt takes over (Compose: the bar's `pointerInput` consumes and so cancels the tab's clickable; SwiftUI: one `DragGesture` over the bar, tabs are not `Button`s), long press calls `BottomTab(onTabLongPress)` and release still selects, Reduce Motion (`platform/ReduceMotion`) falls back to a plain slide. SwiftUI integrates the lens spring on a display link because the stretch and the tabs' active tint read it every frame. Constants mirror RN — change both together.
|
|
81
80
|
- Bar compression (`bottomtab/DuoBarCompression.kt`, HIG "Vertical controls"): when toolbar + rail don't fit in the strip, one is compressed — the toolkit into a `navigation_menu` button, the rail into one button showing the current tab — and tapping it swaps them; `BottomTab(compressionBehavior)` picks which starts compressed. If neither fits beside the other compressed, both rest compressed and a tap opens one for a moment. Side bar columns report their full height (0 when the screen puts nothing there) so the decision follows each screen's toolkit.
|
|
82
81
|
- Glass header: on Duo with a side bar, Default/Extended headers without search and with a `ScrollState` let content scroll under the bar (`usesDuoGlassHeader`); the bar fades in a translucent surface + hairline over 16pt (Compose has no backdrop blur — RN's fallback look), the gradient leaves with the content.
|
|
83
82
|
- Quick return header: glass headers and Animated headers (with a `ScrollState`) on the Duo side bar layout slide out with the content and back in on a reverse scroll; a half-shown header settles in or out once the scroll stops. The side bar is drawn apart from the header, so it stays put.
|
|
84
|
-
- Overlays on
|
|
85
|
-
- Bottom sheet on Duo:
|
|
83
|
+
- Overlays on Duo: the modal sits inside the safe area (all four insets, so clear of the side toolbar strip) and caps its content at `duoModalMaxWidth` / `duoModalMaxHeight` (440 × 640pt, at least XL off the safe area); popups fill that width with radius XL and drop their own side padding (body scrolls, actions stay). Snackbars keep clear of the strip.
|
|
84
|
+
- Bottom sheet on Duo: radius XL, window height less `duoTopInset` (it never passes the side status bar: unlike RN, nothing restyles the clock over it), centered when the short side ≥ 600 (inner display in either orientation, buttons stay in the header row; RN parity). Below that (outer display, landscape too) it floats `Spacing.M` off the side edges, pads header/content/footer by `inset − M` (the drag indicator still centers on the whole sheet), and a `Title` header moves back / close into 48pt side bar buttons on the strip part of the sheet (HIG: sheet controls go vertical on the outer display) when the strip fits one; they follow the header row while the sheet is short and stay below `sideBar.top` when it is tall. `BottomHeader.Title(onBack)` / `.title(onBack:)` closes the sheet, then runs (RN `leftOptions.onPressIconLeft`).
|
|
86
85
|
- Font scale deliberately uses the short side (`min(w, h)`), unlike RN which reads the window width — landscape must not inflate every font.
|
|
87
86
|
- Font scale measures the **window**, never `UIScreen.main`: on iPhone Duo the main screen stays on one display while the window follows the one in use. Compose iOS `getScreenDimensions()` reads `LocalWindowInfo.containerSize` (recomposes on fold/unfold); SwiftUI `DesignSystemKits` KVO-observes each `UIWindowScene.effectiveGeometry` and republishes `windowShortSide`.
|
|
88
87
|
- `StackScreen` pads content/footer/search/FAB by the side insets and provides an inset-consumed layout to its content; a bottom-tab root stays full width (tab bar + each tab's StackScreen handle insets). Grid columns use `contentWidth`.
|
package/compose/build.gradle.kts
CHANGED
|
@@ -88,10 +88,11 @@ actual fun LottieAnimation(
|
|
|
88
88
|
isPlaying: Boolean,
|
|
89
89
|
onEvent: ((String) -> Unit)?,
|
|
90
90
|
modifier: Modifier,
|
|
91
|
-
useCompose: Boolean
|
|
91
|
+
useCompose: Boolean,
|
|
92
|
+
progress: (() -> Float)?,
|
|
92
93
|
) {
|
|
93
94
|
if (useCompose) {
|
|
94
|
-
ComposeLottieAnimation(path, tintColor, bgColor, iterations, isPlaying, onEvent, modifier)
|
|
95
|
+
ComposeLottieAnimation(path, tintColor, bgColor, iterations, isPlaying, onEvent, modifier, progress)
|
|
95
96
|
return
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -2,6 +2,8 @@ package vn.momo.kits.components
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
|
+
import androidx.compose.foundation.clickable
|
|
6
|
+
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
5
7
|
import androidx.compose.foundation.rememberScrollState
|
|
6
8
|
import androidx.compose.foundation.verticalScroll
|
|
7
9
|
import androidx.compose.foundation.layout.*
|
|
@@ -20,9 +22,9 @@ import vn.momo.kits.application.LocalLocalize
|
|
|
20
22
|
import vn.momo.kits.const.*
|
|
21
23
|
import vn.momo.kits.modifier.conditional
|
|
22
24
|
import vn.momo.kits.modifier.setAutomationId
|
|
23
|
-
import vn.momo.kits.layout.
|
|
24
|
-
import vn.momo.kits.layout.
|
|
25
|
-
import vn.momo.kits.layout.
|
|
25
|
+
import vn.momo.kits.layout.duoModalMaxHeight
|
|
26
|
+
import vn.momo.kits.layout.duoModalMaxWidth
|
|
27
|
+
import vn.momo.kits.layout.getScreenLayout
|
|
26
28
|
import kotlin.math.min
|
|
27
29
|
|
|
28
30
|
data class PopupAction(
|
|
@@ -36,24 +38,28 @@ enum class PopupActionDirection {
|
|
|
36
38
|
AUTO
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
// Card width on
|
|
41
|
+
// Card width cap on iPhone Duo (the modal bounds, RN Popup/utils.ts); unbounded elsewhere.
|
|
40
42
|
@Composable
|
|
41
43
|
internal fun popupMaxWidth(): Dp {
|
|
42
|
-
val
|
|
43
|
-
return if (
|
|
44
|
+
val layout = getScreenLayout()
|
|
45
|
+
return if (layout.isIPhoneDuoDevice) layout.duoModalMaxWidth else Dp.Unspecified
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
// The
|
|
48
|
+
// The modal bounds already keep iPhone Duo popups off the edges, so their own side padding goes.
|
|
47
49
|
@Composable
|
|
48
50
|
internal fun popupHorizontalPadding(padding: Dp): Dp =
|
|
49
|
-
if (
|
|
51
|
+
if (getScreenLayout().isIPhoneDuoDevice) 0.dp else padding
|
|
50
52
|
|
|
51
|
-
// Tallest a popup gets on
|
|
53
|
+
// Tallest a popup gets on iPhone Duo, landscape and the inner display included; null elsewhere.
|
|
52
54
|
@Composable
|
|
53
|
-
internal fun popupMaxHeight(): Dp?
|
|
55
|
+
internal fun popupMaxHeight(): Dp? {
|
|
56
|
+
val layout = getScreenLayout()
|
|
57
|
+
return if (layout.isIPhoneDuoDevice) layout.duoModalMaxHeight else null
|
|
58
|
+
}
|
|
54
59
|
|
|
60
|
+
// Rounder on iPhone Duo, closer to its system alerts.
|
|
55
61
|
@Composable
|
|
56
|
-
internal fun popupRadius(): Dp =
|
|
62
|
+
internal fun popupRadius(): Dp = if (getScreenLayout().isIPhoneDuoDevice) Radius.XL else Radius.L
|
|
57
63
|
|
|
58
64
|
private fun heightForLines(
|
|
59
65
|
layout: TextLayoutResult,
|
|
@@ -146,21 +152,19 @@ fun PopupNotify(
|
|
|
146
152
|
callback?.invoke()
|
|
147
153
|
}
|
|
148
154
|
|
|
149
|
-
val
|
|
150
|
-
val
|
|
151
|
-
val
|
|
152
|
-
val shape = RoundedCornerShape(
|
|
155
|
+
val maxHeight = popupMaxHeight()
|
|
156
|
+
val bodyScrollState = rememberScrollState()
|
|
157
|
+
val horizontalPadding = popupHorizontalPadding(12.dp)
|
|
158
|
+
val shape = RoundedCornerShape(popupRadius())
|
|
153
159
|
|
|
154
160
|
Box(
|
|
155
|
-
Modifier
|
|
156
|
-
.widthIn(min = popup.minWidth, max = popup.maxWidth)
|
|
157
|
-
.fillMaxWidth()
|
|
158
|
-
.setAutomationId("popup_notify"),
|
|
159
|
-
contentAlignment = Alignment.TopEnd
|
|
161
|
+
Modifier.setAutomationId("popup_notify"), contentAlignment = Alignment.TopEnd
|
|
160
162
|
) {
|
|
161
163
|
Column(
|
|
162
164
|
modifier = Modifier
|
|
165
|
+
.widthIn(max = popupMaxWidth())
|
|
163
166
|
.fillMaxWidth()
|
|
167
|
+
.padding(horizontal = horizontalPadding)
|
|
164
168
|
.clip(shape)
|
|
165
169
|
.background(AppTheme.current.colors.background.surface, shape)
|
|
166
170
|
.conditional(IsShowBaseLineDebug) {
|
|
@@ -170,56 +174,37 @@ fun PopupNotify(
|
|
|
170
174
|
heightIn(max = maxHeight ?: Dp.Unspecified)
|
|
171
175
|
}
|
|
172
176
|
) {
|
|
173
|
-
|
|
174
|
-
Image(
|
|
175
|
-
source = props.image,
|
|
176
|
-
modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
|
|
177
|
-
options = Options(alignment = Alignment.Center)
|
|
178
|
-
)
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// with a max height only the description scrolls; image, title and actions stay
|
|
177
|
+
// scrolls when iPhone Duo landscape is too short; actions stay visible
|
|
182
178
|
Column(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
Modifier.conditional(maxHeight != null) {
|
|
180
|
+
weight(1f, fill = false).verticalScroll(bodyScrollState)
|
|
181
|
+
}
|
|
186
182
|
) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
padding(end = MODAL_ICON_BUTTON_SIZE + Spacing.M - Spacing.XL)
|
|
194
|
-
}
|
|
195
|
-
.setAutomationId("title_popup_permission")
|
|
196
|
-
)
|
|
197
|
-
if (maxHeight != null) {
|
|
198
|
-
// still capped at ~8.5 lines, then shrinks further when the popup reaches its max height
|
|
199
|
-
Box(
|
|
200
|
-
Modifier
|
|
201
|
-
.padding(top = Spacing.S)
|
|
202
|
-
.weight(1f, fill = false)
|
|
203
|
-
.conditional(isScroll) { heightIn(max = scrollHeight) }
|
|
204
|
-
.verticalScroll(descriptionScrollState)
|
|
205
|
-
) {
|
|
206
|
-
Text(
|
|
207
|
-
text = props.description,
|
|
208
|
-
onTextLayout = { layoutResult.value = it },
|
|
209
|
-
style = Typography.bodyDefaultRegular
|
|
210
|
-
)
|
|
211
|
-
}
|
|
212
|
-
} else {
|
|
213
|
-
content(Modifier.padding(top = Spacing.S))
|
|
183
|
+
if(props.image.isNotEmpty()) {
|
|
184
|
+
Image(
|
|
185
|
+
source = props.image,
|
|
186
|
+
modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
|
|
187
|
+
options = Options(alignment = Alignment.Center)
|
|
188
|
+
)
|
|
214
189
|
}
|
|
215
|
-
|
|
190
|
+
|
|
191
|
+
Column(modifier = Modifier.padding(Spacing.XL)) {
|
|
216
192
|
Text(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
modifier = Modifier.padding(top = Spacing.S)
|
|
193
|
+
style = Typography.headerDefaultBold,
|
|
194
|
+
maxLines = 2,
|
|
195
|
+
text = props.title,
|
|
196
|
+
modifier = Modifier.setAutomationId("title_popup_permission")
|
|
222
197
|
)
|
|
198
|
+
content(Modifier.padding(top = Spacing.S))
|
|
199
|
+
if (props.error.isNotEmpty()) {
|
|
200
|
+
Text(
|
|
201
|
+
text = LocalLocalize.current.translate("errorCode") + props.error,
|
|
202
|
+
style = Typography.descriptionXsRegular,
|
|
203
|
+
color = AppTheme.current.colors.text.hint,
|
|
204
|
+
maxLines = 1,
|
|
205
|
+
modifier = Modifier.padding(top = Spacing.S)
|
|
206
|
+
)
|
|
207
|
+
}
|
|
223
208
|
}
|
|
224
209
|
}
|
|
225
210
|
|
|
@@ -233,13 +218,37 @@ fun PopupNotify(
|
|
|
233
218
|
}
|
|
234
219
|
}
|
|
235
220
|
|
|
236
|
-
if
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
221
|
+
if(props.isShowCloseIcon) {
|
|
222
|
+
Box(
|
|
223
|
+
Modifier
|
|
224
|
+
.width(22.dp)
|
|
225
|
+
.height(22.dp)
|
|
226
|
+
// centered on the card's top right corner
|
|
227
|
+
.offset(x = 11.dp - horizontalPadding, y = (-11).dp)
|
|
228
|
+
.background(
|
|
229
|
+
color = AppTheme.current.colors.text.default,
|
|
230
|
+
shape = RoundedCornerShape(Radius.M)
|
|
231
|
+
)
|
|
232
|
+
.border(
|
|
233
|
+
width = 2.dp,
|
|
234
|
+
color = AppTheme.current.colors.background.surface,
|
|
235
|
+
shape = RoundedCornerShape(Radius.M)
|
|
236
|
+
)
|
|
237
|
+
.clip(RoundedCornerShape(100))
|
|
238
|
+
.clickable(
|
|
239
|
+
interactionSource = remember { MutableInteractionSource() },
|
|
240
|
+
indication = null,
|
|
241
|
+
onClick = { onClose { props.onIconClose() } }
|
|
242
|
+
),
|
|
243
|
+
contentAlignment = Alignment.Center
|
|
244
|
+
) {
|
|
245
|
+
Icon(
|
|
246
|
+
source = "navigation_close",
|
|
247
|
+
color = AppTheme.current.colors.background.surface,
|
|
248
|
+
size = 16.dp,
|
|
249
|
+
modifier = Modifier.setAutomationId("ic_popup_close")
|
|
250
|
+
)
|
|
251
|
+
}
|
|
243
252
|
}
|
|
244
253
|
}
|
|
245
254
|
}
|
|
@@ -10,7 +10,6 @@ import androidx.compose.ui.platform.LocalDensity
|
|
|
10
10
|
import androidx.compose.ui.platform.LocalLayoutDirection
|
|
11
11
|
import androidx.compose.ui.platform.LocalWindowInfo
|
|
12
12
|
import androidx.compose.ui.unit.Dp
|
|
13
|
-
import androidx.compose.ui.unit.DpRect
|
|
14
13
|
import androidx.compose.ui.unit.dp
|
|
15
14
|
import vn.momo.kits.const.Spacing
|
|
16
15
|
import vn.momo.kits.navigation.component.HEADER_HEIGHT
|
|
@@ -60,8 +59,6 @@ data class ScreenLayout(
|
|
|
60
59
|
val duoTopInset: Dp = insetTop,
|
|
61
60
|
// iPhone Duo inner display in portrait: the header row shares the status bar band, between its clusters.
|
|
62
61
|
val statusBarClearance: StatusBarClearance? = null,
|
|
63
|
-
// Half-folded iPhone Duo: the hinge in window coordinates, running top to bottom; null while flat.
|
|
64
|
-
val hinge: DpRect? = null,
|
|
65
62
|
) {
|
|
66
63
|
val headerBarHeight: Dp get() = headerHeight - headerStatusBarHeight
|
|
67
64
|
}
|
|
@@ -94,6 +91,11 @@ internal object DuoMetrics {
|
|
|
94
91
|
val floatingTabBarHeight = 62.dp
|
|
95
92
|
val floatingTabBarMargin = 20.dp
|
|
96
93
|
val floatingTabBarInsetOverlap = 13.dp
|
|
94
|
+
// Width of a system alert on the inner display, in both orientations.
|
|
95
|
+
val modalMaxWidth = 440.dp
|
|
96
|
+
// Fits a PopupNotify with image, scrolled description and actions at the max width (RN
|
|
97
|
+
// Application/device.ts); taller content scrolls instead of filling the inner display.
|
|
98
|
+
val modalMaxHeight = 640.dp
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
private val IPHONE_HEADER_MIN_HEIGHT = 72.dp
|
|
@@ -151,12 +153,19 @@ internal fun calculateScreenLayout(topInset: Dp, parent: ScreenLayout? = null):
|
|
|
151
153
|
asymmetricInsets = leftPx != rightPx,
|
|
152
154
|
isDuoDevice = isPhone && reservedRegions.isFoldable,
|
|
153
155
|
reservedRegions = reservedRegions.occlusion,
|
|
154
|
-
division = reservedRegions.division,
|
|
155
156
|
)
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
|
|
161
|
+
// Room for a dialog on iPhone Duo: inside the safe area, so clear of the side toolbar strip, and
|
|
162
|
+
// capped so it stays a dialog on the inner display.
|
|
163
|
+
internal val ScreenLayout.duoModalMaxWidth: Dp
|
|
164
|
+
get() = minOf(width - insetLeft - insetRight - Spacing.XL * 2, DuoMetrics.modalMaxWidth)
|
|
165
|
+
|
|
166
|
+
internal val ScreenLayout.duoModalMaxHeight: Dp
|
|
167
|
+
get() = minOf(height - insetTop - insetBottom - Spacing.XL * 2, DuoMetrics.modalMaxHeight)
|
|
168
|
+
|
|
160
169
|
// Content inside the safe-area padding: the insets are spent and the side bar belongs to the screen.
|
|
161
170
|
internal fun ScreenLayout.consumeHorizontalInsets(): ScreenLayout =
|
|
162
171
|
copy(width = contentWidth, insetLeft = 0.dp, insetRight = 0.dp, sideBar = null)
|
|
@@ -247,7 +256,6 @@ private fun screenLayoutOf(
|
|
|
247
256
|
asymmetricInsets: Boolean,
|
|
248
257
|
isDuoDevice: Boolean,
|
|
249
258
|
reservedRegions: List<ReservedRegion>,
|
|
250
|
-
division: ReservedRegion?,
|
|
251
259
|
): ScreenLayout {
|
|
252
260
|
val isIPhoneDuo = isPhone && isIPhoneDuoWindow(width, height, asymmetricInsets)
|
|
253
261
|
val isInnerPortrait = height > width && width >= DuoMetrics.innerMinHeight
|
|
@@ -309,8 +317,5 @@ private fun screenLayoutOf(
|
|
|
309
317
|
isIPhoneDuoDevice = isDuoDevice || (isPhone && asymmetricInsets),
|
|
310
318
|
duoTopInset = maxOf(topInset, if (height > width) sideInset * 2 else 0.dp),
|
|
311
319
|
statusBarClearance = statusBarClearance,
|
|
312
|
-
// only a hinge splitting the window into left and right halves moves overlays
|
|
313
|
-
hinge = division?.takeIf { isPhone && it.height > it.width }
|
|
314
|
-
?.let { DpRect(it.x, it.y, it.x + it.width, it.y + it.height) },
|
|
315
320
|
)
|
|
316
321
|
}
|