Recently opened for sidebar navigation

This commit is contained in:
Arkadiusz Fal
2021-09-19 13:06:54 +02:00
parent 8571822f23
commit ee1cb924c9
16 changed files with 291 additions and 291 deletions

View File

@@ -4,6 +4,7 @@ import SwiftUI
struct TVNavigationView: View {
@EnvironmentObject<NavigationState> private var navigationState
@EnvironmentObject<PlaybackState> private var playbackState
@EnvironmentObject<Recents> private var recents
@EnvironmentObject<SearchState> private var searchState
@State private var showingOptions = false
@@ -47,31 +48,20 @@ struct TVNavigationView: View {
}
.fullScreenCover(isPresented: $showingOptions) { OptionsView() }
.fullScreenCover(isPresented: $showingAddToPlaylist) { AddToPlaylistView() }
.fullScreenCover(isPresented: $navigationState.showingVideoDetails) {
if let video = navigationState.video {
VideoDetailsView(video)
}
}
.fullScreenCover(isPresented: $navigationState.showingVideo) {
if let video = navigationState.video {
VideoPlayerView(video)
.environmentObject(playbackState)
}
}
.fullScreenCover(isPresented: $navigationState.isChannelOpen, onDismiss: {
navigationState.closeChannel(presentedChannel)
}) {
if presentedChannel != nil {
ChannelVideosView(presentedChannel)
.fullScreenCover(isPresented: $navigationState.isChannelOpen) {
if let channel = recents.presentedChannel {
ChannelVideosView(channel)
.background(.thickMaterial)
}
}
.onPlayPauseCommand { showingOptions.toggle() }
}
fileprivate var presentedChannel: Channel! {
navigationState.openChannels.first
}
}
struct TVNavigationView_Previews: PreviewProvider {