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.
This commit is contained in:
Arkadiusz Fal
2026-06-06 23:34:05 +02:00
parent 271aff86b5
commit 8ab6d339f6
5 changed files with 35 additions and 1 deletions

View File

@@ -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 },

View File

@@ -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()
},

View File

@@ -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

View File

@@ -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)

View File

@@ -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