Fix TV navigation

This commit is contained in:
Arkadiusz Fal 2021-08-03 01:13:42 +02:00
parent ebbc4876e2
commit ac813490fe

View File

@ -9,49 +9,47 @@ struct TVNavigationView: View {
@Default(.showingAddToPlaylist) var showingAddToPlaylist
var body: some View {
NavigationView {
TabView(selection: $navigationState.tabSelection) {
SubscriptionsView()
.tabItem { Text("Subscriptions") }
.tag(TabSelection.subscriptions)
TabView(selection: $navigationState.tabSelection) {
SubscriptionsView()
.tabItem { Text("Subscriptions") }
.tag(TabSelection.subscriptions)
PopularView()
.tabItem { Text("Popular") }
.tag(TabSelection.popular)
PopularView()
.tabItem { Text("Popular") }
.tag(TabSelection.popular)
TrendingView()
.tabItem { Text("Trending") }
.tag(TabSelection.trending)
TrendingView()
.tabItem { Text("Trending") }
.tag(TabSelection.trending)
PlaylistsView()
.tabItem { Text("Playlists") }
.tag(TabSelection.playlists)
PlaylistsView()
.tabItem { Text("Playlists") }
.tag(TabSelection.playlists)
SearchView()
.tabItem { Image(systemName: "magnifyingglass") }
.tag(TabSelection.search)
}
.fullScreenCover(isPresented: $showingOptions) { OptionsView() }
.fullScreenCover(isPresented: $showingAddToPlaylist) { AddToPlaylistView() }
.fullScreenCover(isPresented: $navigationState.showingVideoDetails) {
if let video = navigationState.video {
VideoDetailsView(video)
}
}
.fullScreenCover(isPresented: $navigationState.showingChannel, onDismiss: {
navigationState.showVideoDetailsIfNeeded()
}) {
if let channel = navigationState.channel {
ChannelView(id: channel.id)
}
}
.fullScreenCover(isPresented: $navigationState.showingVideo) {
if let video = navigationState.video {
VideoPlayerView(video)
}
}
.onPlayPauseCommand { showingOptions.toggle() }
SearchView()
.tabItem { Image(systemName: "magnifyingglass") }
.tag(TabSelection.search)
}
.fullScreenCover(isPresented: $showingOptions) { OptionsView() }
.fullScreenCover(isPresented: $showingAddToPlaylist) { AddToPlaylistView() }
.fullScreenCover(isPresented: $navigationState.showingVideoDetails) {
if let video = navigationState.video {
VideoDetailsView(video)
}
}
.fullScreenCover(isPresented: $navigationState.showingChannel, onDismiss: {
navigationState.showVideoDetailsIfNeeded()
}) {
if let channel = navigationState.channel {
ChannelView(id: channel.id)
}
}
.fullScreenCover(isPresented: $navigationState.showingVideo) {
if let video = navigationState.video {
VideoPlayerView(video)
}
}
.onPlayPauseCommand { showingOptions.toggle() }
}
}