mirror of
https://github.com/yattee/yattee.git
synced 2026-07-19 22:02:10 +00:00
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:
@@ -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 },
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user