2021-07-11 20:52:49 +00:00
|
|
|
import Defaults
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct AppTabNavigation: View {
|
2021-08-31 21:17:50 +00:00
|
|
|
@EnvironmentObject<NavigationState> private var navigationState
|
2021-07-11 20:52:49 +00:00
|
|
|
|
|
|
|
var body: some View {
|
2021-08-31 21:17:50 +00:00
|
|
|
TabView(selection: $navigationState.tabSelection) {
|
2021-07-11 20:52:49 +00:00
|
|
|
NavigationView {
|
|
|
|
SubscriptionsView()
|
|
|
|
}
|
|
|
|
.tabItem {
|
2021-08-25 22:12:59 +00:00
|
|
|
Label("Subscriptions", systemImage: "star.circle.fill")
|
2021-07-11 20:52:49 +00:00
|
|
|
.accessibility(label: Text("Subscriptions"))
|
|
|
|
}
|
|
|
|
.tag(TabSelection.subscriptions)
|
|
|
|
|
|
|
|
NavigationView {
|
2021-07-27 22:40:04 +00:00
|
|
|
PopularView()
|
2021-07-11 20:52:49 +00:00
|
|
|
}
|
|
|
|
.tabItem {
|
|
|
|
Label("Popular", systemImage: "chart.bar")
|
|
|
|
.accessibility(label: Text("Popular"))
|
|
|
|
}
|
|
|
|
.tag(TabSelection.popular)
|
|
|
|
|
|
|
|
NavigationView {
|
|
|
|
TrendingView()
|
|
|
|
}
|
|
|
|
.tabItem {
|
|
|
|
Label("Trending", systemImage: "chart.line.uptrend.xyaxis")
|
|
|
|
.accessibility(label: Text("Trending"))
|
|
|
|
}
|
|
|
|
.tag(TabSelection.trending)
|
|
|
|
|
|
|
|
NavigationView {
|
|
|
|
PlaylistsView()
|
|
|
|
}
|
|
|
|
.tabItem {
|
|
|
|
Label("Playlists", systemImage: "list.and.film")
|
|
|
|
.accessibility(label: Text("Playlists"))
|
|
|
|
}
|
|
|
|
.tag(TabSelection.playlists)
|
|
|
|
|
|
|
|
NavigationView {
|
|
|
|
SearchView()
|
|
|
|
}
|
|
|
|
.tabItem {
|
|
|
|
Label("Search", systemImage: "magnifyingglass")
|
|
|
|
.accessibility(label: Text("Search"))
|
|
|
|
}
|
|
|
|
.tag(TabSelection.search)
|
|
|
|
}
|
2021-08-31 21:17:50 +00:00
|
|
|
.sheet(isPresented: $navigationState.isChannelOpen, onDismiss: {
|
|
|
|
navigationState.closeChannel(presentedChannel)
|
|
|
|
}) {
|
|
|
|
if presentedChannel != nil {
|
|
|
|
NavigationView {
|
|
|
|
ChannelVideosView(presentedChannel)
|
|
|
|
.environment(\.inNavigationView, true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fileprivate var presentedChannel: Channel! {
|
|
|
|
navigationState.openChannels.first
|
2021-07-11 20:52:49 +00:00
|
|
|
}
|
|
|
|
}
|