2021-07-12 02:22:49 +05:30
|
|
|
import Defaults
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct TVNavigationView: View {
|
2021-09-25 13:48:22 +05:30
|
|
|
@EnvironmentObject<NavigationModel> private var navigation
|
|
|
|
@EnvironmentObject<PlaybackModel> private var playback
|
2021-09-26 23:10:25 +05:30
|
|
|
@EnvironmentObject<RecentsModel> private var recents
|
2021-09-25 13:48:22 +05:30
|
|
|
@EnvironmentObject<SearchModel> private var search
|
2021-07-12 02:22:49 +05:30
|
|
|
|
|
|
|
@State private var showingOptions = false
|
|
|
|
|
2021-08-02 02:55:50 +05:30
|
|
|
@Default(.showingAddToPlaylist) var showingAddToPlaylist
|
|
|
|
|
2021-07-12 02:22:49 +05:30
|
|
|
var body: some View {
|
2021-09-25 13:48:22 +05:30
|
|
|
TabView(selection: $navigation.tabSelection) {
|
2021-09-19 02:06:42 +05:30
|
|
|
WatchNowView()
|
|
|
|
.tabItem { Text("Watch Now") }
|
|
|
|
.tag(TabSelection.watchNow)
|
|
|
|
|
2021-08-03 04:43:42 +05:30
|
|
|
SubscriptionsView()
|
|
|
|
.tabItem { Text("Subscriptions") }
|
|
|
|
.tag(TabSelection.subscriptions)
|
|
|
|
|
|
|
|
PopularView()
|
|
|
|
.tabItem { Text("Popular") }
|
|
|
|
.tag(TabSelection.popular)
|
|
|
|
|
|
|
|
TrendingView()
|
|
|
|
.tabItem { Text("Trending") }
|
|
|
|
.tag(TabSelection.trending)
|
|
|
|
|
|
|
|
PlaylistsView()
|
|
|
|
.tabItem { Text("Playlists") }
|
|
|
|
.tag(TabSelection.playlists)
|
|
|
|
|
|
|
|
SearchView()
|
|
|
|
.tabItem { Image(systemName: "magnifyingglass") }
|
|
|
|
.tag(TabSelection.search)
|
|
|
|
}
|
|
|
|
.fullScreenCover(isPresented: $showingOptions) { OptionsView() }
|
|
|
|
.fullScreenCover(isPresented: $showingAddToPlaylist) { AddToPlaylistView() }
|
2021-09-25 13:48:22 +05:30
|
|
|
.fullScreenCover(isPresented: $navigation.showingVideo) {
|
|
|
|
if let video = navigation.video {
|
2021-08-03 04:43:42 +05:30
|
|
|
VideoPlayerView(video)
|
2021-09-25 13:48:22 +05:30
|
|
|
.environmentObject(playback)
|
2021-08-02 02:55:50 +05:30
|
|
|
}
|
2021-07-12 02:22:49 +05:30
|
|
|
}
|
2021-09-25 13:48:22 +05:30
|
|
|
.fullScreenCover(isPresented: $navigation.isChannelOpen) {
|
2021-09-19 16:36:54 +05:30
|
|
|
if let channel = recents.presentedChannel {
|
2021-09-25 13:48:22 +05:30
|
|
|
ChannelVideosView(channel: channel)
|
2021-09-01 02:47:50 +05:30
|
|
|
.background(.thickMaterial)
|
|
|
|
}
|
|
|
|
}
|
2021-08-03 04:43:42 +05:30
|
|
|
.onPlayPauseCommand { showingOptions.toggle() }
|
2021-07-12 02:22:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct TVNavigationView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
TVNavigationView()
|
|
|
|
}
|
|
|
|
}
|