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 @Default(.showingAddToPlaylist) var showingAddToPlaylist
var body: some View { var body: some View {
NavigationView { TabView(selection: $navigationState.tabSelection) {
TabView(selection: $navigationState.tabSelection) { SubscriptionsView()
SubscriptionsView() .tabItem { Text("Subscriptions") }
.tabItem { Text("Subscriptions") } .tag(TabSelection.subscriptions)
.tag(TabSelection.subscriptions)
PopularView() PopularView()
.tabItem { Text("Popular") } .tabItem { Text("Popular") }
.tag(TabSelection.popular) .tag(TabSelection.popular)
TrendingView() TrendingView()
.tabItem { Text("Trending") } .tabItem { Text("Trending") }
.tag(TabSelection.trending) .tag(TabSelection.trending)
PlaylistsView() PlaylistsView()
.tabItem { Text("Playlists") } .tabItem { Text("Playlists") }
.tag(TabSelection.playlists) .tag(TabSelection.playlists)
SearchView() SearchView()
.tabItem { Image(systemName: "magnifyingglass") } .tabItem { Image(systemName: "magnifyingglass") }
.tag(TabSelection.search) .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() }
} }
.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() }
} }
} }