From 8ab6d339f6edf5672f679912e5c21851aff6e707 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 6 Jun 2026 23:34:05 +0200 Subject: [PATCH] Fix queue and add-to-playlist sheets not opening on macOS The mini player buttons set NavigationCoordinator flags, but only the iOS tab views hosted the corresponding sheets. Host QueueManagementSheet and PlaylistSelectorSheet on the macOS root view, bound directly to the coordinator flags. Also wire the add-to-playlist button in the full macOS player controls: add the missing .addToPlaylist case to MacOSControlsSectionRenderer and thread onShowPlaylistSelector from the expanded sheet layouts through MacOSPlayerControlsView to the existing playlist sheet host. --- Yattee/ContentView.swift | 14 ++++++++++++++ .../Views/Player/ExpandedPlayerSheet+Layouts.swift | 9 +++++++++ Yattee/Views/Player/ExpandedPlayerSheet.swift | 2 +- .../macOS/MacOSControlsSectionRenderer.swift | 9 +++++++++ .../Player/macOS/MacOSPlayerControlsView.swift | 2 ++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Yattee/ContentView.swift b/Yattee/ContentView.swift index 8e55d2df..4236be43 100644 --- a/Yattee/ContentView.swift +++ b/Yattee/ContentView.swift @@ -121,6 +121,20 @@ struct ContentView: View { // and lock interactive resize to the video ratio (no black bars). .sheetWindowSize(size, aspectRatio: lockAspect) } + .sheet(isPresented: Binding( + get: { appEnvironment.navigationCoordinator.isMiniPlayerQueueSheetPresented }, + set: { appEnvironment.navigationCoordinator.isMiniPlayerQueueSheetPresented = $0 } + )) { + QueueManagementSheet() + } + .sheet(isPresented: Binding( + get: { appEnvironment.navigationCoordinator.isMiniPlayerPlaylistSheetPresented }, + set: { appEnvironment.navigationCoordinator.isMiniPlayerPlaylistSheetPresented = $0 } + )) { + if let video = appEnvironment.playerService.state.currentVideo { + PlaylistSelectorSheet(video: video) + } + } #elseif os(tvOS) .fullScreenCover(isPresented: Binding( get: { appEnvironment.navigationCoordinator.isPlayerExpanded }, diff --git a/Yattee/Views/Player/ExpandedPlayerSheet+Layouts.swift b/Yattee/Views/Player/ExpandedPlayerSheet+Layouts.swift index bdce53b3..860137da 100644 --- a/Yattee/Views/Player/ExpandedPlayerSheet+Layouts.swift +++ b/Yattee/Views/Player/ExpandedPlayerSheet+Layouts.swift @@ -924,6 +924,9 @@ extension ExpandedPlayerSheet { onShowQueue: { [self] in showingQueueSheet = true }, + onShowPlaylistSelector: { [self] in + showingPlaylistSheet = true + }, onRateChanged: { rate in playerState.rate = rate playerService.currentBackend?.rate = Float(rate.rawValue) @@ -1190,6 +1193,9 @@ extension ExpandedPlayerSheet { onShowQueue: { [self] in showingQueueSheet = true }, + onShowPlaylistSelector: { [self] in + showingPlaylistSheet = true + }, onRateChanged: { rate in playerState.rate = rate playerService.currentBackend?.rate = Float(rate.rawValue) @@ -1600,6 +1606,9 @@ extension ExpandedPlayerSheet { onShowQueue: { [self] in showingQueueSheet = true }, + onShowPlaylistSelector: { [self] in + showingPlaylistSheet = true + }, onTitleTap: { onTogglePanel() }, diff --git a/Yattee/Views/Player/ExpandedPlayerSheet.swift b/Yattee/Views/Player/ExpandedPlayerSheet.swift index f911eb3d..ec67ab64 100644 --- a/Yattee/Views/Player/ExpandedPlayerSheet.swift +++ b/Yattee/Views/Player/ExpandedPlayerSheet.swift @@ -18,7 +18,7 @@ struct ExpandedPlayerSheet: View { // MARK: - Sheet State @State var showingQualitySheet = false - @State private var showingPlaylistSheet = false + @State var showingPlaylistSheet = false @State var showingDownloadSheet = false @State var showingDeleteDownloadAlert = false @State var showingQueueSheet = false diff --git a/Yattee/Views/Player/macOS/MacOSControlsSectionRenderer.swift b/Yattee/Views/Player/macOS/MacOSControlsSectionRenderer.swift index 1622a81c..3048622e 100644 --- a/Yattee/Views/Player/macOS/MacOSControlsSectionRenderer.swift +++ b/Yattee/Views/Player/macOS/MacOSControlsSectionRenderer.swift @@ -215,6 +215,15 @@ struct MacOSControlsSectionRenderer: View { .opacity(isLocked ? 0.5 : 1.0) } + case .addToPlaylist: + if actions.canAddToPlaylist, actions.onShowPlaylistSelector != nil { + controlButton(systemImage: "text.badge.plus", help: config.buttonType.displayName) { + actions.onShowPlaylistSelector?() + } + .disabled(isLocked) + .opacity(isLocked ? 0.5 : 1.0) + } + case .timeDisplay: timeDisplayView(config) diff --git a/Yattee/Views/Player/macOS/MacOSPlayerControlsView.swift b/Yattee/Views/Player/macOS/MacOSPlayerControlsView.swift index 75ea39be..418265b5 100644 --- a/Yattee/Views/Player/macOS/MacOSPlayerControlsView.swift +++ b/Yattee/Views/Player/macOS/MacOSPlayerControlsView.swift @@ -32,6 +32,7 @@ struct MacOSPlayerControlsView: View { var onMuteToggled: (() -> Void)? = nil var onShowSettings: (() -> Void)? = nil var onShowQueue: (() -> Void)? = nil + var onShowPlaylistSelector: (() -> Void)? = nil /// Tapping the avatar / title / author in the top bar toggles the video details panel. var onTitleTap: (() -> Void)? = nil /// Whether the floating video details panel is currently visible. When it opens, @@ -174,6 +175,7 @@ struct MacOSPlayerControlsView: View { } }, onRateChanged: onRateChanged, + onShowPlaylistSelector: onShowPlaylistSelector, onShowQueue: onShowQueue, onControlsLockToggled: { [self] locked in playerState.isControlsLocked = locked