mirror of
https://github.com/yattee/yattee.git
synced 2026-10-26 14:42:53 +00:00
Present shared sheets through one host per window
The add-to-playlist, download options and queue sheets were declared in every view that could open them: the root view (twice, mirrored from coordinator flags), the expanded player, its portrait and floating panels, the player controls and the video info view. AppSheet lists the shared sheets, and .appSheetHost() declares them once. The app root and the expanded player each host them, and every presented sheet hosts the next level. Views present through the presentAppSheet environment action, which reaches the nearest host; code without a view (and the expanded player itself, whose host sits in its own body) uses PresentationRouter.request, taken by the top-most host: the player while it is up, the root otherwise. The mini player's queue and playlist sheets now go through the host, replacing the isMiniPlayer*SheetPresented flags.
This commit is contained in:
@@ -11,6 +11,7 @@ import SwiftUI
|
||||
|
||||
struct PlayerPillButtonView: View {
|
||||
@Environment(\.appEnvironment) private var appEnvironment
|
||||
@Environment(\.presentAppSheet) private var presentAppSheet
|
||||
|
||||
let configuration: ControlButtonConfiguration
|
||||
let isPlaying: Bool
|
||||
@@ -24,7 +25,6 @@ struct PlayerPillButtonView: View {
|
||||
// Context for special buttons
|
||||
let video: Video?
|
||||
let playbackRate: PlaybackRate
|
||||
@Binding var showingPlaylistSheet: Bool
|
||||
|
||||
// Callbacks
|
||||
let onAction: () -> Void
|
||||
@@ -263,7 +263,9 @@ struct PlayerPillButtonView: View {
|
||||
|
||||
private var addToPlaylistButton: some View {
|
||||
Button {
|
||||
showingPlaylistSheet = true
|
||||
if let video {
|
||||
presentAppSheet(.addToPlaylist(video))
|
||||
}
|
||||
} label: {
|
||||
genericButtonLabel
|
||||
}
|
||||
@@ -326,7 +328,6 @@ struct PlayerPillButtonView: View {
|
||||
isOrientationLocked: false,
|
||||
video: nil,
|
||||
playbackRate: .x1,
|
||||
showingPlaylistSheet: .constant(false),
|
||||
onAction: {},
|
||||
onRateChanged: { _ in },
|
||||
onTogglePiP: {}
|
||||
@@ -348,7 +349,6 @@ struct PlayerPillButtonView: View {
|
||||
isOrientationLocked: false,
|
||||
video: nil,
|
||||
playbackRate: .x1,
|
||||
showingPlaylistSheet: .constant(false),
|
||||
onAction: {},
|
||||
onRateChanged: { _ in },
|
||||
onTogglePiP: {}
|
||||
@@ -364,7 +364,6 @@ struct PlayerPillButtonView: View {
|
||||
isOrientationLocked: false,
|
||||
video: nil,
|
||||
playbackRate: .x1,
|
||||
showingPlaylistSheet: .constant(false),
|
||||
onAction: {},
|
||||
onRateChanged: { _ in },
|
||||
onTogglePiP: {}
|
||||
|
||||
Reference in New Issue
Block a user