1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-12 21:30:32 +05:30

Multiplatform UI support fixes

This commit is contained in:
Arkadiusz Fal 2021-07-11 22:52:49 +02:00
parent 0fa0518f0a
commit ca4378afc1
30 changed files with 947 additions and 318 deletions

2
.swift-version Normal file
View File

@ -0,0 +1,2 @@
5

View File

@ -0,0 +1,57 @@
import Defaults
import SwiftUI
struct AppTabNavigation: View {
@State private var showingOptions = false
@State private var tabSelection: TabSelection? = .subscriptions
var body: some View {
TabView(selection: $tabSelection) {
NavigationView {
SubscriptionsView()
}
.tabItem {
Label("Subscriptions", systemImage: "play.rectangle.fill")
.accessibility(label: Text("Subscriptions"))
}
.tag(TabSelection.subscriptions)
NavigationView {
PopularVideosView()
}
.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)
}
}
}

View File

@ -16,9 +16,21 @@ struct ChannelView: View {
}
var body: some View {
VideosView(videos: store.collection)
.onAppear {
resource.loadIfNeeded()
HStack {
Spacer()
VStack {
Spacer()
VideosView(videos: store.collection)
.onAppear {
resource.loadIfNeeded()
}
Spacer()
}
Spacer()
}
.edgesIgnoringSafeArea(.all)
.background(.ultraThickMaterial)
}
}

View File

@ -2,10 +2,11 @@ import Defaults
import SwiftUI
struct OptionsView: View {
@Environment(\.dismiss) private var dismiss
@EnvironmentObject<NavigationState> private var navigationState
@Default(.layout) private var layout
@Default(.tabSelection) private var tabSelection
@Environment(\.dismiss) private var dismiss
var body: some View {
HStack {
@ -41,7 +42,7 @@ struct OptionsView: View {
var tabSelectionOptions: some View {
VStack {
switch tabSelection {
switch navigationState.tabSelection {
case .search:
SearchOptionsView()

View File

@ -15,19 +15,63 @@ struct PlayerView: View {
var body: some View {
VStack {
pvc?
.edgesIgnoringSafeArea(.all)
#if os(tvOS)
pvc
.edgesIgnoringSafeArea(.all)
#else
if let video = store.item {
VStack(alignment: .leading) {
Text(video.title)
.bold()
Text("\(video.author)")
.foregroundColor(.secondary)
.bold()
if !video.published.isEmpty || video.views != 0 {
HStack(spacing: 8) {
#if os(iOS)
Text(video.playTime ?? "?")
.layoutPriority(1)
#endif
if !video.published.isEmpty {
Image(systemName: "calendar")
Text(video.published)
.lineLimit(1)
.truncationMode(.middle)
}
if video.views != 0 {
Image(systemName: "eye")
Text(video.viewsCount)
}
}
.padding(.top)
}
}
#if os(tvOS)
.padding()
#else
#endif
}
#endif
}
.onAppear {
resource.loadIfNeeded()
}
}
var pvc: PlayerViewController? {
guard store.item != nil else {
return nil
}
#if !os(macOS)
var pvc: PlayerViewController? {
guard store.item != nil else {
return nil
}
return PlayerViewController(video: store.item!)
}
return PlayerViewController(video: store.item!)
}
#endif
}

View File

@ -4,6 +4,12 @@ import Logging
import SwiftUI
struct PlayerViewController: UIViewControllerRepresentable {
#if os(tvOS)
typealias PlayerController = StreamAVPlayerViewController
#else
typealias PlayerController = AVPlayerViewController
#endif
let logger = Logger(label: "net.arekf.Pearvidious.pvc")
@ObservedObject private var state: PlayerState
@ -73,11 +79,11 @@ struct PlayerViewController: UIViewControllerRepresentable {
loadStream(video.bestStream)
}
func makeUIViewController(context _: Context) -> StreamAVPlayerViewController {
let controller = StreamAVPlayerViewController()
controller.state = state
func makeUIViewController(context _: Context) -> PlayerController {
let controller = PlayerController()
#if os(tvOS)
controller.state = state
controller.transportBarCustomMenuItems = [streamingQualityMenu]
#endif
controller.modalPresentationStyle = .fullScreen
@ -86,7 +92,7 @@ struct PlayerViewController: UIViewControllerRepresentable {
return controller
}
func updateUIViewController(_ controller: StreamAVPlayerViewController, context _: Context) {
func updateUIViewController(_ controller: PlayerController, context _: Context) {
var items: [UIMenuElement] = []
if state.nextStream != nil {

View File

@ -24,25 +24,27 @@ struct PlaylistsView: View {
var body: some View {
Section {
VStack(alignment: .center, spacing: 2) {
HStack {
if store.collection.isEmpty {
Text("No Playlists")
.foregroundColor(.secondary)
} else {
Text("Current Playlist")
.foregroundColor(.secondary)
#if os(tvOS)
HStack {
if store.collection.isEmpty {
Text("No Playlists")
.foregroundColor(.secondary)
} else {
Text("Current Playlist")
.foregroundColor(.secondary)
selectPlaylistButton
selectPlaylistButton
}
if currentPlaylist != nil {
editPlaylistButton
}
newPlaylistButton
.padding(.leading, 40)
}
if currentPlaylist != nil {
editPlaylistButton
}
newPlaylistButton
.padding(.leading, 40)
}
.scaleEffect(0.85)
.scaleEffect(0.85)
#endif
if currentPlaylist != nil {
if currentPlaylist!.videos.isEmpty {
@ -61,17 +63,24 @@ struct PlaylistsView: View {
}
}
}
.fullScreenCover(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
PlaylistFormView(playlist: $createdPlaylist)
}
.fullScreenCover(isPresented: $showingEditPlaylist, onDismiss: selectEditedPlaylist) {
PlaylistFormView(playlist: $editedPlaylist)
}
#if !os(macOS)
.fullScreenCover(isPresented: $showingNewPlaylist, onDismiss: selectCreatedPlaylist) {
PlaylistFormView(playlist: $createdPlaylist)
}
.fullScreenCover(isPresented: $showingEditPlaylist, onDismiss: selectEditedPlaylist) {
PlaylistFormView(playlist: $editedPlaylist)
}
#endif
.onAppear {
resource.loadIfNeeded()?.onSuccess { _ in
selectPlaylist(selectedPlaylistID)
}
}
#if !os(tvOS)
.navigationTitle("Playlists")
#elseif os(iOS)
.navigationBarItems(trailing: newPlaylistButton)
#endif
}
func selectPlaylist(_ id: String?) {
@ -139,7 +148,9 @@ struct PlaylistsView: View {
Button(action: { self.showingNewPlaylist = true }) {
HStack(spacing: 8) {
Image(systemName: "plus")
Text("New Playlist")
#if os(tvOS)
Text("New Playlist")
#endif
}
}
}

View File

@ -12,8 +12,11 @@ struct PopularVideosView: View {
var body: some View {
VideosView(videos: store.collection)
.onAppear {
resource.loadIfNeeded()
}
#if !os(tvOS)
.navigationTitle("Popular")
#endif
.onAppear {
resource.loadIfNeeded()
}
}
}

View File

@ -17,7 +17,7 @@ struct SearchView: View {
VideosView(videos: store.collection)
}
if store.collection.isEmpty && !resource.isLoading {
if store.collection.isEmpty && !resource.isLoading && !query.isEmpty {
Text("No results")
if searchFiltersActive {
@ -50,6 +50,9 @@ struct SearchView: View {
.onChange(of: searchDuration) { duration in
changeQuery { query.duration = duration }
}
#if !os(tvOS)
.navigationTitle("Search")
#endif
}
func changeQuery(_ change: @escaping () -> Void = {}) {

View File

@ -14,5 +14,11 @@ struct SubscriptionsView: View {
.onAppear {
resource.loadIfNeeded()
}
.refreshable {
resource.load()
}
#if !os(tvOS)
.navigationTitle("Subscriptions")
#endif
}
}

View File

@ -0,0 +1,53 @@
import Defaults
import SwiftUI
struct TVNavigationView: View {
@EnvironmentObject<NavigationState> private var navigationState
@State private var showingOptions = false
var body: some View {
NavigationView {
TabView(selection: $navigationState.tabSelection) {
SubscriptionsView()
.tabItem { Text("Subscriptions") }
.tag(TabSelection.subscriptions)
PopularVideosView()
.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: $navigationState.showingVideoDetails) {
if let video = navigationState.video {
VideoDetailsView(video)
}
}
.fullScreenCover(isPresented: $navigationState.showingChannel) {
if let channel = navigationState.channel {
ChannelView(id: channel.id)
}
}
.onPlayPauseCommand { showingOptions.toggle() }
}
}
}
struct TVNavigationView_Previews: PreviewProvider {
static var previews: some View {
TVNavigationView()
}
}

View File

@ -19,23 +19,29 @@ struct TrendingView: View {
var body: some View {
Section {
VStack(alignment: .center, spacing: 2) {
HStack {
Text("Category")
.foregroundColor(.secondary)
#if os(tvOS)
HStack {
Text("Category")
.foregroundColor(.secondary)
categoryButton
categoryButton
Text("Country")
.foregroundColor(.secondary)
Text("Country")
.foregroundColor(.secondary)
countryFlag
countryButton
}
.scaleEffect(0.85)
countryFlag
countryButton
}
.scaleEffect(0.85)
#endif
VideosView(videos: store.collection)
}
}.onAppear {
}
#if !os(tvOS)
.navigationTitle("Trending")
#endif
.onAppear {
resource.loadIfNeeded()
}
}
@ -61,9 +67,11 @@ struct TrendingView: View {
selectingCountry.toggle()
resource.removeObservers(ownedBy: store)
}
.fullScreenCover(isPresented: $selectingCountry, onDismiss: { setCountry(country) }) {
TrendingCountrySelectionView(selectedCountry: $country)
}
#if os(tvOS)
.fullScreenCover(isPresented: $selectingCountry, onDismiss: { setCountry(country) }) {
TrendingCountrySelectionView(selectedCountry: $country)
}
#endif
}
fileprivate func setCategory(_ category: TrendingCategory) {

View File

@ -24,20 +24,24 @@ struct VideoCellView: View {
.frame(width: 550, height: 310)
}
Text(video.author)
.padding(8)
.background(.thickMaterial)
.mask(RoundedRectangle(cornerRadius: 12))
.offset(x: -10, y: -120)
.truncationMode(.middle)
if let time = video.playTime {
Text(time)
.fontWeight(.bold)
VStack(alignment: .trailing) {
Text(video.author)
.padding(8)
.background(.thickMaterial)
.mask(RoundedRectangle(cornerRadius: 12))
.offset(x: -10, y: 115)
.offset(x: -5, y: 5)
.truncationMode(.middle)
Spacer()
if let time = video.playTime {
Text(time)
.fontWeight(.bold)
.padding(8)
.background(.thickMaterial)
.mask(RoundedRectangle(cornerRadius: 12))
.offset(x: -5, y: -5)
}
}
}
.frame(width: 550, height: 310)

View File

@ -2,18 +2,15 @@ import Defaults
import SwiftUI
struct VideoContextMenuView: View {
@Default(.tabSelection) var tabSelection
@EnvironmentObject<NavigationState> private var navigationState
let video: Video
@Default(.openVideoID) var openVideoID
@Default(.showingVideoDetails) var showDetails
@Default(.showingAddToPlaylist) var showingAddToPlaylist
@Default(.videoIDToAddToPlaylist) var videoIDToAddToPlaylist
var body: some View {
if tabSelection == .channel {
if navigationState.tabSelection == .channel {
closeChannelButton(from: video)
} else {
openChannelButton(from: video)
@ -21,7 +18,7 @@ struct VideoContextMenuView: View {
openVideoDetailsButton
if tabSelection == .playlists {
if navigationState.tabSelection == .playlists {
removeFromPlaylistButton
} else {
addToPlaylistButton
@ -30,21 +27,19 @@ struct VideoContextMenuView: View {
func openChannelButton(from video: Video) -> some View {
Button("\(video.author) Channel") {
Defaults[.openChannel] = Channel.from(video: video)
tabSelection = .channel
navigationState.openChannel(Channel.from(video: video))
}
}
func closeChannelButton(from video: Video) -> some View {
Button("Close \(Channel.from(video: video).name) Channel") {
Defaults.reset(.openChannel)
navigationState.closeChannel()
}
}
var openVideoDetailsButton: some View {
Button("Open video details") {
openVideoID = video.id
showDetails = true
navigationState.openVideoDetails(video)
}
}

View File

@ -4,64 +4,80 @@ import SwiftUI
import URLImage
struct VideoDetailsView: View {
@Default(.showingVideoDetails) var showDetails
@Environment(\.dismiss) private var dismiss
@EnvironmentObject<NavigationState> private var navigationState
@ObservedObject private var store = Store<Video>()
var resource: Resource {
InvidiousAPI.shared.video(Defaults[.openVideoID])
InvidiousAPI.shared.video(video.id)
}
init() {
var video: Video
init(_ video: Video) {
self.video = video
resource.addObserver(store)
}
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
if let video = store.item {
VStack(alignment: .center) {
ZStack(alignment: .bottom) {
Group {
if let thumbnail = video.thumbnailURL(quality: "maxres") {
// to replace with AsyncImage when it is fixed with lazy views
URLImage(thumbnail) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 1600, height: 800)
}
}
}
.frame(width: 1600, height: 800)
VStack(alignment: .leading) {
Text(video.title)
.font(.system(size: 40))
HStack {
NavigationLink(destination: PlayerView(id: video.id)) {
HStack(spacing: 8) {
Image(systemName: "play.rectangle.fill")
Text("Play")
HStack {
Spacer()
VStack {
Spacer()
ScrollView(.vertical, showsIndicators: false) {
if let video = store.item {
VStack(alignment: .center) {
ZStack(alignment: .bottom) {
Group {
if let thumbnail = video.thumbnailURL(quality: "maxres") {
// to replace with AsyncImage when it is fixed with lazy views
URLImage(thumbnail) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 1600, height: 800)
}
}
}
.frame(width: 1600, height: 800)
openChannelButton
VStack(alignment: .leading) {
Text(video.title)
.font(.system(size: 40))
HStack {
NavigationLink(destination: PlayerView(id: video.id)) {
HStack(spacing: 8) {
Image(systemName: "play.rectangle.fill")
Text("Play")
}
}
openChannelButton
}
}
.padding(40)
.frame(width: 1600, alignment: .leading)
.background(.thinMaterial)
}
.mask(RoundedRectangle(cornerRadius: 20))
VStack {
Text(video.description)
.lineLimit(nil)
.focusable()
}.frame(width: 1600, alignment: .leading)
}
.padding(40)
.frame(width: 1600, alignment: .leading)
.background(.thinMaterial)
}
.mask(RoundedRectangle(cornerRadius: 20))
VStack {
Text(video.description).lineLimit(nil).focusable()
}.frame(width: 1600, alignment: .leading)
Button("A") {}
}
Spacer()
}
Spacer()
}
.background(.thinMaterial)
.onAppear {
resource.loadIfNeeded()
}
@ -72,9 +88,8 @@ struct VideoDetailsView: View {
let channel = Channel.from(video: store.item!)
return Button("Open \(channel.name) channel") {
Defaults[.openChannel] = channel
Defaults[.tabSelection] = .channel
showDetails = false
navigationState.openChannel(channel)
dismiss()
}
}
}

View File

@ -5,85 +5,177 @@ import URLImageStore
struct VideoListRowView: View {
@Environment(\.isFocused) private var focused: Bool
#if os(iOS)
@Environment(\.verticalSizeClass) private var verticalSizeClass
#endif
var video: Video
var body: some View {
NavigationLink(destination: PlayerView(id: video.id)) {
HStack(alignment: .top, spacing: 2) {
Section {
if let thumbnail = video.thumbnailURL(quality: "medium") {
// to replace with AsyncImage when it is fixed with lazy views
URLImage(thumbnail) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 320, height: 180)
#if os(tvOS)
NavigationLink(destination: PlayerView(id: video.id)) {
HStack(alignment: .top, spacing: 2) {
roundedThumbnail
HStack {
VStack(alignment: .leading, spacing: 0) {
videoDetail(video.title, bold: true)
videoDetail(video.author, color: .secondary, bold: true)
Spacer()
additionalDetails
}
.mask(RoundedRectangle(cornerRadius: 12))
} else {
Image(systemName: "exclamationmark.square")
.padding()
Spacer()
}
.frame(minHeight: 180)
}
}
#elseif os(macOS)
NavigationLink(destination: PlayerView(id: video.id)) {
verticalyAlignedDetails
}
#else
ZStack {
if verticalSizeClass == .compact {
HStack(alignment: .top) {
thumbnailWithDetails
.frame(minWidth: 0, maxWidth: 320, minHeight: 0, maxHeight: 180)
.padding(4)
VStack(alignment: .leading) {
videoDetail(video.title, bold: true)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.padding(.top, 10)
additionalDetails
.padding(.top, 4)
}
}
} else {
verticalyAlignedDetails
}
NavigationLink(destination: PlayerView(id: video.id)) {
EmptyView()
}
.buttonStyle(PlainButtonStyle())
.opacity(0)
.frame(height: 0)
}
#endif
}
var additionalDetails: some View {
VStack {
if !video.published.isEmpty || video.views != 0 {
HStack(spacing: 8) {
if !video.published.isEmpty {
Image(systemName: "calendar")
Text(video.published)
}
if video.views != 0 {
Image(systemName: "eye")
Text(video.viewsCount)
}
}
.frame(width: 320, height: 180)
HStack {
VStack(alignment: .leading) {
Text(video.title)
.foregroundColor(.primary)
.bold()
.lineLimit(1)
Text("\(video.author)")
.foregroundColor(.secondary)
.bold()
.lineLimit(1)
if !video.published.isEmpty || video.views != 0 {
HStack(spacing: 8) {
if !video.published.isEmpty {
Image(systemName: "calendar")
Text(video.published)
}
if video.views != 0 {
Image(systemName: "eye")
Text(video.viewsCount)
}
}
.foregroundColor(.secondary)
.padding(.top)
}
}
.padding()
Spacer()
HStack(spacing: 8) {
if let time = video.playTime {
Image(systemName: "clock")
Text(time)
.fontWeight(.bold)
}
}
#if os(tvOS)
.foregroundColor(.secondary)
}
.frame(minHeight: 180)
#else
.foregroundColor(focused ? .white : .secondary)
#endif
}
}
}
}
// struct VideoThumbnailView_Previews: PreviewProvider {
// static var previews: some View {
// VideoThumbnailView(video: Video(
// id: "A",
// title: "A very very long text which",
// thumbnailURL: URL(string: "https://invidious.home.arekf.net/vi/yXohcxCKqvo/maxres.jpg")!,
// author: "Bear",
// length: 240,
// published: "2 days ago",
// channelID: ""
// )).frame(maxWidth: 350)
// }
// }
var verticalyAlignedDetails: some View {
VStack(alignment: .leading) {
thumbnailWithDetails
.frame(minWidth: 0, maxWidth: 600)
.padding([.leading, .top, .trailing], 4)
VStack(alignment: .leading) {
videoDetail(video.title, bold: true)
.padding(.bottom)
additionalDetails
.padding(.bottom, 10)
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 8)
}
}
var thumbnailWithDetails: some View {
Group {
ZStack(alignment: .trailing) {
if let thumbnail = video.thumbnailURL(quality: "maxres") {
// to replace with AsyncImage when it is fixed with lazy views
URLImage(thumbnail) { image in
image
.resizable()
.aspectRatio(contentMode: .fit)
.frame(minWidth: 0, maxWidth: 600, minHeight: 0, maxHeight: .infinity)
.background(Color.black)
}
.mask(RoundedRectangle(cornerRadius: 12))
} else {
Image(systemName: "exclamationmark.square")
}
VStack(alignment: .trailing) {
Text(video.author)
.padding(8)
.background(.thinMaterial)
.mask(RoundedRectangle(cornerRadius: 12))
.offset(x: -5, y: 5)
.truncationMode(.middle)
Spacer()
if let time = video.playTime {
Text(time)
.fontWeight(.bold)
.padding(8)
.background(.thinMaterial)
.mask(RoundedRectangle(cornerRadius: 12))
.offset(x: -5, y: -5)
}
}
}
}
}
var roundedThumbnail: some View {
Section {
if let thumbnail = video.thumbnailURL(quality: "high") {
// to replace with AsyncImage when it is fixed with lazy views
URLImage(thumbnail) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(minWidth: 0, maxWidth: 320, minHeight: 0, maxHeight: 180)
}
.mask(RoundedRectangle(cornerRadius: 12))
} else {
Image(systemName: "exclamationmark.square")
}
}
.frame(width: 320, height: 180)
}
func videoDetail(_ text: String, color: Color? = .primary, bold: Bool = false) -> some View {
Text(text)
.fontWeight(bold ? .bold : .regular)
#if os(tvOS)
.foregroundColor(color)
.lineLimit(1)
.truncationMode(.middle)
#elseif os(iOS) || os(macOS)
.foregroundColor(focused ? .white : color)
#endif
}
}

View File

@ -2,8 +2,6 @@ import Defaults
import SwiftUI
struct VideosCellsView: View {
@Default(.tabSelection) var tabSelection
@State private var columns: Int
init(videos: [Video], columns: Int = 3) {
@ -15,7 +13,7 @@ struct VideosCellsView: View {
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
LazyVGrid(columns: items, alignment: .center, spacing: 10) {
LazyVGrid(columns: items, alignment: .center) {
ForEach(videos) { video in
VideoCellView(video: video)
.contextMenu { VideoContextMenuView(video: video) }
@ -28,7 +26,7 @@ struct VideosCellsView: View {
var items: [GridItem] {
Array(repeating: .init(.fixed(600)), count: gridColumns)
}
var gridColumns: Int {
videos.count < columns ? videos.count : columns
}

View File

@ -10,10 +10,18 @@ struct VideosListView: View {
ForEach(videos) { video in
VideoListRowView(video: video)
.contextMenu { VideoContextMenuView(video: video) }
#if os(tvOS)
.listRowInsets(listRowInsets)
#elseif os(iOS)
.listRowInsets(EdgeInsets(.zero))
.listRowSeparator(.hidden)
#endif
}
}
.listStyle(GroupedListStyle())
#if os(tvOS)
.listStyle(GroupedListStyle())
#endif
}
}

View File

@ -5,22 +5,35 @@ struct VideosView: View {
@State private var profile = Profile()
@Default(.layout) var layout
@Default(.tabSelection) var tabSelection
@Default(.showingAddToPlaylist) var showingAddToPlaylist
#if os(iOS)
@Environment(\.verticalSizeClass) private var horizontalSizeClass
#endif
var videos: [Video]
var body: some View {
VStack {
if layout == .cells {
VideosCellsView(videos: videos, columns: self.profile.cellsColumns)
} else {
#if os(tvOS)
if layout == .cells {
VideosCellsView(videos: videos, columns: self.profile.cellsColumns)
} else {
VideosListView(videos: videos)
}
#else
VideosListView(videos: videos)
#if os(macOS)
.frame(minWidth: 250, idealWidth: 350)
#endif
#endif
}
#if os(tvOS)
.fullScreenCover(isPresented: $showingAddToPlaylist) {
AddToPlaylistView()
}
}
.fullScreenCover(isPresented: $showingAddToPlaylist) {
AddToPlaylistView()
}
#endif
}
}

View File

@ -0,0 +1,43 @@
import Foundation
import SwiftUI
final class NavigationState: ObservableObject {
@Published var tabSelection: TabSelection = .subscriptions
@Published var showingChannel = false
@Published var channel: Channel?
@Published var showingVideoDetails = false
@Published var video: Video?
func openChannel(_ channel: Channel) {
self.channel = channel
showingChannel = true
}
func closeChannel() {
showingChannel = false
channel = nil
}
func openVideoDetails(_ video: Video) {
self.video = video
showingVideoDetails = true
}
func closeVideoDetails() {
showingVideoDetails = false
video = nil
}
var tabSelectionOptionalBinding: Binding<TabSelection?> {
Binding<TabSelection?>(
get: {
self.tabSelection
},
set: {
self.tabSelection = $0 ?? .subscriptions
}
)
}
}

View File

@ -1,7 +1,9 @@
import AVFoundation
import Foundation
import Logging
import UIKit
#if !os(macOS)
import UIKit
#endif
final class PlayerState: ObservableObject {
let logger = Logger(label: "net.arekf.Pearvidious.ps")
@ -36,15 +38,19 @@ final class PlayerState: ObservableObject {
makeMetadataItem(.commonIdentifierDescription, value: video.description)
]
if let thumbnailData = try? Data(contentsOf: video.thumbnailURL(quality: "high")!),
let image = UIImage(data: thumbnailData),
let pngData = image.pngData()
{
let artworkItem = makeMetadataItem(.commonIdentifierArtwork, value: pngData)
externalMetadata.append(artworkItem)
}
#if !os(macOS)
playerItem.externalMetadata = externalMetadata
if let thumbnailData = try? Data(contentsOf: video.thumbnailURL(quality: "high")!),
let image = UIImage(data: thumbnailData),
let pngData = image.pngData()
{
let artworkItem = makeMetadataItem(.commonIdentifierArtwork, value: pngData)
externalMetadata.append(artworkItem)
}
playerItem.externalMetadata = externalMetadata
#endif
playerItem.preferredForwardBufferDuration = 10

View File

@ -15,4 +15,8 @@ final class SearchQuery: ObservableObject {
self.date = date
self.duration = duration
}
var isEmpty: Bool {
query.isEmpty
}
}

View File

@ -14,15 +14,15 @@
371231842683E62F0000B307 /* VideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371231832683E62F0000B307 /* VideosView.swift */; };
371231852683E7820000B307 /* VideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371231832683E62F0000B307 /* VideosView.swift */; };
371231862683E7820000B307 /* VideosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371231832683E62F0000B307 /* VideosView.swift */; };
37141668267A83F9006CA35D /* StreamAVPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37141667267A83F9006CA35D /* StreamAVPlayerViewController.swift */; };
37141669267A83F9006CA35D /* StreamAVPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37141667267A83F9006CA35D /* StreamAVPlayerViewController.swift */; };
3714166A267A83F9006CA35D /* StreamAVPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37141667267A83F9006CA35D /* StreamAVPlayerViewController.swift */; };
3714166F267A8ACC006CA35D /* TrendingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3714166E267A8ACC006CA35D /* TrendingView.swift */; };
37141670267A8ACC006CA35D /* TrendingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3714166E267A8ACC006CA35D /* TrendingView.swift */; };
37141671267A8ACC006CA35D /* TrendingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3714166E267A8ACC006CA35D /* TrendingView.swift */; };
37141673267A8E10006CA35D /* Country.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37141672267A8E10006CA35D /* Country.swift */; };
37141674267A8E10006CA35D /* Country.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37141672267A8E10006CA35D /* Country.swift */; };
37141675267A8E10006CA35D /* Country.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37141672267A8E10006CA35D /* Country.swift */; };
371F2F1A269B43D300E4A7AB /* NavigationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371F2F19269B43D300E4A7AB /* NavigationState.swift */; };
371F2F1B269B43D300E4A7AB /* NavigationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371F2F19269B43D300E4A7AB /* NavigationState.swift */; };
371F2F1C269B43D300E4A7AB /* NavigationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371F2F19269B43D300E4A7AB /* NavigationState.swift */; };
372915E42687E33E00F5A35B /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = 372915E32687E33E00F5A35B /* Defaults */; };
372915E62687E3B900F5A35B /* Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372915E52687E3B900F5A35B /* Defaults.swift */; };
372915E72687E3B900F5A35B /* Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372915E52687E3B900F5A35B /* Defaults.swift */; };
@ -64,6 +64,7 @@
373CFAF02697A78B003CB2C6 /* AddToPlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */; };
373CFAF12697A78B003CB2C6 /* AddToPlaylistView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */; };
3741B5302676213400125C5E /* PlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3741B52F2676213400125C5E /* PlayerViewController.swift */; };
3755A0C2269B772000F67988 /* StreamAVPlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3755A0C1269B772000F67988 /* StreamAVPlayerViewController.swift */; };
376578852685429C00D4EA09 /* CaseIterable+Next.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376578842685429C00D4EA09 /* CaseIterable+Next.swift */; };
376578862685429C00D4EA09 /* CaseIterable+Next.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376578842685429C00D4EA09 /* CaseIterable+Next.swift */; };
376578872685429C00D4EA09 /* CaseIterable+Next.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376578842685429C00D4EA09 /* CaseIterable+Next.swift */; };
@ -73,10 +74,10 @@
376578912685490700D4EA09 /* PlaylistsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376578902685490700D4EA09 /* PlaylistsView.swift */; };
376578922685490700D4EA09 /* PlaylistsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376578902685490700D4EA09 /* PlaylistsView.swift */; };
376578932685490700D4EA09 /* PlaylistsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376578902685490700D4EA09 /* PlaylistsView.swift */; };
3774063826999F7C00304C93 /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B1822671681B00C925CA /* PlayerView.swift */; };
377A20A92693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
377A20AA2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
377A20AB2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */; };
377FC7D3267A080300A6BBAF /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 377FC7D2267A080300A6BBAF /* Alamofire */; };
377FC7D5267A080300A6BBAF /* SwiftyJSON in Frameworks */ = {isa = PBXBuildFile; productRef = 377FC7D4267A080300A6BBAF /* SwiftyJSON */; };
377FC7D7267A080300A6BBAF /* URLImage in Frameworks */ = {isa = PBXBuildFile; productRef = 377FC7D6267A080300A6BBAF /* URLImage */; };
377FC7D9267A080300A6BBAF /* URLImageStore in Frameworks */ = {isa = PBXBuildFile; productRef = 377FC7D8267A080300A6BBAF /* URLImageStore */; };
@ -92,10 +93,7 @@
377FC7E4267A084E00A6BBAF /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF27F26737550007FC770 /* SearchView.swift */; };
377FC7E5267A084E00A6BBAF /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37AAF27F26737550007FC770 /* SearchView.swift */; };
377FC7E6267A085600A6BBAF /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B1822671681B00C925CA /* PlayerView.swift */; };
377FC7E7267A085600A6BBAF /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B1822671681B00C925CA /* PlayerView.swift */; };
377FC7E8267A085D00A6BBAF /* PlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3741B52F2676213400125C5E /* PlayerViewController.swift */; };
377FC7E9267A085D00A6BBAF /* PlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3741B52F2676213400125C5E /* PlayerViewController.swift */; };
377FC7EB267A0A0800A6BBAF /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 377FC7EA267A0A0800A6BBAF /* Alamofire */; };
377FC7ED267A0A0800A6BBAF /* SwiftyJSON in Frameworks */ = {isa = PBXBuildFile; productRef = 377FC7EC267A0A0800A6BBAF /* SwiftyJSON */; };
377FC7EF267A0A0800A6BBAF /* URLImage in Frameworks */ = {isa = PBXBuildFile; productRef = 377FC7EE267A0A0800A6BBAF /* URLImage */; };
377FC7F1267A0A0800A6BBAF /* URLImageStore in Frameworks */ = {isa = PBXBuildFile; productRef = 377FC7F0267A0A0800A6BBAF /* URLImageStore */; };
@ -126,8 +124,6 @@
37B17DA0268A1F89006AEE9B /* VideoContextMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B17D9F268A1F25006AEE9B /* VideoContextMenuView.swift */; };
37B17DA1268A1F89006AEE9B /* VideoContextMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B17D9F268A1F25006AEE9B /* VideoContextMenuView.swift */; };
37B17DA2268A1F8A006AEE9B /* VideoContextMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B17D9F268A1F25006AEE9B /* VideoContextMenuView.swift */; };
37B17DA4268A285E006AEE9B /* VideoDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B17DA3268A285E006AEE9B /* VideoDetailsView.swift */; };
37B17DA5268A285E006AEE9B /* VideoDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B17DA3268A285E006AEE9B /* VideoDetailsView.swift */; };
37B17DA6268A285E006AEE9B /* VideoDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B17DA3268A285E006AEE9B /* VideoDetailsView.swift */; };
37B767DB2677C3CA0098BAA8 /* PlayerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B767DA2677C3CA0098BAA8 /* PlayerState.swift */; };
37B767DC2677C3CA0098BAA8 /* PlayerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B767DA2677C3CA0098BAA8 /* PlayerState.swift */; };
@ -136,6 +132,23 @@
37B76E96268747C900CE5671 /* OptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B76E95268747C900CE5671 /* OptionsView.swift */; };
37B76E97268747C900CE5671 /* OptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B76E95268747C900CE5671 /* OptionsView.swift */; };
37B76E98268747C900CE5671 /* OptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B76E95268747C900CE5671 /* OptionsView.swift */; };
37BAB54C269B39FD00E75ED1 /* TVNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BAB54B269B39FD00E75ED1 /* TVNavigationView.swift */; };
37BADCA52699FB72009BE4FB /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 37BADCA42699FB72009BE4FB /* Alamofire */; };
37BADCA7269A552E009BE4FB /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 37BADCA6269A552E009BE4FB /* Alamofire */; };
37BADCA9269A570B009BE4FB /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 37BADCA8269A570B009BE4FB /* Alamofire */; };
37BD07B52698AA4D003EBB87 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BD07B42698AA4D003EBB87 /* ContentView.swift */; };
37BD07B72698AB2E003EBB87 /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = 37BD07B62698AB2E003EBB87 /* Defaults */; };
37BD07B92698AB2E003EBB87 /* Siesta in Frameworks */ = {isa = PBXBuildFile; productRef = 37BD07B82698AB2E003EBB87 /* Siesta */; };
37BD07BB2698AB60003EBB87 /* AppSidebarNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BD07BA2698AB60003EBB87 /* AppSidebarNavigation.swift */; };
37BD07BC2698AB60003EBB87 /* AppSidebarNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BD07BA2698AB60003EBB87 /* AppSidebarNavigation.swift */; };
37BD07BE2698AC96003EBB87 /* Defaults in Frameworks */ = {isa = PBXBuildFile; productRef = 37BD07BD2698AC96003EBB87 /* Defaults */; };
37BD07C02698AC97003EBB87 /* Siesta in Frameworks */ = {isa = PBXBuildFile; productRef = 37BD07BF2698AC97003EBB87 /* Siesta */; };
37BD07C12698AD3B003EBB87 /* TrendingCountrySelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3705B17F267B4DFB00704544 /* TrendingCountrySelectionView.swift */; };
37BD07C32698AD4F003EBB87 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BD07B42698AA4D003EBB87 /* ContentView.swift */; };
37BD07C72698B27B003EBB87 /* Introspect in Frameworks */ = {isa = PBXBuildFile; productRef = 37BD07C62698B27B003EBB87 /* Introspect */; };
37BD07C82698B71C003EBB87 /* AppTabNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0C32671614700C925CA /* AppTabNavigation.swift */; };
37BD07C92698FBDB003EBB87 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BD07B42698AA4D003EBB87 /* ContentView.swift */; };
37BD07CA2698FBE5003EBB87 /* AppSidebarNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37BD07BA2698AB60003EBB87 /* AppSidebarNavigation.swift */; };
37C7A1D5267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */; };
37C7A1D6267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */; };
37C7A1D7267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */; };
@ -159,18 +172,15 @@
37D4B0E32671614900C925CA /* Tests_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0E22671614900C925CA /* Tests_macOS.swift */; };
37D4B0E42671614900C925CA /* PearvidiousApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0C22671614700C925CA /* PearvidiousApp.swift */; };
37D4B0E52671614900C925CA /* PearvidiousApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0C22671614700C925CA /* PearvidiousApp.swift */; };
37D4B0E62671614900C925CA /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0C32671614700C925CA /* ContentView.swift */; };
37D4B0E72671614900C925CA /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0C32671614700C925CA /* ContentView.swift */; };
37D4B0E82671614900C925CA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 37D4B0C42671614800C925CA /* Assets.xcassets */; };
37D4B0E92671614900C925CA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 37D4B0C42671614800C925CA /* Assets.xcassets */; };
37D4B15F267164AF00C925CA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 37D4B15E267164AF00C925CA /* Assets.xcassets */; };
37D4B176267164B000C925CA /* PearvidiousUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B175267164B000C925CA /* PearvidiousUITests.swift */; };
37D4B1802671650A00C925CA /* PearvidiousApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0C22671614700C925CA /* PearvidiousApp.swift */; };
37D4B1812671653A00C925CA /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0C32671614700C925CA /* ContentView.swift */; };
37D4B1812671653A00C925CA /* AppTabNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B0C32671614700C925CA /* AppTabNavigation.swift */; };
37D4B1842671684E00C925CA /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B1822671681B00C925CA /* PlayerView.swift */; };
37D4B1862671691600C925CA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 37D4B0C42671614800C925CA /* Assets.xcassets */; };
37D4B18E26717B3800C925CA /* VideoListRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B18B26717B3800C925CA /* VideoListRowView.swift */; };
37D4B19126717C6900C925CA /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 37D4B19026717C6900C925CA /* Alamofire */; };
37D4B19726717E1500C925CA /* Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B19626717E1500C925CA /* Video.swift */; };
37D4B19826717E1500C925CA /* Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B19626717E1500C925CA /* Video.swift */; };
37D4B19926717E1500C925CA /* Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D4B19626717E1500C925CA /* Video.swift */; };
@ -219,9 +229,9 @@
3705B17F267B4DFB00704544 /* TrendingCountrySelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrendingCountrySelectionView.swift; sourceTree = "<group>"; };
3705B181267B4E4900704544 /* TrendingCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrendingCategory.swift; sourceTree = "<group>"; };
371231832683E62F0000B307 /* VideosView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideosView.swift; sourceTree = "<group>"; };
37141667267A83F9006CA35D /* StreamAVPlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamAVPlayerViewController.swift; sourceTree = "<group>"; };
3714166E267A8ACC006CA35D /* TrendingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrendingView.swift; sourceTree = "<group>"; };
37141672267A8E10006CA35D /* Country.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Country.swift; sourceTree = "<group>"; };
371F2F19269B43D300E4A7AB /* NavigationState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationState.swift; sourceTree = "<group>"; };
372915E52687E3B900F5A35B /* Defaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Defaults.swift; sourceTree = "<group>"; };
372915E92687EBA500F5A35B /* ListingLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListingLayout.swift; sourceTree = "<group>"; };
373CFABD26966115003CB2C6 /* CoverSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoverSectionView.swift; sourceTree = "<group>"; };
@ -236,6 +246,7 @@
373CFAEA26975CBF003CB2C6 /* PlaylistFormView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistFormView.swift; sourceTree = "<group>"; };
373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddToPlaylistView.swift; sourceTree = "<group>"; };
3741B52F2676213400125C5E /* PlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerViewController.swift; sourceTree = "<group>"; };
3755A0C1269B772000F67988 /* StreamAVPlayerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StreamAVPlayerViewController.swift; sourceTree = "<group>"; };
376578842685429C00D4EA09 /* CaseIterable+Next.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CaseIterable+Next.swift"; sourceTree = "<group>"; };
376578882685471400D4EA09 /* Playlist.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Playlist.swift; sourceTree = "<group>"; };
376578902685490700D4EA09 /* PlaylistsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaylistsView.swift; sourceTree = "<group>"; };
@ -254,6 +265,10 @@
37B17DA3268A285E006AEE9B /* VideoDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoDetailsView.swift; sourceTree = "<group>"; };
37B767DA2677C3CA0098BAA8 /* PlayerState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerState.swift; sourceTree = "<group>"; };
37B76E95268747C900CE5671 /* OptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsView.swift; sourceTree = "<group>"; };
37BAB54B269B39FD00E75ED1 /* TVNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TVNavigationView.swift; sourceTree = "<group>"; };
37BD07B42698AA4D003EBB87 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
37BD07BA2698AB60003EBB87 /* AppSidebarNavigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSidebarNavigation.swift; sourceTree = "<group>"; };
37BD07C42698ADEE003EBB87 /* Pearvidious.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Pearvidious.entitlements; sourceTree = "<group>"; };
37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SponsorBlockSegment.swift; sourceTree = "<group>"; };
37C7A1DB267CE9D90010EAD6 /* Profile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Profile.swift; sourceTree = "<group>"; };
37CEE4B42677B628005A1EFE /* StreamType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamType.swift; sourceTree = "<group>"; };
@ -261,7 +276,7 @@
37CEE4BC2677B670005A1EFE /* AudioVideoStream.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioVideoStream.swift; sourceTree = "<group>"; };
37CEE4C02677B697005A1EFE /* Stream.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stream.swift; sourceTree = "<group>"; };
37D4B0C22671614700C925CA /* PearvidiousApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PearvidiousApp.swift; sourceTree = "<group>"; };
37D4B0C32671614700C925CA /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
37D4B0C32671614700C925CA /* AppTabNavigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTabNavigation.swift; sourceTree = "<group>"; };
37D4B0C42671614800C925CA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
37D4B0C92671614900C925CA /* Pearvidious.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Pearvidious.app; sourceTree = BUILT_PRODUCTS_DIR; };
37D4B0CF2671614900C925CA /* Pearvidious.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Pearvidious.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -288,10 +303,13 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
37BD07B72698AB2E003EBB87 /* Defaults in Frameworks */,
37BADCA52699FB72009BE4FB /* Alamofire in Frameworks */,
377FC7D9267A080300A6BBAF /* URLImageStore in Frameworks */,
377FC7D5267A080300A6BBAF /* SwiftyJSON in Frameworks */,
37BD07B92698AB2E003EBB87 /* Siesta in Frameworks */,
377FC7D7267A080300A6BBAF /* URLImage in Frameworks */,
377FC7D3267A080300A6BBAF /* Alamofire in Frameworks */,
37BD07C72698B27B003EBB87 /* Introspect in Frameworks */,
377FC7DB267A080300A6BBAF /* Logging in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -300,10 +318,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
37BD07BE2698AC96003EBB87 /* Defaults in Frameworks */,
37BADCA7269A552E009BE4FB /* Alamofire in Frameworks */,
377FC7F1267A0A0800A6BBAF /* URLImageStore in Frameworks */,
377FC7ED267A0A0800A6BBAF /* SwiftyJSON in Frameworks */,
37BD07C02698AC97003EBB87 /* Siesta in Frameworks */,
377FC7EF267A0A0800A6BBAF /* URLImage in Frameworks */,
377FC7EB267A0A0800A6BBAF /* Alamofire in Frameworks */,
377FC7F3267A0A0800A6BBAF /* Logging in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -327,11 +347,11 @@
buildActionMask = 2147483647;
files = (
372915E42687E33E00F5A35B /* Defaults in Frameworks */,
37BADCA9269A570B009BE4FB /* Alamofire in Frameworks */,
37D4B1AD2672580400C925CA /* URLImageStore in Frameworks */,
37D4B19D2671817900C925CA /* SwiftyJSON in Frameworks */,
3797757D268922D100DD52A8 /* Siesta in Frameworks */,
37D4B1AB2672580400C925CA /* URLImage in Frameworks */,
37D4B19126717C6900C925CA /* Alamofire in Frameworks */,
37B767E02678C5BF0098BAA8 /* Logging in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -381,13 +401,15 @@
37D4B0C12671614700C925CA /* Shared */ = {
isa = PBXGroup;
children = (
37D4B0C32671614700C925CA /* ContentView.swift */,
37BD07BA2698AB60003EBB87 /* AppSidebarNavigation.swift */,
37BD07B42698AA4D003EBB87 /* ContentView.swift */,
37141672267A8E10006CA35D /* Country.swift */,
372915E52687E3B900F5A35B /* Defaults.swift */,
372915E92687EBA500F5A35B /* ListingLayout.swift */,
37D4B0C22671614700C925CA /* PearvidiousApp.swift */,
37AAF2932674086B007FC770 /* TabSelection.swift */,
37D4B0C42671614800C925CA /* Assets.xcassets */,
37BD07C42698ADEE003EBB87 /* Pearvidious.entitlements */,
);
path = Shared;
sourceTree = "<group>";
@ -425,6 +447,7 @@
isa = PBXGroup;
children = (
373CFAEE2697A78B003CB2C6 /* AddToPlaylistView.swift */,
37D4B0C32671614700C925CA /* AppTabNavigation.swift */,
37AAF2892673AB89007FC770 /* ChannelView.swift */,
373CFAC126966159003CB2C6 /* CoverSectionRowView.swift */,
373CFABD26966115003CB2C6 /* CoverSectionView.swift */,
@ -436,10 +459,11 @@
37AAF27D26737323007FC770 /* PopularVideosView.swift */,
373CFAC52696617C003CB2C6 /* SearchOptionsView.swift */,
37AAF27F26737550007FC770 /* SearchView.swift */,
37141667267A83F9006CA35D /* StreamAVPlayerViewController.swift */,
3755A0C1269B772000F67988 /* StreamAVPlayerViewController.swift */,
37AAF29F26741C97007FC770 /* SubscriptionsView.swift */,
3705B17F267B4DFB00704544 /* TrendingCountrySelectionView.swift */,
3714166E267A8ACC006CA35D /* TrendingView.swift */,
37BAB54B269B39FD00E75ED1 /* TVNavigationView.swift */,
37F4AE752682908700BD60EA /* VideoCellView.swift */,
37B17D9F268A1F25006AEE9B /* VideoContextMenuView.swift */,
37B17DA3268A285E006AEE9B /* VideoDetailsView.swift */,
@ -447,8 +471,8 @@
37F4AE7126828F0900BD60EA /* VideosCellsView.swift */,
37AAF29926740A01007FC770 /* VideosListView.swift */,
371231832683E62F0000B307 /* VideosView.swift */,
37D4B1AE26729DEB00C925CA /* Info.plist */,
37D4B15E267164AF00C925CA /* Assets.xcassets */,
37D4B1AE26729DEB00C925CA /* Info.plist */,
);
path = "Apple TV";
sourceTree = "<group>";
@ -467,6 +491,7 @@
37CEE4BC2677B670005A1EFE /* AudioVideoStream.swift */,
37AAF28F26740715007FC770 /* Channel.swift */,
37977582268922F600DD52A8 /* InvidiousAPI.swift */,
371F2F19269B43D300E4A7AB /* NavigationState.swift */,
37B767DA2677C3CA0098BAA8 /* PlayerState.swift */,
376578882685471400D4EA09 /* Playlist.swift */,
373CFAE226974812003CB2C6 /* PlaylistVisibility.swift */,
@ -499,6 +524,7 @@
37D4B0C52671614900C925CA /* Sources */,
37D4B0C62671614900C925CA /* Frameworks */,
37D4B0C72671614900C925CA /* Resources */,
37BAB54A269B308600E75ED1 /* Run Swiftformat */,
);
buildRules = (
);
@ -506,11 +532,14 @@
);
name = "Pearvidious (iOS)";
packageProductDependencies = (
377FC7D2267A080300A6BBAF /* Alamofire */,
377FC7D4267A080300A6BBAF /* SwiftyJSON */,
377FC7D6267A080300A6BBAF /* URLImage */,
377FC7D8267A080300A6BBAF /* URLImageStore */,
377FC7DA267A080300A6BBAF /* Logging */,
37BD07B62698AB2E003EBB87 /* Defaults */,
37BD07B82698AB2E003EBB87 /* Siesta */,
37BD07C62698B27B003EBB87 /* Introspect */,
37BADCA42699FB72009BE4FB /* Alamofire */,
);
productName = "Pearvidious (iOS)";
productReference = 37D4B0C92671614900C925CA /* Pearvidious.app */;
@ -530,11 +559,13 @@
);
name = "Pearvidious (macOS)";
packageProductDependencies = (
377FC7EA267A0A0800A6BBAF /* Alamofire */,
377FC7EC267A0A0800A6BBAF /* SwiftyJSON */,
377FC7EE267A0A0800A6BBAF /* URLImage */,
377FC7F0267A0A0800A6BBAF /* URLImageStore */,
377FC7F2267A0A0800A6BBAF /* Logging */,
37BD07BD2698AC96003EBB87 /* Defaults */,
37BD07BF2698AC97003EBB87 /* Siesta */,
37BADCA6269A552E009BE4FB /* Alamofire */,
);
productName = "Pearvidious (macOS)";
productReference = 37D4B0CF2671614900C925CA /* Pearvidious.app */;
@ -590,13 +621,13 @@
);
name = "Pearvidious (Apple TV)";
packageProductDependencies = (
37D4B19026717C6900C925CA /* Alamofire */,
37D4B19C2671817900C925CA /* SwiftyJSON */,
37D4B1AA2672580400C925CA /* URLImage */,
37D4B1AC2672580400C925CA /* URLImageStore */,
37B767DF2678C5BF0098BAA8 /* Logging */,
372915E32687E33E00F5A35B /* Defaults */,
3797757C268922D100DD52A8 /* Siesta */,
37BADCA8269A570B009BE4FB /* Alamofire */,
);
productName = Pearvidious;
productReference = 37D4B158267164AE00C925CA /* Pearvidious (Apple TV).app */;
@ -663,12 +694,13 @@
);
mainGroup = 37D4B0BC2671614700C925CA;
packageReferences = (
37D4B18F26717C6900C925CA /* XCRemoteSwiftPackageReference "Alamofire" */,
37D4B19B2671817900C925CA /* XCRemoteSwiftPackageReference "SwiftyJSON" */,
37D4B1A92672580400C925CA /* XCRemoteSwiftPackageReference "url-image" */,
37B767DE2678C5BF0098BAA8 /* XCRemoteSwiftPackageReference "swift-log" */,
372915E22687E33E00F5A35B /* XCRemoteSwiftPackageReference "Defaults" */,
3797757B268922D100DD52A8 /* XCRemoteSwiftPackageReference "siesta" */,
37BD07C52698B27B003EBB87 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */,
37BADCA32699FB72009BE4FB /* XCRemoteSwiftPackageReference "Alamofire" */,
);
productRefGroup = 37D4B0CA2671614900C925CA /* Products */;
projectDirPath = "";
@ -733,14 +765,36 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
37BAB54A269B308600E75ED1 /* Run Swiftformat */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run Swiftformat";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftformat >/dev/null; then\n swiftformat .\nelse\n echo \"warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
37D4B0C52671614900C925CA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
37CEE4BD2677B670005A1EFE /* AudioVideoStream.swift in Sources */,
37141668267A83F9006CA35D /* StreamAVPlayerViewController.swift in Sources */,
37BD07C82698B71C003EBB87 /* AppTabNavigation.swift in Sources */,
37EAD86B267B9C5600D9E01B /* SponsorBlockAPI.swift in Sources */,
37BD07B52698AA4D003EBB87 /* ContentView.swift in Sources */,
37F4AE762682908700BD60EA /* VideoCellView.swift in Sources */,
37C7A1DA267CACF50010EAD6 /* TrendingCountrySelectionView.swift in Sources */,
377FC7E6267A085600A6BBAF /* PlayerView.swift in Sources */,
@ -749,10 +803,8 @@
37F4AE7226828F0900BD60EA /* VideosCellsView.swift in Sources */,
373CFAE326974812003CB2C6 /* PlaylistVisibility.swift in Sources */,
376578852685429C00D4EA09 /* CaseIterable+Next.swift in Sources */,
37D4B0E62671614900C925CA /* ContentView.swift in Sources */,
377FC7DC267A081800A6BBAF /* PopularVideosView.swift in Sources */,
373CFAC62696617C003CB2C6 /* SearchOptionsView.swift in Sources */,
37B17DA4268A285E006AEE9B /* VideoDetailsView.swift in Sources */,
371231842683E62F0000B307 /* VideosView.swift in Sources */,
3705B182267B4E4900704544 /* TrendingCategory.swift in Sources */,
37EAD86F267B9ED100D9E01B /* Segment.swift in Sources */,
@ -787,7 +839,9 @@
377FC7DF267A082200A6BBAF /* VideosListView.swift in Sources */,
372915E62687E3B900F5A35B /* Defaults.swift in Sources */,
37D4B19726717E1500C925CA /* Video.swift in Sources */,
371F2F1A269B43D300E4A7AB /* NavigationState.swift in Sources */,
37B76E96268747C900CE5671 /* OptionsView.swift in Sources */,
37BD07BB2698AB60003EBB87 /* AppSidebarNavigation.swift in Sources */,
37D4B0E42671614900C925CA /* PearvidiousApp.swift in Sources */,
37CEE4B92677B63F005A1EFE /* StreamResolution.swift in Sources */,
3797758B2689345500DD52A8 /* Store.swift in Sources */,
@ -799,17 +853,16 @@
buildActionMask = 2147483647;
files = (
37CEE4BE2677B670005A1EFE /* AudioVideoStream.swift in Sources */,
37B17DA5268A285E006AEE9B /* VideoDetailsView.swift in Sources */,
37F4AE772682908700BD60EA /* VideoCellView.swift in Sources */,
373CFABF26966149003CB2C6 /* CoverSectionView.swift in Sources */,
37141669267A83F9006CA35D /* StreamAVPlayerViewController.swift in Sources */,
37EAD86C267B9C5600D9E01B /* SponsorBlockAPI.swift in Sources */,
377FC7E7267A085600A6BBAF /* PlayerView.swift in Sources */,
37CEE4C22677B697005A1EFE /* Stream.swift in Sources */,
37D4B0E72671614900C925CA /* ContentView.swift in Sources */,
371F2F1B269B43D300E4A7AB /* NavigationState.swift in Sources */,
372915EB2687EBA500F5A35B /* ListingLayout.swift in Sources */,
3774063826999F7C00304C93 /* PlayerView.swift in Sources */,
377FC7DD267A081A00A6BBAF /* PopularVideosView.swift in Sources */,
3705B183267B4E4900704544 /* TrendingCategory.swift in Sources */,
37BD07C32698AD4F003EBB87 /* ContentView.swift in Sources */,
37EAD870267B9ED100D9E01B /* Segment.swift in Sources */,
37CEE4B62677B628005A1EFE /* StreamType.swift in Sources */,
37141670267A8ACC006CA35D /* TrendingView.swift in Sources */,
@ -819,10 +872,10 @@
373CFAC32696616C003CB2C6 /* CoverSectionRowView.swift in Sources */,
37AAF29126740715007FC770 /* Channel.swift in Sources */,
373CFAC726966187003CB2C6 /* SearchOptionsView.swift in Sources */,
37BD07BC2698AB60003EBB87 /* AppSidebarNavigation.swift in Sources */,
37AAF2952674086B007FC770 /* TabSelection.swift in Sources */,
372915E72687E3B900F5A35B /* Defaults.swift in Sources */,
376578922685490700D4EA09 /* PlaylistsView.swift in Sources */,
377FC7E8267A085D00A6BBAF /* PlayerViewController.swift in Sources */,
377FC7E4267A084E00A6BBAF /* SearchView.swift in Sources */,
377A20AA2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */,
373CFAD8269662CD003CB2C6 /* SearchDuration.swift in Sources */,
@ -842,6 +895,7 @@
377FC7DE267A082100A6BBAF /* VideosListView.swift in Sources */,
37D4B19826717E1500C925CA /* Video.swift in Sources */,
37D4B0E52671614900C925CA /* PearvidiousApp.swift in Sources */,
37BD07C12698AD3B003EBB87 /* TrendingCountrySelectionView.swift in Sources */,
373CFAE426974812003CB2C6 /* PlaylistVisibility.swift in Sources */,
37CEE4BA2677B63F005A1EFE /* StreamResolution.swift in Sources */,
373CFAEC26975CBF003CB2C6 /* PlaylistFormView.swift in Sources */,
@ -877,7 +931,6 @@
37EAD871267B9ED100D9E01B /* Segment.swift in Sources */,
37CEE4BF2677B670005A1EFE /* AudioVideoStream.swift in Sources */,
37CEE4B72677B628005A1EFE /* StreamType.swift in Sources */,
3714166A267A83F9006CA35D /* StreamAVPlayerViewController.swift in Sources */,
37F4AE782682908700BD60EA /* VideoCellView.swift in Sources */,
37977585268922F600DD52A8 /* InvidiousAPI.swift in Sources */,
37F4AE7426828F0900BD60EA /* VideosCellsView.swift in Sources */,
@ -886,13 +939,16 @@
37D4B1842671684E00C925CA /* PlayerView.swift in Sources */,
37D4B1802671650A00C925CA /* PearvidiousApp.swift in Sources */,
371231852683E7820000B307 /* VideosView.swift in Sources */,
37BD07CA2698FBE5003EBB87 /* AppSidebarNavigation.swift in Sources */,
373CFAC926966188003CB2C6 /* SearchOptionsView.swift in Sources */,
37BD07C92698FBDB003EBB87 /* ContentView.swift in Sources */,
37B17DA6268A285E006AEE9B /* VideoDetailsView.swift in Sources */,
37141671267A8ACC006CA35D /* TrendingView.swift in Sources */,
37AAF29226740715007FC770 /* Channel.swift in Sources */,
37EAD86D267B9C5600D9E01B /* SponsorBlockAPI.swift in Sources */,
3765788B2685471400D4EA09 /* Playlist.swift in Sources */,
373CFADD269663F1003CB2C6 /* Thumbnail.swift in Sources */,
3755A0C2269B772000F67988 /* StreamAVPlayerViewController.swift in Sources */,
37C7A1DE267CE9D90010EAD6 /* Profile.swift in Sources */,
3741B5302676213400125C5E /* PlayerViewController.swift in Sources */,
373CFABE26966148003CB2C6 /* CoverSectionView.swift in Sources */,
@ -905,6 +961,7 @@
37C7A1D7267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
376578932685490700D4EA09 /* PlaylistsView.swift in Sources */,
377A20AB2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */,
371F2F1C269B43D300E4A7AB /* NavigationState.swift in Sources */,
37B17DA0268A1F89006AEE9B /* VideoContextMenuView.swift in Sources */,
37CEE4C32677B697005A1EFE /* Stream.swift in Sources */,
373CFAD5269662AB003CB2C6 /* SearchDate.swift in Sources */,
@ -922,7 +979,8 @@
3705B184267B4E4900704544 /* TrendingCategory.swift in Sources */,
37AAF2A226741C97007FC770 /* SubscriptionsView.swift in Sources */,
372915E82687E3B900F5A35B /* Defaults.swift in Sources */,
37D4B1812671653A00C925CA /* ContentView.swift in Sources */,
37BAB54C269B39FD00E75ED1 /* TVNavigationView.swift in Sources */,
37D4B1812671653A00C925CA /* AppTabNavigation.swift in Sources */,
37B76E98268747C900CE5671 /* OptionsView.swift in Sources */,
37CEE4BB2677B63F005A1EFE /* StreamResolution.swift in Sources */,
3797758D2689345500DD52A8 /* Store.swift in Sources */,
@ -1135,6 +1193,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Shared/Pearvidious.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
@ -1164,6 +1223,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Shared/Pearvidious.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
@ -1500,7 +1560,7 @@
minimumVersion = 1.0.0;
};
};
37D4B18F26717C6900C925CA /* XCRemoteSwiftPackageReference "Alamofire" */ = {
37BADCA32699FB72009BE4FB /* XCRemoteSwiftPackageReference "Alamofire" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Alamofire/Alamofire.git";
requirement = {
@ -1508,6 +1568,14 @@
minimumVersion = 5.0.0;
};
};
37BD07C52698B27B003EBB87 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.1.3;
};
};
37D4B19B2671817900C925CA /* XCRemoteSwiftPackageReference "SwiftyJSON" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SwiftyJSON/SwiftyJSON.git";
@ -1532,11 +1600,6 @@
package = 372915E22687E33E00F5A35B /* XCRemoteSwiftPackageReference "Defaults" */;
productName = Defaults;
};
377FC7D2267A080300A6BBAF /* Alamofire */ = {
isa = XCSwiftPackageProductDependency;
package = 37D4B18F26717C6900C925CA /* XCRemoteSwiftPackageReference "Alamofire" */;
productName = Alamofire;
};
377FC7D4267A080300A6BBAF /* SwiftyJSON */ = {
isa = XCSwiftPackageProductDependency;
package = 37D4B19B2671817900C925CA /* XCRemoteSwiftPackageReference "SwiftyJSON" */;
@ -1557,11 +1620,6 @@
package = 37B767DE2678C5BF0098BAA8 /* XCRemoteSwiftPackageReference "swift-log" */;
productName = Logging;
};
377FC7EA267A0A0800A6BBAF /* Alamofire */ = {
isa = XCSwiftPackageProductDependency;
package = 37D4B18F26717C6900C925CA /* XCRemoteSwiftPackageReference "Alamofire" */;
productName = Alamofire;
};
377FC7EC267A0A0800A6BBAF /* SwiftyJSON */ = {
isa = XCSwiftPackageProductDependency;
package = 37D4B19B2671817900C925CA /* XCRemoteSwiftPackageReference "SwiftyJSON" */;
@ -1592,11 +1650,46 @@
package = 37B767DE2678C5BF0098BAA8 /* XCRemoteSwiftPackageReference "swift-log" */;
productName = Logging;
};
37D4B19026717C6900C925CA /* Alamofire */ = {
37BADCA42699FB72009BE4FB /* Alamofire */ = {
isa = XCSwiftPackageProductDependency;
package = 37D4B18F26717C6900C925CA /* XCRemoteSwiftPackageReference "Alamofire" */;
package = 37BADCA32699FB72009BE4FB /* XCRemoteSwiftPackageReference "Alamofire" */;
productName = Alamofire;
};
37BADCA6269A552E009BE4FB /* Alamofire */ = {
isa = XCSwiftPackageProductDependency;
package = 37BADCA32699FB72009BE4FB /* XCRemoteSwiftPackageReference "Alamofire" */;
productName = Alamofire;
};
37BADCA8269A570B009BE4FB /* Alamofire */ = {
isa = XCSwiftPackageProductDependency;
package = 37BADCA32699FB72009BE4FB /* XCRemoteSwiftPackageReference "Alamofire" */;
productName = Alamofire;
};
37BD07B62698AB2E003EBB87 /* Defaults */ = {
isa = XCSwiftPackageProductDependency;
package = 372915E22687E33E00F5A35B /* XCRemoteSwiftPackageReference "Defaults" */;
productName = Defaults;
};
37BD07B82698AB2E003EBB87 /* Siesta */ = {
isa = XCSwiftPackageProductDependency;
package = 3797757B268922D100DD52A8 /* XCRemoteSwiftPackageReference "siesta" */;
productName = Siesta;
};
37BD07BD2698AC96003EBB87 /* Defaults */ = {
isa = XCSwiftPackageProductDependency;
package = 372915E22687E33E00F5A35B /* XCRemoteSwiftPackageReference "Defaults" */;
productName = Defaults;
};
37BD07BF2698AC97003EBB87 /* Siesta */ = {
isa = XCSwiftPackageProductDependency;
package = 3797757B268922D100DD52A8 /* XCRemoteSwiftPackageReference "siesta" */;
productName = Siesta;
};
37BD07C62698B27B003EBB87 /* Introspect */ = {
isa = XCSwiftPackageProductDependency;
package = 37BD07C52698B27B003EBB87 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;
productName = Introspect;
};
37D4B19C2671817900C925CA /* SwiftyJSON */ = {
isa = XCSwiftPackageProductDependency;
package = 37D4B19B2671817900C925CA /* XCRemoteSwiftPackageReference "SwiftyJSON" */;

View File

@ -37,6 +37,15 @@
"version": "1.4.2"
}
},
{
"package": "SwiftUI-Introspect",
"repositoryURL": "https://github.com/siteline/SwiftUI-Introspect.git",
"state": {
"branch": null,
"revision": "2e09be8af614401bc9f87d40093ec19ce56ccaf2",
"version": "0.1.3"
}
},
{
"package": "SwiftyJSON",
"repositoryURL": "https://github.com/SwiftyJSON/SwiftyJSON.git",

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B0C82671614900C925CA"
BuildableName = "Pearvidious.app"
BlueprintName = "Pearvidious (iOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B0D32671614900C925CA"
BuildableName = "Tests iOS.xctest"
BlueprintName = "Tests iOS"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B0C82671614900C925CA"
BuildableName = "Pearvidious.app"
BlueprintName = "Pearvidious (iOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "37D4B0C82671614900C925CA"
BuildableName = "Pearvidious.app"
BlueprintName = "Pearvidious (iOS)"
ReferencedContainer = "container:Pearvidious.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -24,21 +24,42 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>4</integer>
<integer>5</integer>
</dict>
<key>Playground (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>5</integer>
<integer>6</integer>
</dict>
<key>Playground (Playground) 3.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>3</integer>
</dict>
<key>Playground (Playground) 4.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>7</integer>
</dict>
<key>Playground (Playground) 5.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>8</integer>
</dict>
<key>Playground (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>3</integer>
<integer>4</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>

View File

@ -0,0 +1,58 @@
import SwiftUI
#if os(iOS)
import Introspect
#endif
struct AppSidebarNavigation: View {
@EnvironmentObject<NavigationState> private var navigationState
@State private var didApplyPrimaryViewWorkAround = false
var body: some View {
#if os(iOS)
content.introspectViewController { viewController in
// workaround for an empty supplementary view on launch
// the supplementary view is determined by the default selection inside the
// primary view, but the primary view is not loaded so its selection is not read
// We work around that by briefly showing the primary view.
if !didApplyPrimaryViewWorkAround, let splitVC = viewController.children.first as? UISplitViewController {
UIView.performWithoutAnimation {
splitVC.show(.primary)
splitVC.hide(.primary)
}
didApplyPrimaryViewWorkAround = true
}
}
#else
content
#endif
}
var content: some View {
NavigationView {
sidebar
Text("Select section")
.frame(maxWidth: 600)
Text("Select video")
}
}
var sidebar: some View {
List {
NavigationLink(tag: TabSelection.subscriptions, selection: navigationState.tabSelectionOptionalBinding) {
SubscriptionsView()
}
label: {
Label("Subscriptions", systemImage: "star")
}
NavigationLink(tag: TabSelection.popular, selection: navigationState.tabSelectionOptionalBinding) {
PopularVideosView()
}
label: {
Label("Popular", systemImage: "chart.bar")
}
}
}
}

View File

@ -1,56 +1,26 @@
import Defaults
import SwiftUI
struct ContentView: View {
@Default(.openChannel) var channel
@Default(.showingVideoDetails) var showDetails
@StateObject private var navigationState = NavigationState()
@State private var showingOptions = false
#if os(iOS)
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
#endif
var body: some View {
NavigationView {
TabView(selection: tabSelection) {
SubscriptionsView()
.tabItem { Text("Subscriptions") }
.tag(TabSelection.subscriptions)
PopularVideosView()
.tabItem { Text("Popular") }
.tag(TabSelection.popular)
if channel != nil {
ChannelView(id: channel!.id)
.tabItem { Text("\(channel!.name) Channel") }
.tag(TabSelection.channel)
Section {
#if os(iOS)
if horizontalSizeClass == .compact {
AppTabNavigation()
} else {
AppSidebarNavigation()
}
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() }
.onPlayPauseCommand { showingOptions.toggle() }
.background(videoDetailsViewNavigationLink)
}
}
var tabSelection: Binding<TabSelection> {
Binding(
get: { Defaults[.tabSelection] },
set: { Defaults[.tabSelection] = $0 }
)
}
var videoDetailsViewNavigationLink: some View {
NavigationLink("", destination: VideoDetailsView(), isActive: $showDetails).hidden()
#elseif os(macOS)
AppSidebarNavigation()
#elseif os(tvOS)
TVNavigationView()
#endif
}.environmentObject(navigationState)
}
}

View File

@ -2,15 +2,11 @@ import Defaults
extension Defaults.Keys {
static let layout = Key<ListingLayout>("listingLayout", default: .cells)
static let tabSelection = Key<TabSelection>("tabSelection", default: .subscriptions)
static let searchQuery = Key<String>("searchQuery", default: "")
static let openChannel = Key<Channel?>("openChannel")
static let searchSortOrder = Key<SearchSortOrder>("searchSortOrder", default: .relevance)
static let searchDate = Key<SearchDate?>("searchDate")
static let searchDuration = Key<SearchDuration?>("searchDuration")
static let openVideoID = Key<String>("videoID", default: "")
static let showingVideoDetails = Key<Bool>("showingVideoDetails", default: false)
static let selectedPlaylistID = Key<String?>("selectedPlaylistID")
static let showingAddToPlaylist = Key<Bool>("showingAddToPlaylist", default: false)

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>