Browser player bar as overlay

This commit is contained in:
Arkadiusz Fal
2022-12-10 22:37:14 +01:00
parent 7df397b662
commit 74d65f6ab8
20 changed files with 319 additions and 417 deletions

View File

@@ -42,15 +42,13 @@ struct AppSidebarNavigation: View {
.frame(minWidth: sidebarMinWidth)
VStack {
BrowserPlayerControls {
HStack {
Spacer()
Image(systemName: "4k.tv")
.renderingMode(.original)
.font(.system(size: 60))
.foregroundColor(.accentColor)
Spacer()
}
HStack {
Spacer()
Image(systemName: "4k.tv")
.renderingMode(.original)
.font(.system(size: 60))
.foregroundColor(.accentColor)
Spacer()
}
}
}

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))
LazyView(PlaylistVideosView(playlist).modifier(PlayerOverlayModifier()))
} 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!))
LazyView(ChannelVideosView(channel: recent.channel!).modifier(PlayerOverlayModifier()))
}
case .playlist:
RecentNavigationLink(recent: recent, systemImage: "list.and.film") {
LazyView(ChannelPlaylistView(playlist: recent.playlist!))
LazyView(ChannelPlaylistView(playlist: recent.playlist!).modifier(PlayerOverlayModifier()))
}
case .query:
RecentNavigationLink(recent: recent, systemImage: "magnifyingglass") {
LazyView(SearchView(recent.query!))
LazyView(SearchView(recent.query!).modifier(PlayerOverlayModifier()))
}
}
}

View File

@@ -9,7 +9,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))
LazyView(ChannelVideosView(channel: channel).modifier(PlayerOverlayModifier()))
} label: {
Label(channel.name, systemImage: RecentsModel.symbolSystemImage(channel.name))
}

View File

@@ -16,7 +16,7 @@ struct AppTabNavigation: View {
var body: some View {
TabView(selection: navigation.tabSelectionBinding) {
let tabs = Group {
Group {
if showHome {
homeNavigationView
}
@@ -45,13 +45,7 @@ struct AppTabNavigation: View {
searchNavigationView
}
}
if #available(iOS 16, tvOS 16, *) {
tabs
.toolbar(accounts.isEmpty ? .hidden : .visible, for: .tabBar)
} else {
tabs
}
.overlay(ControlsBar(fullScreen: .constant(false)), alignment: .bottom)
}
.id(accounts.current?.id ?? "")
@@ -196,3 +190,9 @@ struct AppTabNavigation: View {
}
}
}
struct AppTabNavigation_Preview: PreviewProvider {
static var previews: some View {
AppTabNavigation()
}
}

View File

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