From 9387bdf42cf56c3ed9b1992189ff0b451bde4344 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 25 Sep 2026 23:53:31 +0200 Subject: [PATCH] Present video action sheets in the system color scheme from the floating panel The unpinned floating details panel forces a dark color scheme on its content so it reads over the video. The play now / play next and resume sheets opened from a related video inherited that scheme, giving white text on the light system sheet background. The panel now publishes the real system scheme via a presentationColorScheme environment value and the sheets reapply it. --- .../Components/TappableVideoModifier.swift | 21 +++++++++++++++++++ .../Views/Player/FloatingDetailsPanel.swift | 1 + 2 files changed, 22 insertions(+) diff --git a/Yattee/Views/Components/TappableVideoModifier.swift b/Yattee/Views/Components/TappableVideoModifier.swift index dcb89fed..45e0d846 100644 --- a/Yattee/Views/Components/TappableVideoModifier.swift +++ b/Yattee/Views/Components/TappableVideoModifier.swift @@ -17,8 +17,27 @@ struct ResumeSheetData: Identifiable { /// View modifier that wraps content in a button that plays a video when tapped. /// When queue is enabled and not empty, shows a sheet with queue options. /// When queue is empty or disabled, plays the video directly and queues subsequent videos. +// MARK: - Presentation Color Scheme + +/// The real system color scheme, published by hosts that override +/// `colorScheme` for their own content (the unpinned floating details panel +/// renders dark over video). Sheets presented from inside such a host use it +/// so they don't get dark text colors on a light system sheet background. +private struct PresentationColorSchemeKey: EnvironmentKey { + static let defaultValue: ColorScheme? = nil +} + +extension EnvironmentValues { + var presentationColorScheme: ColorScheme? { + get { self[PresentationColorSchemeKey.self] } + set { self[PresentationColorSchemeKey.self] = newValue } + } +} + struct TappableVideoModifier: ViewModifier { @Environment(\.appEnvironment) private var appEnvironment + @Environment(\.colorScheme) private var colorScheme + @Environment(\.presentationColorScheme) private var presentationColorScheme let video: Video var startTime: Double? = nil @@ -85,6 +104,7 @@ struct TappableVideoModifier: ViewModifier { } .sheet(isPresented: $showingQueueSheet) { QueueActionSheet(video: video, queueSource: queueSource) + .environment(\.colorScheme, presentationColorScheme ?? colorScheme) } .sheet(item: $resumeSheetData) { data in ResumeActionSheet( @@ -93,6 +113,7 @@ struct TappableVideoModifier: ViewModifier { onContinue: { playVideoWithStartTime(data.resumeTime) }, onStartOver: { playVideoWithStartTime(0) } ) + .environment(\.colorScheme, presentationColorScheme ?? colorScheme) } .alert(String(localized: "common.authenticationRequired"), isPresented: $showingPasswordAlert) { SecureField(String(localized: "common.password"), text: $passwordInput) diff --git a/Yattee/Views/Player/FloatingDetailsPanel.swift b/Yattee/Views/Player/FloatingDetailsPanel.swift index 848c374d..42ceb5d1 100644 --- a/Yattee/Views/Player/FloatingDetailsPanel.swift +++ b/Yattee/Views/Player/FloatingDetailsPanel.swift @@ -150,6 +150,7 @@ struct FloatingDetailsPanel: View { .onChange(of: isCommentsExpanded) { _, newValue in // Sync with NavigationCoordinator to block sheet dismiss gesture when comments expanded appEnvironment?.navigationCoordinator.isCommentsExpanded = newValue + .environment(\.presentationColorScheme, systemColorScheme) } .onChange(of: maxPanelWidth) { _, _ in // Re-clamp width when max width changes (e.g., pinned vs floating)