mirror of
https://github.com/yattee/yattee.git
synced 2026-10-29 07:57:17 +00:00
Present row sheets through the shared sheet host
Each video row carried its own sheets: tappableVideo added the queue action and resume sheets, the context menu and swipe actions added add-to-playlist and download options, so a row could declare up to six sheets, owned by a row that a list may recycle. Rows now present those through the nearest sheet host, as does the video info view's resume prompt. The queue action sheet for a tapped description link becomes a global request instead of being declared at both the app root and the expanded player. Sheets take the color scheme where their host sits, so the floating details panel's dark override no longer reaches them and the presentationColorScheme workaround is gone.
This commit is contained in:
@@ -12,22 +12,14 @@ import SwiftUI
|
||||
struct VideoSwipeActionsModifier: ViewModifier {
|
||||
@Environment(\.appEnvironment) private var appEnvironment
|
||||
@Environment(\.videoQueueContext) private var queueContext
|
||||
@Environment(\.presentAppSheet) private var presentAppSheet
|
||||
|
||||
let video: Video
|
||||
var fixedActions: [SwipeAction] = []
|
||||
|
||||
@State private var showingPlaylistSheet = false
|
||||
@State private var showingDownloadSheet = false
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.swipeActions(actionsArray: allActions())
|
||||
.sheet(isPresented: $showingPlaylistSheet) {
|
||||
PlaylistSelectorSheet(video: video)
|
||||
}
|
||||
.sheet(isPresented: $showingDownloadSheet) {
|
||||
DownloadQualitySheet(video: video)
|
||||
}
|
||||
}
|
||||
|
||||
private var visibleActions: [VideoSwipeAction] {
|
||||
@@ -104,7 +96,7 @@ struct VideoSwipeActionsModifier: ViewModifier {
|
||||
tint: action.tint,
|
||||
background: action.backgroundColor
|
||||
) { reset in
|
||||
showingPlaylistSheet = true
|
||||
presentAppSheet(.addToPlaylist(video))
|
||||
reset()
|
||||
}
|
||||
|
||||
@@ -223,7 +215,7 @@ struct VideoSwipeActionsModifier: ViewModifier {
|
||||
|
||||
private func startDownload() {
|
||||
guard let appEnvironment else {
|
||||
showingDownloadSheet = true
|
||||
presentAppSheet(.downloadOptions(video))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -277,7 +269,7 @@ struct VideoSwipeActionsModifier: ViewModifier {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showingDownloadSheet = true
|
||||
presentAppSheet(.downloadOptions(video))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user