mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 18:35:05 +00:00
Open queue sheet from tvOS player controls
Turn the tvOS bottom-row queue count indicator into a focusable button that opens QueueManagementSheet in a fullScreenCover with an ultraThinMaterial backdrop, matching the Settings sheet pattern. Hide the sheet's close toolbar button on tvOS (Menu button dismisses) and replace the unusable Menu-based queue mode picker with an icon-only tap-to-cycle button.
This commit is contained in:
@@ -16,6 +16,7 @@ struct TVPlayerControlsView: View {
|
||||
@FocusState.Binding var focusedControl: TVPlayerFocusTarget?
|
||||
|
||||
let onShowSettings: () -> Void
|
||||
let onShowQueue: () -> Void
|
||||
let onShowDetails: () -> Void
|
||||
let onShowComments: () -> Void
|
||||
let onShowDebug: () -> Void
|
||||
@@ -241,15 +242,20 @@ struct TVPlayerControlsView: View {
|
||||
|
||||
Spacer()
|
||||
|
||||
// Queue indicator (if videos in queue)
|
||||
// Queue button (if videos in queue)
|
||||
if let state = playerState, state.hasNext {
|
||||
HStack(spacing: 8) {
|
||||
Image(systemName: "list.bullet")
|
||||
.font(.system(size: 20))
|
||||
Text(String(localized: "queue.section.count \(state.queue.count)"))
|
||||
.font(.subheadline)
|
||||
Button {
|
||||
onShowQueue()
|
||||
} label: {
|
||||
VStack(spacing: 6) {
|
||||
Image(systemName: "list.bullet")
|
||||
.font(.system(size: 28))
|
||||
Text(String(localized: "queue.section.count \(state.queue.count)"))
|
||||
.font(.caption)
|
||||
}
|
||||
}
|
||||
.foregroundStyle(.white.opacity(0.6))
|
||||
.buttonStyle(TVActionButtonStyle())
|
||||
.focused($focusedControl, equals: .queueButton)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ enum TVPlayerFocusTarget: Hashable {
|
||||
case debugButton
|
||||
case playNext
|
||||
case closeButton
|
||||
case queueButton
|
||||
}
|
||||
|
||||
/// Main tvOS fullscreen player view.
|
||||
@@ -45,6 +46,9 @@ struct TVPlayerView: View {
|
||||
/// Whether the quality sheet is shown.
|
||||
@State private var showingQualitySheet = false
|
||||
|
||||
/// Whether the queue sheet is shown.
|
||||
@State private var showingQueueSheet = false
|
||||
|
||||
/// Whether the debug overlay is shown.
|
||||
@State private var isDebugOverlayVisible = false
|
||||
|
||||
@@ -109,6 +113,14 @@ struct TVPlayerView: View {
|
||||
.fullScreenCover(isPresented: $showingQualitySheet) {
|
||||
qualitySheetContent
|
||||
}
|
||||
.fullScreenCover(isPresented: $showingQueueSheet) {
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(.ultraThinMaterial)
|
||||
.ignoresSafeArea()
|
||||
QueueManagementSheet()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Quality Sheet Content
|
||||
@@ -195,6 +207,7 @@ struct TVPlayerView: View {
|
||||
playerService: playerService,
|
||||
focusedControl: $focusedControl,
|
||||
onShowSettings: { showQualitySheet() },
|
||||
onShowQueue: { showQueueSheet() },
|
||||
onShowDetails: { showDetailsPanel(tab: .info) },
|
||||
onShowComments: { showDetailsPanel(tab: .comments) },
|
||||
onShowDebug: { showDebugOverlay() },
|
||||
@@ -419,6 +432,11 @@ struct TVPlayerView: View {
|
||||
showingQualitySheet = true
|
||||
}
|
||||
|
||||
private func showQueueSheet() {
|
||||
stopControlsTimer()
|
||||
showingQueueSheet = true
|
||||
}
|
||||
|
||||
private func switchToStream(_ stream: Stream, audioStream: Stream? = nil) {
|
||||
guard let video = playerState?.currentVideo else { return }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user