mirror of
https://github.com/yattee/yattee.git
synced 2026-10-27 15:07:18 +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:
@@ -120,7 +120,6 @@ struct PlayerControlsView: View {
|
||||
|
||||
// MARK: - Sheet State
|
||||
|
||||
@State private var showingPlaylistSheet = false
|
||||
@State private var showingCaptionsSheet = false
|
||||
@State private var showingVideoTrackSheet = false
|
||||
@State private var showingAudioTrackSheet = false
|
||||
@@ -305,11 +304,6 @@ struct PlayerControlsView: View {
|
||||
.onReceive(NotificationCenter.default.publisher(for: UIScreen.brightnessDidChangeNotification)) { _ in
|
||||
currentBrightness = UIScreen.main.brightness
|
||||
}
|
||||
.sheet(isPresented: $showingPlaylistSheet) {
|
||||
if let video = currentVideo {
|
||||
PlaylistSelectorSheet(video: video)
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showingCaptionsSheet) {
|
||||
captionsSheet
|
||||
}
|
||||
@@ -491,7 +485,12 @@ struct PlayerControlsView: View {
|
||||
},
|
||||
onRateChanged: onRateChanged,
|
||||
onCaptionSelected: onCaptionSelected,
|
||||
onShowPlaylistSelector: { [self] in showingPlaylistSheet = true },
|
||||
onShowPlaylistSelector: { [self] in
|
||||
// Through the player's sheet host, which takes requests while the player is up
|
||||
if let video = currentVideo {
|
||||
appEnvironment?.navigationCoordinator.presenter.present(.addToPlaylist(video))
|
||||
}
|
||||
},
|
||||
onShowQueue: onShowQueue,
|
||||
onShowCaptionsSelector: { [self] in showingCaptionsSheet = true },
|
||||
onShowChaptersSelector: { [self] in showingChaptersSheet = true },
|
||||
|
||||
Reference in New Issue
Block a user