Present row sheets through the shared sheet host

Each video row carried its own sheets: tappableVideo added the queue
action and resume sheets, the context menu and swipe actions added
add-to-playlist and download options, so a row could declare up to six
sheets, owned by a row that a list may recycle.

Rows now present those through the nearest sheet host, as does the
video info view's resume prompt. The queue action sheet for a tapped
description link becomes a global request instead of being declared
at both the app root and the expanded player.

Sheets take the color scheme where their host sits, so the floating
details panel's dark override no longer reaches them and the
presentationColorScheme workaround is gone.
This commit is contained in:
Arkadiusz Fal
2026-10-04 09:07:05 +02:00
parent 28a75792e8
commit e3d3809f2f
10 changed files with 39 additions and 147 deletions

View File

@@ -63,14 +63,8 @@ final class NavigationCoordinator {
/// (remote control state) reads the real layout instead of screen bounds.
var isWideScreenLayoutActive = false
/// Video to present in the queue action sheet (e.g. a video link tapped inside
/// a description). Set by the deep-link handler; cleared when the sheet dismisses.
/// Presented by YatteeApp when the player is collapsed and by ExpandedPlayerSheet
/// when the player is expanded, so the sheet always sits above the visible layer.
var descriptionLinkQueueSheetVideo: Video?
/// Resolved short-link URL awaiting user confirmation ("Try in Yattee" vs
/// "Open in Browser"). Dual-hosted like `descriptionLinkQueueSheetVideo`
/// "Open in Browser"). Dual-hosted (root and expanded player)
/// so the dialog is visible whether or not the expanded player is covering
/// the main app view.
var resolvedShortLinkPrompt: URL?

View File

@@ -20,6 +20,10 @@ enum AppSheet: Identifiable {
case queue(halfHeight: Bool = false)
/// Add a video to a playlist. `halfHeight` opens at the medium detent.
case addToPlaylist(Video, halfHeight: Bool = false)
/// Play now / queue choices for a tapped video while something is playing.
case queueAction(Video, queueSource: QueueSource? = nil)
/// Continue / start over for a partially watched video.
case resumeAction(Video, resumeTime: TimeInterval, onContinue: () -> Void, onStartOver: () -> Void)
#if !os(tvOS)
/// Download quality picker. Streams and captions already loaded by the
/// caller (the player) skip the sheet's own fetch.
@@ -32,6 +36,10 @@ enum AppSheet: Identifiable {
return "queue"
case .addToPlaylist(let video, _):
return "addToPlaylist-\(video.id.id)"
case .queueAction(let video, _):
return "queueAction-\(video.id.id)"
case .resumeAction(let video, _, _, _):
return "resumeAction-\(video.id.id)"
#if !os(tvOS)
case .downloadOptions(let video, _, _, _):
return "downloadOptions-\(video.id.id)"
@@ -85,16 +93,9 @@ private struct AppSheetHost: ViewModifier {
func body(content: Content) -> some View {
content
.environment(\.presentAppSheet, PresentAppSheetAction { sheet = $0 })
#if os(tvOS)
.fullScreenCover(item: $sheet) { sheet in
sheetContent(for: sheet)
.tvFullScreenCoverBackground()
}
#else
.sheet(item: $sheet) { sheet in
sheetContent(for: sheet)
}
#endif
.onChange(of: pendingRequestID, initial: true) { _, _ in
takePendingRequest()
}
@@ -121,6 +122,10 @@ private struct AppSheetHost: ViewModifier {
case .addToPlaylist(let video, let halfHeight):
PlaylistSelectorSheet(video: video)
.halfHeightDetents(halfHeight)
case .queueAction(let video, let queueSource):
QueueActionSheet(video: video, queueSource: queueSource)
case .resumeAction(let video, let resumeTime, let onContinue, let onStartOver):
ResumeActionSheet(video: video, resumeTime: resumeTime, onContinue: onContinue, onStartOver: onStartOver)
#if !os(tvOS)
case .downloadOptions(let video, let streams, let captions, let dislikeCount):
DownloadQualitySheet(video: video, streams: streams, captions: captions, dislikeCount: dislikeCount)