1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 13:50:32 +05:30
yattee/tvOS/TVNavigationView.swift

71 lines
2.3 KiB
Swift
Raw Normal View History

2021-07-12 02:22:49 +05:30
import Defaults
import SwiftUI
struct TVNavigationView: View {
2021-10-21 03:51:50 +05:30
@EnvironmentObject<AccountsModel> private var accounts
@EnvironmentObject<PlayerModel> private var player
2021-09-25 13:48:22 +05:30
@EnvironmentObject<NavigationModel> private var navigation
@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
var body: some View {
2021-09-29 04:31:49 +05:30
TabView(selection: navigation.tabSelectionBinding) {
2021-09-19 02:06:42 +05:30
WatchNowView()
.tabItem { Text("Watch Now") }
.tag(TabSelection.watchNow)
2021-10-21 03:51:50 +05:30
if accounts.app.supportsSubscriptions {
SubscriptionsView()
.tabItem { Text("Subscriptions") }
.tag(TabSelection.subscriptions)
}
2021-08-03 04:43:42 +05:30
2021-10-21 03:51:50 +05:30
if accounts.app.supportsPopular {
PopularView()
.tabItem { Text("Popular") }
.tag(TabSelection.popular)
}
2021-08-03 04:43:42 +05:30
TrendingView()
.tabItem { Text("Trending") }
.tag(TabSelection.trending)
2021-10-21 03:51:50 +05:30
if accounts.app.supportsUserPlaylists {
PlaylistsView()
.tabItem { Text("Playlists") }
.tag(TabSelection.playlists)
}
2021-08-03 04:43:42 +05:30
NowPlayingView()
.tabItem { Text("Now Playing") }
.tag(TabSelection.nowPlaying)
2021-08-03 04:43:42 +05:30
SearchView()
.tabItem { Image(systemName: "magnifyingglass") }
.tag(TabSelection.search)
}
.fullScreenCover(isPresented: $navigation.presentingSettings) { SettingsView() }
.fullScreenCover(isPresented: $navigation.presentingAddToPlaylist) {
if let video = navigation.videoToAddToPlaylist {
AddToPlaylistView(video: video)
}
}
.fullScreenCover(isPresented: $player.presentingPlayer) {
VideoPlayerView()
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)
}
}
.onPlayPauseCommand { navigation.presentingSettings.toggle() }
2021-07-12 02:22:49 +05:30
}
}
struct TVNavigationView_Previews: PreviewProvider {
static var previews: some View {
TVNavigationView()
2021-09-29 17:15:00 +05:30
.injectFixtureEnvironmentObjects()
2021-07-12 02:22:49 +05:30
}
}