Player bar visibility modes and settings

This commit is contained in:
Arkadiusz Fal
2022-12-17 19:35:07 +01:00
parent 8e5bafba58
commit fcf527fa87
20 changed files with 320 additions and 168 deletions

View File

@@ -52,6 +52,7 @@ struct AppSidebarNavigation: View {
}
}
}
.modifier(PlayerOverlayModifier())
.environment(\.navigationStyle, .sidebar)
}
@@ -75,7 +76,7 @@ struct AppSidebarNavigation: View {
}
}
ToolbarItemGroup(placement: accountsMenuToolbarItemPlacement) {
ToolbarItemGroup {
AccountViewButton()
}

View File

@@ -10,7 +10,7 @@ struct AppSidebarPlaylists: View {
Section(header: Text("Playlists")) {
ForEach(playlists.playlists.sorted { $0.title.lowercased() < $1.title.lowercased() }) { playlist in
NavigationLink(tag: TabSelection.playlist(playlist.id), selection: $navigation.tabSelection) {
LazyView(PlaylistVideosView(playlist).modifier(PlayerOverlayModifier()))
LazyView(PlaylistVideosView(playlist))
} label: {
playlistLabel(playlist)
}

View File

@@ -16,17 +16,17 @@ struct AppSidebarRecents: View {
switch recent.type {
case .channel:
RecentNavigationLink(recent: recent) {
LazyView(ChannelVideosView(channel: recent.channel!).modifier(PlayerOverlayModifier()))
LazyView(ChannelVideosView(channel: recent.channel!))
}
case .playlist:
RecentNavigationLink(recent: recent, systemImage: "list.and.film") {
LazyView(ChannelPlaylistView(playlist: recent.playlist!).modifier(PlayerOverlayModifier()))
LazyView(ChannelPlaylistView(playlist: recent.playlist!))
}
case .query:
RecentNavigationLink(recent: recent, systemImage: "magnifyingglass") {
LazyView(SearchView(recent.query!).modifier(PlayerOverlayModifier()))
LazyView(SearchView(recent.query!))
}
}
}

View File

@@ -12,7 +12,7 @@ struct AppSidebarSubscriptions: View {
Section(header: Text("Subscriptions")) {
ForEach(subscriptions.all) { channel in
NavigationLink(tag: TabSelection.channel(channel.id), selection: $navigation.tabSelection) {
LazyView(ChannelVideosView(channel: channel).modifier(PlayerOverlayModifier()))
LazyView(ChannelVideosView(channel: channel))
} label: {
HStack {
if channel.thumbnailURL != nil {

View File

@@ -47,7 +47,7 @@ struct AppTabNavigation: View {
searchNavigationView
}
}
.overlay(ControlsBar(fullScreen: .constant(false)), alignment: .bottom)
.modifier(PlayerOverlayModifier())
}
.onAppear {
feed.calculateUnwatchedFeed()

View File

@@ -53,7 +53,7 @@ struct Sidebar: View {
var mainNavigationLinks: some View {
Section(header: Text("Videos")) {
if showHome {
NavigationLink(destination: LazyView(HomeView().modifier(PlayerOverlayModifier())), tag: TabSelection.home, selection: $navigation.tabSelection) {
NavigationLink(destination: LazyView(HomeView()), tag: TabSelection.home, selection: $navigation.tabSelection) {
Label("Home", systemImage: "house")
.accessibility(label: Text("Home"))
}
@@ -62,7 +62,7 @@ struct Sidebar: View {
#if os(iOS)
if showDocuments {
NavigationLink(destination: LazyView(DocumentsView().modifier(PlayerOverlayModifier())), tag: TabSelection.documents, selection: $navigation.tabSelection) {
NavigationLink(destination: LazyView(DocumentsView()), tag: TabSelection.documents, selection: $navigation.tabSelection) {
Label("Documents", systemImage: "folder")
.accessibility(label: Text("Documents"))
}
@@ -74,7 +74,7 @@ struct Sidebar: View {
if visibleSections.contains(.subscriptions),
accounts.app.supportsSubscriptions && accounts.signedIn
{
NavigationLink(destination: LazyView(SubscriptionsView().modifier(PlayerOverlayModifier())), tag: TabSelection.subscriptions, selection: $navigation.tabSelection) {
NavigationLink(destination: LazyView(SubscriptionsView()), tag: TabSelection.subscriptions, selection: $navigation.tabSelection) {
Label("Subscriptions", systemImage: "star.circle")
.accessibility(label: Text("Subscriptions"))
}
@@ -88,7 +88,7 @@ struct Sidebar: View {
}
if visibleSections.contains(.popular), accounts.app.supportsPopular {
NavigationLink(destination: LazyView(PopularView().modifier(PlayerOverlayModifier())), tag: TabSelection.popular, selection: $navigation.tabSelection) {
NavigationLink(destination: LazyView(PopularView()), tag: TabSelection.popular, selection: $navigation.tabSelection) {
Label("Popular", systemImage: "arrow.up.right.circle")
.accessibility(label: Text("Popular"))
}
@@ -96,14 +96,14 @@ struct Sidebar: View {
}
if visibleSections.contains(.trending) {
NavigationLink(destination: LazyView(TrendingView().modifier(PlayerOverlayModifier())), tag: TabSelection.trending, selection: $navigation.tabSelection) {
NavigationLink(destination: LazyView(TrendingView()), tag: TabSelection.trending, selection: $navigation.tabSelection) {
Label("Trending", systemImage: "chart.bar")
.accessibility(label: Text("Trending"))
}
.id("trending")
}
NavigationLink(destination: LazyView(SearchView().modifier(PlayerOverlayModifier())), tag: TabSelection.search, selection: $navigation.tabSelection) {
NavigationLink(destination: LazyView(SearchView()), tag: TabSelection.search, selection: $navigation.tabSelection) {
Label("Search", systemImage: "magnifyingglass")
.accessibility(label: Text("Search"))
}
@@ -159,3 +159,9 @@ struct Sidebar: View {
scrollView.scrollTo(selection.stringValue)
}
}
struct Sidebar_Previews: PreviewProvider {
static var previews: some View {
Sidebar()
}
}