mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
View options, video details screen
This commit is contained in:
parent
6d35394ffd
commit
4a733f5a30
@ -16,7 +16,7 @@ struct ChannelView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VideosListView(videos: store.collection)
|
||||
VideosView(videos: store.collection)
|
||||
.onAppear {
|
||||
resource.loadIfNeeded()
|
||||
}
|
||||
|
19
Apple TV/OptionRowView.swift
Normal file
19
Apple TV/OptionRowView.swift
Normal file
@ -0,0 +1,19 @@
|
||||
import SwiftUI
|
||||
|
||||
struct OptionRowView<Content: View>: View {
|
||||
let label: String
|
||||
let controlView: Content
|
||||
|
||||
init(_ label: String, @ViewBuilder controlView: @escaping () -> Content) {
|
||||
self.label = label
|
||||
self.controlView = controlView()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Text(label)
|
||||
Spacer()
|
||||
controlView
|
||||
}
|
||||
}
|
||||
}
|
35
Apple TV/OptionsSectionView.swift
Normal file
35
Apple TV/OptionsSectionView.swift
Normal file
@ -0,0 +1,35 @@
|
||||
import SwiftUI
|
||||
|
||||
struct OptionsSectionView<Content: View>: View {
|
||||
let title: String?
|
||||
|
||||
let rowsView: Content
|
||||
let divider: Bool
|
||||
|
||||
init(_ title: String? = nil, divider: Bool = true, @ViewBuilder rowsView: @escaping () -> Content) {
|
||||
self.title = title
|
||||
self.divider = divider
|
||||
self.rowsView = rowsView()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
if title != nil {
|
||||
sectionTitle
|
||||
}
|
||||
|
||||
rowsView
|
||||
}
|
||||
|
||||
if divider {
|
||||
Divider()
|
||||
.padding(.vertical)
|
||||
}
|
||||
}
|
||||
|
||||
var sectionTitle: some View {
|
||||
Text(title ?? "")
|
||||
.font(.title3)
|
||||
.padding(.bottom)
|
||||
}
|
||||
}
|
72
Apple TV/OptionsView.swift
Normal file
72
Apple TV/OptionsView.swift
Normal file
@ -0,0 +1,72 @@
|
||||
import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct OptionsView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
@Default(.layout) private var layout
|
||||
@Default(.tabSelection) private var tabSelection
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Spacer()
|
||||
|
||||
tabSelectionOptions
|
||||
|
||||
OptionsSectionView("View Options") {
|
||||
OptionRowView("Show videos as") { nextLayoutButton }
|
||||
}
|
||||
|
||||
OptionsSectionView(divider: false) {
|
||||
OptionRowView("Close View Options") { Button("Close") { dismiss() } }
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: 800)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.background(.thinMaterial)
|
||||
}
|
||||
|
||||
var tabSelectionOptions: some View {
|
||||
VStack {
|
||||
switch tabSelection {
|
||||
case .search:
|
||||
SearchOptionsView()
|
||||
|
||||
default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var nextLayoutButton: some View {
|
||||
Button(layout.name) {
|
||||
self.layout = layout.next()
|
||||
}
|
||||
.contextMenu {
|
||||
ForEach(ListingLayout.allCases) { layout in
|
||||
Button(layout.name) {
|
||||
Defaults[.layout] = layout
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct OptionsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
OptionsView()
|
||||
}
|
||||
}
|
66
Apple TV/SearchOptionsView.swift
Normal file
66
Apple TV/SearchOptionsView.swift
Normal file
@ -0,0 +1,66 @@
|
||||
import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct SearchOptionsView: View {
|
||||
@Default(.searchSortOrder) private var searchSortOrder
|
||||
@Default(.searchDate) private var searchDate
|
||||
@Default(.searchDuration) private var searchDuration
|
||||
|
||||
var body: some View {
|
||||
OptionsSectionView("Search Options") {
|
||||
OptionRowView("Sort By") { searchSortOrderButton }
|
||||
OptionRowView("Upload date") { searchDateButton }
|
||||
OptionRowView("Duration") { searchDurationButton }
|
||||
}
|
||||
}
|
||||
|
||||
var searchSortOrderButton: some View {
|
||||
Button(self.searchSortOrder.name) {
|
||||
self.searchSortOrder = self.searchSortOrder.next()
|
||||
}
|
||||
.contextMenu {
|
||||
ForEach(SearchSortOrder.allCases) { sortOrder in
|
||||
Button(sortOrder.name) {
|
||||
self.searchSortOrder = sortOrder
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var searchDateButton: some View {
|
||||
Button(self.searchDate?.name ?? "All") {
|
||||
self.searchDate = self.searchDate == nil ? SearchDate.allCases.first : self.searchDate!.next(nilAtEnd: true)
|
||||
}
|
||||
|
||||
.contextMenu {
|
||||
ForEach(SearchDate.allCases) { searchDate in
|
||||
Button(searchDate.name) {
|
||||
self.searchDate = searchDate
|
||||
}
|
||||
}
|
||||
|
||||
Button("Reset") {
|
||||
self.searchDate = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var searchDurationButton: some View {
|
||||
Button(self.searchDuration?.name ?? "All") {
|
||||
let duration = Defaults[.searchDuration]
|
||||
|
||||
Defaults[.searchDuration] = duration == nil ? SearchDuration.allCases.first : duration!.next(nilAtEnd: true)
|
||||
}
|
||||
.contextMenu {
|
||||
ForEach(SearchDuration.allCases) { searchDuration in
|
||||
Button(searchDuration.name) {
|
||||
Defaults[.searchDuration] = searchDuration
|
||||
}
|
||||
}
|
||||
|
||||
Button("Reset") {
|
||||
Defaults.reset(.searchDuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,33 +3,68 @@ import Siesta
|
||||
import SwiftUI
|
||||
|
||||
struct SearchView: View {
|
||||
@Default(.searchQuery) var query
|
||||
@Default(.searchQuery) private var queryText
|
||||
@Default(.searchSortOrder) private var searchSortOrder
|
||||
@Default(.searchDate) private var searchDate
|
||||
@Default(.searchDuration) private var searchDuration
|
||||
|
||||
@ObservedObject private var store = Store<[Video]>()
|
||||
@ObservedObject private var query = SearchQuery()
|
||||
|
||||
var body: some View {
|
||||
VideosView(videos: store.collection)
|
||||
.searchable(text: $query)
|
||||
.onAppear {
|
||||
queryChanged(new: query)
|
||||
VStack {
|
||||
if !store.collection.isEmpty {
|
||||
VideosView(videos: store.collection)
|
||||
}
|
||||
.onChange(of: query) { newQuery in
|
||||
queryChanged(old: query, new: newQuery)
|
||||
|
||||
if store.collection.isEmpty && !resource.isLoading {
|
||||
Text("No results")
|
||||
|
||||
if searchFiltersActive {
|
||||
Button("Reset search filters") {
|
||||
Defaults.reset(.searchDate, .searchDuration)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.searchable(text: $queryText)
|
||||
.onAppear {
|
||||
changeQuery {
|
||||
query.query = queryText
|
||||
query.sortBy = searchSortOrder
|
||||
query.date = searchDate
|
||||
query.duration = searchDuration
|
||||
}
|
||||
}
|
||||
.onChange(of: queryText) { queryText in
|
||||
changeQuery { query.query = queryText }
|
||||
}
|
||||
.onChange(of: searchSortOrder) { order in
|
||||
changeQuery { query.sortBy = order }
|
||||
}
|
||||
.onChange(of: searchDate) { date in
|
||||
changeQuery { query.date = date }
|
||||
}
|
||||
.onChange(of: searchDuration) { duration in
|
||||
changeQuery { query.duration = duration }
|
||||
}
|
||||
}
|
||||
|
||||
func queryChanged(old: String? = nil, new: String) {
|
||||
if old != nil {
|
||||
let oldResource = resource(old!)
|
||||
oldResource.removeObservers(ownedBy: store)
|
||||
}
|
||||
func changeQuery(_ change: @escaping () -> Void = {}) {
|
||||
resource.removeObservers(ownedBy: store)
|
||||
change()
|
||||
|
||||
let resource = resource(new)
|
||||
resource.addObserver(store)
|
||||
resource.loadIfNeeded()
|
||||
}
|
||||
|
||||
func resource(_ query: String) -> Resource {
|
||||
var resource: Resource {
|
||||
InvidiousAPI.shared.search(query)
|
||||
}
|
||||
|
||||
var searchFiltersActive: Bool {
|
||||
searchDate != nil || searchDuration != nil
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ struct VideoCellView: View {
|
||||
NavigationLink(destination: PlayerView(id: video.id)) {
|
||||
VStack(alignment: .leading) {
|
||||
ZStack(alignment: .trailing) {
|
||||
if let thumbnail = video.thumbnailURL {
|
||||
if let thumbnail = video.thumbnailURL(quality: "high") {
|
||||
// to replace with AsyncImage when it is fixed with lazy views
|
||||
URLImage(thumbnail) { image in
|
||||
image
|
||||
|
@ -6,12 +6,20 @@ struct VideoContextMenuView: View {
|
||||
|
||||
let video: Video
|
||||
|
||||
@Default(.openVideoID) var openVideoID
|
||||
@Default(.showingVideoDetails) var showDetails
|
||||
|
||||
var body: some View {
|
||||
if tabSelection == .channel {
|
||||
closeChannelButton(from: video)
|
||||
} else {
|
||||
openChannelButton(from: video)
|
||||
}
|
||||
|
||||
Button("Open video details") {
|
||||
openVideoID = video.id
|
||||
showDetails = true
|
||||
}
|
||||
}
|
||||
|
||||
func openChannelButton(from video: Video) -> some View {
|
||||
|
80
Apple TV/VideoDetailsView.swift
Normal file
80
Apple TV/VideoDetailsView.swift
Normal file
@ -0,0 +1,80 @@
|
||||
import Defaults
|
||||
import Siesta
|
||||
import SwiftUI
|
||||
import URLImage
|
||||
|
||||
struct VideoDetailsView: View {
|
||||
@Default(.showingVideoDetails) var showDetails
|
||||
|
||||
@ObservedObject private var store = Store<Video>()
|
||||
|
||||
var resource: Resource {
|
||||
InvidiousAPI.shared.video(Defaults[.openVideoID])
|
||||
}
|
||||
|
||||
init() {
|
||||
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: 10) {
|
||||
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)
|
||||
Button("A") {}
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
resource.loadIfNeeded()
|
||||
}
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
}
|
||||
|
||||
var openChannelButton: some View {
|
||||
let channel = Channel.from(video: store.item!)
|
||||
|
||||
return Button("Open \(channel.name) channel") {
|
||||
Defaults[.openChannel] = channel
|
||||
Defaults[.tabSelection] = .channel
|
||||
showDetails = false
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ struct VideoListRowView: View {
|
||||
NavigationLink(destination: PlayerView(id: video.id)) {
|
||||
HStack(alignment: .top, spacing: 2) {
|
||||
Section {
|
||||
if let thumbnail = video.thumbnailURL {
|
||||
if let thumbnail = video.thumbnailURL(quality: "medium") {
|
||||
// to replace with AsyncImage when it is fixed with lazy views
|
||||
URLImage(thumbnail) { image in
|
||||
image
|
||||
|
@ -4,22 +4,18 @@ import SwiftUI
|
||||
struct VideosView: View {
|
||||
@State private var profile = Profile()
|
||||
|
||||
var videos: [Video]
|
||||
|
||||
@Default(.layout) var layout
|
||||
@Default(.tabSelection) var tabSelection
|
||||
|
||||
@State private var showingViewOptions = false
|
||||
var videos: [Video]
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Group {
|
||||
if layout == .cells {
|
||||
VideosCellsView(videos: videos, columns: self.profile.cellsColumns)
|
||||
} else {
|
||||
VideosListView(videos: videos)
|
||||
}
|
||||
}
|
||||
.fullScreenCover(isPresented: $showingViewOptions) { ViewOptionsView() }
|
||||
.onPlayPauseCommand { showingViewOptions.toggle() }
|
||||
}
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
import Defaults
|
||||
import SwiftUI
|
||||
|
||||
struct ViewOptionsView: View {
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@Default(.layout) var layout
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
VStack {
|
||||
Spacer()
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Spacer()
|
||||
|
||||
VStack {
|
||||
nextLayoutButton
|
||||
|
||||
Button("Close") {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.background(.thinMaterial)
|
||||
}
|
||||
|
||||
var nextLayoutButton: some View {
|
||||
Button(layout.next().name, action: nextLayout)
|
||||
}
|
||||
|
||||
func nextLayout() {
|
||||
Defaults[.layout] = layout.next()
|
||||
dismiss()
|
||||
}
|
||||
}
|
@ -1,8 +1,15 @@
|
||||
extension CaseIterable where Self: Equatable {
|
||||
func next() -> Self {
|
||||
func next(nilAtEnd: Bool = false) -> Self! {
|
||||
let all = Self.allCases
|
||||
let index = all.firstIndex(of: self)!
|
||||
let next = all.index(after: index)
|
||||
|
||||
if nilAtEnd == true {
|
||||
if next == all.endIndex {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return all[next == all.endIndex ? all.startIndex : next]
|
||||
}
|
||||
}
|
||||
|
6
Extensions/TypedContentAccessors.swift
Normal file
6
Extensions/TypedContentAccessors.swift
Normal file
@ -0,0 +1,6 @@
|
||||
import Siesta
|
||||
import SwiftyJSON
|
||||
|
||||
extension TypedContentAccessors {
|
||||
var json: JSON { typedContent(ifNone: JSON.null) }
|
||||
}
|
@ -1,14 +1,8 @@
|
||||
import Defaults
|
||||
import Foundation
|
||||
import Siesta
|
||||
import SwiftyJSON
|
||||
|
||||
extension TypedContentAccessors {
|
||||
var json: JSON { typedContent(ifNone: JSON.null) }
|
||||
}
|
||||
|
||||
let SwiftyJSONTransformer =
|
||||
ResponseContentTransformer(transformErrors: true) { JSON($0.content as AnyObject) }
|
||||
|
||||
final class InvidiousAPI: Service {
|
||||
static let shared = InvidiousAPI()
|
||||
|
||||
@ -25,7 +19,10 @@ final class InvidiousAPI: Service {
|
||||
}
|
||||
|
||||
init() {
|
||||
SiestaLog.Category.enabled = .all
|
||||
SiestaLog.Category.enabled = .common
|
||||
|
||||
let SwiftyJSONTransformer =
|
||||
ResponseContentTransformer(transformErrors: true) { JSON($0.content as AnyObject) }
|
||||
|
||||
super.init(baseURL: "\(InvidiousAPI.instance)/api/v1")
|
||||
|
||||
@ -106,9 +103,20 @@ final class InvidiousAPI: Service {
|
||||
resource("/auth/playlists")
|
||||
}
|
||||
|
||||
func search(_ query: String) -> Resource {
|
||||
resource("/search")
|
||||
.withParam("q", searchQuery(query))
|
||||
func search(_ query: SearchQuery) -> Resource {
|
||||
var resource = resource("/search")
|
||||
.withParam("q", searchQuery(query.query))
|
||||
.withParam("sort_by", query.sortBy.parameter)
|
||||
|
||||
if let date = query.date {
|
||||
resource = resource.withParam("date", date.rawValue)
|
||||
}
|
||||
|
||||
if let duration = query.duration {
|
||||
resource = resource.withParam("duration", duration.rawValue)
|
||||
}
|
||||
|
||||
return resource
|
||||
}
|
||||
|
||||
private func searchQuery(_ query: String) -> String {
|
||||
|
@ -36,7 +36,7 @@ final class PlayerState: ObservableObject {
|
||||
makeMetadataItem(.commonIdentifierDescription, value: video.description)
|
||||
]
|
||||
|
||||
if let thumbnailData = try? Data(contentsOf: video.thumbnailURL!),
|
||||
if let thumbnailData = try? Data(contentsOf: video.thumbnailURL(quality: "high")!),
|
||||
let image = UIImage(data: thumbnailData),
|
||||
let pngData = image.pngData()
|
||||
{
|
||||
|
13
Model/SearchDate.swift
Normal file
13
Model/SearchDate.swift
Normal file
@ -0,0 +1,13 @@
|
||||
import Defaults
|
||||
|
||||
enum SearchDate: String, CaseIterable, Identifiable, DefaultsSerializable {
|
||||
case hour, today, week, month, year
|
||||
|
||||
var id: SearchDate.RawValue {
|
||||
rawValue
|
||||
}
|
||||
|
||||
var name: String {
|
||||
rawValue.capitalized
|
||||
}
|
||||
}
|
13
Model/SearchDuration.swift
Normal file
13
Model/SearchDuration.swift
Normal file
@ -0,0 +1,13 @@
|
||||
import Defaults
|
||||
|
||||
enum SearchDuration: String, CaseIterable, Identifiable, DefaultsSerializable {
|
||||
case short, long
|
||||
|
||||
var id: SearchDuration.RawValue {
|
||||
rawValue
|
||||
}
|
||||
|
||||
var name: String {
|
||||
rawValue.capitalized
|
||||
}
|
||||
}
|
18
Model/SearchQuery.swift
Normal file
18
Model/SearchQuery.swift
Normal file
@ -0,0 +1,18 @@
|
||||
import Foundation
|
||||
|
||||
final class SearchQuery: ObservableObject {
|
||||
@Published var query: String
|
||||
@Published var sortBy = SearchSortOrder.relevance
|
||||
@Published var date: SearchDate? = SearchDate.month
|
||||
@Published var duration: SearchDuration?
|
||||
|
||||
@Published var page = 1
|
||||
|
||||
init(query: String = "", page: Int = 1, sortBy: SearchSortOrder = .relevance, date: SearchDate? = nil, duration: SearchDuration? = nil) {
|
||||
self.query = query
|
||||
self.page = page
|
||||
self.sortBy = sortBy
|
||||
self.date = date
|
||||
self.duration = duration
|
||||
}
|
||||
}
|
32
Model/SearchSortOrder.swift
Normal file
32
Model/SearchSortOrder.swift
Normal file
@ -0,0 +1,32 @@
|
||||
import Defaults
|
||||
import Foundation
|
||||
|
||||
enum SearchSortOrder: String, CaseIterable, Identifiable, DefaultsSerializable {
|
||||
case relevance, rating, uploadDate, viewCount
|
||||
|
||||
var id: SearchSortOrder.RawValue {
|
||||
rawValue
|
||||
}
|
||||
|
||||
var name: String {
|
||||
switch self {
|
||||
case .uploadDate:
|
||||
return "Upload Date"
|
||||
case .viewCount:
|
||||
return "View Count"
|
||||
default:
|
||||
return rawValue.capitalized
|
||||
}
|
||||
}
|
||||
|
||||
var parameter: String {
|
||||
switch self {
|
||||
case .uploadDate:
|
||||
return "upload_date"
|
||||
case .viewCount:
|
||||
return "view_count"
|
||||
default:
|
||||
return rawValue
|
||||
}
|
||||
}
|
||||
}
|
12
Model/Thumbnail.swift
Normal file
12
Model/Thumbnail.swift
Normal file
@ -0,0 +1,12 @@
|
||||
import Foundation
|
||||
import SwiftyJSON
|
||||
|
||||
struct Thumbnail {
|
||||
var url: URL
|
||||
var quality: String
|
||||
|
||||
init(_ json: JSON) {
|
||||
url = json["url"].url!
|
||||
quality = json["quality"].string!
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ import SwiftyJSON
|
||||
struct Video: Identifiable {
|
||||
let id: String
|
||||
var title: String
|
||||
var thumbnailURL: URL?
|
||||
var thumbnails: [Thumbnail]
|
||||
var author: String
|
||||
var length: TimeInterval
|
||||
var published: String
|
||||
@ -28,10 +28,10 @@ struct Video: Identifiable {
|
||||
description = json["description"].stringValue
|
||||
genre = json["genre"].stringValue
|
||||
|
||||
thumbnailURL = extractThumbnailURL(from: json)
|
||||
thumbnails = Video.extractThumbnails(from: json)
|
||||
|
||||
streams = extractFormatStreams(from: json["formatStreams"].arrayValue)
|
||||
streams.append(contentsOf: extractAdaptiveFormats(from: json["adaptiveFormats"].arrayValue))
|
||||
streams = Video.extractFormatStreams(from: json["formatStreams"].arrayValue)
|
||||
streams.append(contentsOf: Video.extractAdaptiveFormats(from: json["adaptiveFormats"].arrayValue))
|
||||
}
|
||||
|
||||
var playTime: String? {
|
||||
@ -93,19 +93,20 @@ struct Video: Identifiable {
|
||||
}
|
||||
|
||||
func defaultStreamForProfile(_ profile: Profile) -> Stream? {
|
||||
streamWithResolution(profile.defaultStreamResolution.value)
|
||||
streamWithResolution(profile.defaultStreamResolution.value) ?? streams.first
|
||||
}
|
||||
|
||||
private func extractThumbnailURL(from details: JSON) -> URL? {
|
||||
if details["videoThumbnails"].arrayValue.isEmpty {
|
||||
return nil
|
||||
func thumbnailURL(quality: String) -> URL? {
|
||||
thumbnails.first { $0.quality == quality }?.url
|
||||
}
|
||||
|
||||
private static func extractThumbnails(from details: JSON) -> [Thumbnail] {
|
||||
details["videoThumbnails"].arrayValue.map { json in
|
||||
Thumbnail(json)
|
||||
}
|
||||
|
||||
let thumbnail = details["videoThumbnails"].arrayValue.first { $0["quality"].stringValue == "medium" }!
|
||||
return thumbnail["url"].url!
|
||||
}
|
||||
|
||||
private func extractFormatStreams(from streams: [JSON]) -> [Stream] {
|
||||
private static func extractFormatStreams(from streams: [JSON]) -> [Stream] {
|
||||
streams.map {
|
||||
AudioVideoStream(
|
||||
avAsset: AVURLAsset(url: InvidiousAPI.proxyURLForAsset($0["url"].stringValue)!),
|
||||
@ -116,7 +117,7 @@ struct Video: Identifiable {
|
||||
}
|
||||
}
|
||||
|
||||
private func extractAdaptiveFormats(from streams: [JSON]) -> [Stream] {
|
||||
private static func extractAdaptiveFormats(from streams: [JSON]) -> [Stream] {
|
||||
let audioAssetURL = streams.first { $0["type"].stringValue.starts(with: "audio/mp4") }
|
||||
guard audioAssetURL != nil else {
|
||||
return []
|
||||
|
@ -30,6 +30,30 @@
|
||||
372915EA2687EBA500F5A35B /* ListingLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372915E92687EBA500F5A35B /* ListingLayout.swift */; };
|
||||
372915EB2687EBA500F5A35B /* ListingLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372915E92687EBA500F5A35B /* ListingLayout.swift */; };
|
||||
372915EC2687EBA500F5A35B /* ListingLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372915E92687EBA500F5A35B /* ListingLayout.swift */; };
|
||||
373CFABE26966148003CB2C6 /* OptionsSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFABD26966115003CB2C6 /* OptionsSectionView.swift */; };
|
||||
373CFABF26966149003CB2C6 /* OptionsSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFABD26966115003CB2C6 /* OptionsSectionView.swift */; };
|
||||
373CFAC026966149003CB2C6 /* OptionsSectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFABD26966115003CB2C6 /* OptionsSectionView.swift */; };
|
||||
373CFAC226966159003CB2C6 /* OptionRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAC126966159003CB2C6 /* OptionRowView.swift */; };
|
||||
373CFAC32696616C003CB2C6 /* OptionRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAC126966159003CB2C6 /* OptionRowView.swift */; };
|
||||
373CFAC42696616C003CB2C6 /* OptionRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAC126966159003CB2C6 /* OptionRowView.swift */; };
|
||||
373CFAC62696617C003CB2C6 /* SearchOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAC52696617C003CB2C6 /* SearchOptionsView.swift */; };
|
||||
373CFAC726966187003CB2C6 /* SearchOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAC52696617C003CB2C6 /* SearchOptionsView.swift */; };
|
||||
373CFAC926966188003CB2C6 /* SearchOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAC52696617C003CB2C6 /* SearchOptionsView.swift */; };
|
||||
373CFACB26966264003CB2C6 /* SearchQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFACA26966264003CB2C6 /* SearchQuery.swift */; };
|
||||
373CFACC26966264003CB2C6 /* SearchQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFACA26966264003CB2C6 /* SearchQuery.swift */; };
|
||||
373CFACD26966264003CB2C6 /* SearchQuery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFACA26966264003CB2C6 /* SearchQuery.swift */; };
|
||||
373CFACF26966290003CB2C6 /* SearchSortOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFACE26966290003CB2C6 /* SearchSortOrder.swift */; };
|
||||
373CFAD026966290003CB2C6 /* SearchSortOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFACE26966290003CB2C6 /* SearchSortOrder.swift */; };
|
||||
373CFAD126966290003CB2C6 /* SearchSortOrder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFACE26966290003CB2C6 /* SearchSortOrder.swift */; };
|
||||
373CFAD3269662AB003CB2C6 /* SearchDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAD2269662AB003CB2C6 /* SearchDate.swift */; };
|
||||
373CFAD4269662AB003CB2C6 /* SearchDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAD2269662AB003CB2C6 /* SearchDate.swift */; };
|
||||
373CFAD5269662AB003CB2C6 /* SearchDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAD2269662AB003CB2C6 /* SearchDate.swift */; };
|
||||
373CFAD7269662CD003CB2C6 /* SearchDuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAD6269662CD003CB2C6 /* SearchDuration.swift */; };
|
||||
373CFAD8269662CD003CB2C6 /* SearchDuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAD6269662CD003CB2C6 /* SearchDuration.swift */; };
|
||||
373CFAD9269662CD003CB2C6 /* SearchDuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFAD6269662CD003CB2C6 /* SearchDuration.swift */; };
|
||||
373CFADB269663F1003CB2C6 /* Thumbnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFADA269663F1003CB2C6 /* Thumbnail.swift */; };
|
||||
373CFADC269663F1003CB2C6 /* Thumbnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFADA269663F1003CB2C6 /* Thumbnail.swift */; };
|
||||
373CFADD269663F1003CB2C6 /* Thumbnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 373CFADA269663F1003CB2C6 /* Thumbnail.swift */; };
|
||||
3741B5302676213400125C5E /* PlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3741B52F2676213400125C5E /* PlayerViewController.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 */; };
|
||||
@ -40,6 +64,9 @@
|
||||
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 */; };
|
||||
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 */; };
|
||||
@ -90,13 +117,16 @@
|
||||
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 */; };
|
||||
37B767DD2677C3CA0098BAA8 /* PlayerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B767DA2677C3CA0098BAA8 /* PlayerState.swift */; };
|
||||
37B767E02678C5BF0098BAA8 /* Logging in Frameworks */ = {isa = PBXBuildFile; productRef = 37B767DF2678C5BF0098BAA8 /* Logging */; };
|
||||
37B76E96268747C900CE5671 /* ViewOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B76E95268747C900CE5671 /* ViewOptionsView.swift */; };
|
||||
37B76E97268747C900CE5671 /* ViewOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B76E95268747C900CE5671 /* ViewOptionsView.swift */; };
|
||||
37B76E98268747C900CE5671 /* ViewOptionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37B76E95268747C900CE5671 /* ViewOptionsView.swift */; };
|
||||
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 */; };
|
||||
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 */; };
|
||||
@ -185,10 +215,19 @@
|
||||
37141672267A8E10006CA35D /* Country.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Country.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 /* OptionsSectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsSectionView.swift; sourceTree = "<group>"; };
|
||||
373CFAC126966159003CB2C6 /* OptionRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionRowView.swift; sourceTree = "<group>"; };
|
||||
373CFAC52696617C003CB2C6 /* SearchOptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchOptionsView.swift; sourceTree = "<group>"; };
|
||||
373CFACA26966264003CB2C6 /* SearchQuery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchQuery.swift; sourceTree = "<group>"; };
|
||||
373CFACE26966290003CB2C6 /* SearchSortOrder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSortOrder.swift; sourceTree = "<group>"; };
|
||||
373CFAD2269662AB003CB2C6 /* SearchDate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchDate.swift; sourceTree = "<group>"; };
|
||||
373CFAD6269662CD003CB2C6 /* SearchDuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchDuration.swift; sourceTree = "<group>"; };
|
||||
373CFADA269663F1003CB2C6 /* Thumbnail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Thumbnail.swift; sourceTree = "<group>"; };
|
||||
3741B52F2676213400125C5E /* PlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerViewController.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>"; };
|
||||
377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypedContentAccessors.swift; sourceTree = "<group>"; };
|
||||
37977582268922F600DD52A8 /* InvidiousAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvidiousAPI.swift; sourceTree = "<group>"; };
|
||||
3797758A2689345500DD52A8 /* Store.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Store.swift; sourceTree = "<group>"; };
|
||||
379775922689365600DD52A8 /* Array+Next.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Next.swift"; sourceTree = "<group>"; };
|
||||
@ -200,8 +239,9 @@
|
||||
37AAF29926740A01007FC770 /* VideosListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideosListView.swift; sourceTree = "<group>"; };
|
||||
37AAF29F26741C97007FC770 /* SubscriptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionsView.swift; sourceTree = "<group>"; };
|
||||
37B17D9F268A1F25006AEE9B /* VideoContextMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoContextMenuView.swift; sourceTree = "<group>"; };
|
||||
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 /* ViewOptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewOptionsView.swift; sourceTree = "<group>"; };
|
||||
37B76E95268747C900CE5671 /* OptionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionsView.swift; 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>"; };
|
||||
@ -306,6 +346,7 @@
|
||||
children = (
|
||||
379775922689365600DD52A8 /* Array+Next.swift */,
|
||||
376578842685429C00D4EA09 /* CaseIterable+Next.swift */,
|
||||
377A20A82693C9A2002842B8 /* TypedContentAccessors.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
@ -313,10 +354,10 @@
|
||||
37D4B0BC2671614700C925CA = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
37D4B0C12671614700C925CA /* Shared */,
|
||||
37D4B1B72672CFE300C925CA /* Model */,
|
||||
37D4B159267164AE00C925CA /* Apple TV */,
|
||||
37C7A9022679058300E721B4 /* Extensions */,
|
||||
37D4B1B72672CFE300C925CA /* Model */,
|
||||
37D4B0C12671614700C925CA /* Shared */,
|
||||
377FC7D1267A080300A6BBAF /* Frameworks */,
|
||||
37D4B0CA2671614900C925CA /* Products */,
|
||||
37D4B174267164B000C925CA /* Tests Apple TV */,
|
||||
@ -328,13 +369,13 @@
|
||||
37D4B0C12671614700C925CA /* Shared */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
37D4B0C42671614800C925CA /* Assets.xcassets */,
|
||||
37D4B0C32671614700C925CA /* ContentView.swift */,
|
||||
37141672267A8E10006CA35D /* Country.swift */,
|
||||
372915E52687E3B900F5A35B /* Defaults.swift */,
|
||||
372915E92687EBA500F5A35B /* ListingLayout.swift */,
|
||||
37D4B0C22671614700C925CA /* PearvidiousApp.swift */,
|
||||
37AAF2932674086B007FC770 /* TabSelection.swift */,
|
||||
37D4B0C42671614800C925CA /* Assets.xcassets */,
|
||||
);
|
||||
path = Shared;
|
||||
sourceTree = "<group>";
|
||||
@ -371,13 +412,15 @@
|
||||
37D4B159267164AE00C925CA /* Apple TV */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
37D4B15E267164AF00C925CA /* Assets.xcassets */,
|
||||
37AAF2892673AB89007FC770 /* ChannelView.swift */,
|
||||
37D4B1AE26729DEB00C925CA /* Info.plist */,
|
||||
373CFAC126966159003CB2C6 /* OptionRowView.swift */,
|
||||
373CFABD26966115003CB2C6 /* OptionsSectionView.swift */,
|
||||
37B76E95268747C900CE5671 /* OptionsView.swift */,
|
||||
37D4B1822671681B00C925CA /* PlayerView.swift */,
|
||||
3741B52F2676213400125C5E /* PlayerViewController.swift */,
|
||||
376578902685490700D4EA09 /* PlaylistsView.swift */,
|
||||
37AAF27D26737323007FC770 /* PopularVideosView.swift */,
|
||||
373CFAC52696617C003CB2C6 /* SearchOptionsView.swift */,
|
||||
37AAF27F26737550007FC770 /* SearchView.swift */,
|
||||
37141667267A83F9006CA35D /* StreamAVPlayerViewController.swift */,
|
||||
37AAF29F26741C97007FC770 /* SubscriptionsView.swift */,
|
||||
@ -385,11 +428,13 @@
|
||||
3714166E267A8ACC006CA35D /* TrendingView.swift */,
|
||||
37F4AE752682908700BD60EA /* VideoCellView.swift */,
|
||||
37B17D9F268A1F25006AEE9B /* VideoContextMenuView.swift */,
|
||||
37B17DA3268A285E006AEE9B /* VideoDetailsView.swift */,
|
||||
37D4B18B26717B3800C925CA /* VideoListRowView.swift */,
|
||||
37F4AE7126828F0900BD60EA /* VideosCellsView.swift */,
|
||||
37AAF29926740A01007FC770 /* VideosListView.swift */,
|
||||
371231832683E62F0000B307 /* VideosView.swift */,
|
||||
37B76E95268747C900CE5671 /* ViewOptionsView.swift */,
|
||||
37D4B15E267164AF00C925CA /* Assets.xcassets */,
|
||||
37D4B1AE26729DEB00C925CA /* Info.plist */,
|
||||
);
|
||||
path = "Apple TV";
|
||||
sourceTree = "<group>";
|
||||
@ -411,6 +456,10 @@
|
||||
37B767DA2677C3CA0098BAA8 /* PlayerState.swift */,
|
||||
376578882685471400D4EA09 /* Playlist.swift */,
|
||||
37C7A1DB267CE9D90010EAD6 /* Profile.swift */,
|
||||
373CFAD2269662AB003CB2C6 /* SearchDate.swift */,
|
||||
373CFAD6269662CD003CB2C6 /* SearchDuration.swift */,
|
||||
373CFACA26966264003CB2C6 /* SearchQuery.swift */,
|
||||
373CFACE26966290003CB2C6 /* SearchSortOrder.swift */,
|
||||
37EAD86E267B9ED100D9E01B /* Segment.swift */,
|
||||
37EAD86A267B9C5600D9E01B /* SponsorBlockAPI.swift */,
|
||||
37C7A1D4267BFD9D0010EAD6 /* SponsorBlockSegment.swift */,
|
||||
@ -418,6 +467,7 @@
|
||||
37CEE4C02677B697005A1EFE /* Stream.swift */,
|
||||
37CEE4B82677B63F005A1EFE /* StreamResolution.swift */,
|
||||
37CEE4B42677B628005A1EFE /* StreamType.swift */,
|
||||
373CFADA269663F1003CB2C6 /* Thumbnail.swift */,
|
||||
3705B181267B4E4900704544 /* TrendingCategory.swift */,
|
||||
37D4B19626717E1500C925CA /* Video.swift */,
|
||||
);
|
||||
@ -685,12 +735,16 @@
|
||||
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 */,
|
||||
376578892685471400D4EA09 /* Playlist.swift in Sources */,
|
||||
373CFADB269663F1003CB2C6 /* Thumbnail.swift in Sources */,
|
||||
37CEE4B52677B628005A1EFE /* StreamType.swift in Sources */,
|
||||
37C7A1DC267CE9D90010EAD6 /* Profile.swift in Sources */,
|
||||
373CFAC026966149003CB2C6 /* OptionsSectionView.swift in Sources */,
|
||||
3714166F267A8ACC006CA35D /* TrendingView.swift in Sources */,
|
||||
377FC7E3267A084A00A6BBAF /* VideoListRowView.swift in Sources */,
|
||||
37AAF29026740715007FC770 /* Channel.swift in Sources */,
|
||||
@ -698,18 +752,24 @@
|
||||
377FC7E9267A085D00A6BBAF /* PlayerViewController.swift in Sources */,
|
||||
377FC7E5267A084E00A6BBAF /* SearchView.swift in Sources */,
|
||||
376578912685490700D4EA09 /* PlaylistsView.swift in Sources */,
|
||||
377A20A92693C9A2002842B8 /* TypedContentAccessors.swift in Sources */,
|
||||
37B17DA2268A1F8A006AEE9B /* VideoContextMenuView.swift in Sources */,
|
||||
379775932689365600DD52A8 /* Array+Next.swift in Sources */,
|
||||
373CFAD3269662AB003CB2C6 /* SearchDate.swift in Sources */,
|
||||
377FC7E1267A082600A6BBAF /* ChannelView.swift in Sources */,
|
||||
37C7A1D5267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
|
||||
37B767DB2677C3CA0098BAA8 /* PlayerState.swift in Sources */,
|
||||
373CFACB26966264003CB2C6 /* SearchQuery.swift in Sources */,
|
||||
372915EA2687EBA500F5A35B /* ListingLayout.swift in Sources */,
|
||||
373CFAC226966159003CB2C6 /* OptionRowView.swift in Sources */,
|
||||
37141673267A8E10006CA35D /* Country.swift in Sources */,
|
||||
37AAF2A026741C97007FC770 /* SubscriptionsView.swift in Sources */,
|
||||
373CFAD7269662CD003CB2C6 /* SearchDuration.swift in Sources */,
|
||||
373CFACF26966290003CB2C6 /* SearchSortOrder.swift in Sources */,
|
||||
377FC7DF267A082200A6BBAF /* VideosListView.swift in Sources */,
|
||||
372915E62687E3B900F5A35B /* Defaults.swift in Sources */,
|
||||
37D4B19726717E1500C925CA /* Video.swift in Sources */,
|
||||
37B76E96268747C900CE5671 /* ViewOptionsView.swift in Sources */,
|
||||
37B76E96268747C900CE5671 /* OptionsView.swift in Sources */,
|
||||
37D4B0E42671614900C925CA /* PearvidiousApp.swift in Sources */,
|
||||
37CEE4B92677B63F005A1EFE /* StreamResolution.swift in Sources */,
|
||||
3797758B2689345500DD52A8 /* Store.swift in Sources */,
|
||||
@ -721,7 +781,9 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
37CEE4BE2677B670005A1EFE /* AudioVideoStream.swift in Sources */,
|
||||
37B17DA5268A285E006AEE9B /* VideoDetailsView.swift in Sources */,
|
||||
37F4AE772682908700BD60EA /* VideoCellView.swift in Sources */,
|
||||
373CFABF26966149003CB2C6 /* OptionsSectionView.swift in Sources */,
|
||||
37141669267A83F9006CA35D /* StreamAVPlayerViewController.swift in Sources */,
|
||||
37EAD86C267B9C5600D9E01B /* SponsorBlockAPI.swift in Sources */,
|
||||
377FC7E7267A085600A6BBAF /* PlayerView.swift in Sources */,
|
||||
@ -735,19 +797,25 @@
|
||||
37141670267A8ACC006CA35D /* TrendingView.swift in Sources */,
|
||||
377FC7E2267A084A00A6BBAF /* VideoListRowView.swift in Sources */,
|
||||
3765788A2685471400D4EA09 /* Playlist.swift in Sources */,
|
||||
373CFACC26966264003CB2C6 /* SearchQuery.swift in Sources */,
|
||||
373CFAC32696616C003CB2C6 /* OptionRowView.swift in Sources */,
|
||||
37AAF29126740715007FC770 /* Channel.swift in Sources */,
|
||||
373CFAC726966187003CB2C6 /* SearchOptionsView.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 */,
|
||||
376578862685429C00D4EA09 /* CaseIterable+Next.swift in Sources */,
|
||||
37F4AE7326828F0900BD60EA /* VideosCellsView.swift in Sources */,
|
||||
377FC7E0267A082600A6BBAF /* ChannelView.swift in Sources */,
|
||||
379775942689365600DD52A8 /* Array+Next.swift in Sources */,
|
||||
37B76E97268747C900CE5671 /* ViewOptionsView.swift in Sources */,
|
||||
37B76E97268747C900CE5671 /* OptionsView.swift in Sources */,
|
||||
371231862683E7820000B307 /* VideosView.swift in Sources */,
|
||||
37C7A1D6267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
|
||||
373CFAD026966290003CB2C6 /* SearchSortOrder.swift in Sources */,
|
||||
37C7A1DD267CE9D90010EAD6 /* Profile.swift in Sources */,
|
||||
37B767DC2677C3CA0098BAA8 /* PlayerState.swift in Sources */,
|
||||
3797758C2689345500DD52A8 /* Store.swift in Sources */,
|
||||
@ -759,6 +827,8 @@
|
||||
37CEE4BA2677B63F005A1EFE /* StreamResolution.swift in Sources */,
|
||||
37977584268922F600DD52A8 /* InvidiousAPI.swift in Sources */,
|
||||
37B17DA1268A1F89006AEE9B /* VideoContextMenuView.swift in Sources */,
|
||||
373CFAD4269662AB003CB2C6 /* SearchDate.swift in Sources */,
|
||||
373CFADC269663F1003CB2C6 /* Thumbnail.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -794,12 +864,16 @@
|
||||
37D4B1842671684E00C925CA /* PlayerView.swift in Sources */,
|
||||
37D4B1802671650A00C925CA /* PearvidiousApp.swift in Sources */,
|
||||
371231852683E7820000B307 /* VideosView.swift in Sources */,
|
||||
373CFAC926966188003CB2C6 /* SearchOptionsView.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 */,
|
||||
37C7A1DE267CE9D90010EAD6 /* Profile.swift in Sources */,
|
||||
3741B5302676213400125C5E /* PlayerViewController.swift in Sources */,
|
||||
373CFABE26966148003CB2C6 /* OptionsSectionView.swift in Sources */,
|
||||
37B767DD2677C3CA0098BAA8 /* PlayerState.swift in Sources */,
|
||||
37D4B18E26717B3800C925CA /* VideoListRowView.swift in Sources */,
|
||||
37AAF27E26737323007FC770 /* PopularVideosView.swift in Sources */,
|
||||
@ -807,19 +881,25 @@
|
||||
37AAF2962674086B007FC770 /* TabSelection.swift in Sources */,
|
||||
37C7A1D7267BFD9D0010EAD6 /* SponsorBlockSegment.swift in Sources */,
|
||||
376578932685490700D4EA09 /* PlaylistsView.swift in Sources */,
|
||||
377A20AB2693C9A2002842B8 /* TypedContentAccessors.swift in Sources */,
|
||||
37B17DA0268A1F89006AEE9B /* VideoContextMenuView.swift in Sources */,
|
||||
37CEE4C32677B697005A1EFE /* Stream.swift in Sources */,
|
||||
373CFAD5269662AB003CB2C6 /* SearchDate.swift in Sources */,
|
||||
379775952689365600DD52A8 /* Array+Next.swift in Sources */,
|
||||
37AAF28A2673AB89007FC770 /* ChannelView.swift in Sources */,
|
||||
3705B180267B4DFB00704544 /* TrendingCountrySelectionView.swift in Sources */,
|
||||
373CFACD26966264003CB2C6 /* SearchQuery.swift in Sources */,
|
||||
37141675267A8E10006CA35D /* Country.swift in Sources */,
|
||||
373CFAC42696616C003CB2C6 /* OptionRowView.swift in Sources */,
|
||||
372915EC2687EBA500F5A35B /* ListingLayout.swift in Sources */,
|
||||
37D4B19926717E1500C925CA /* Video.swift in Sources */,
|
||||
373CFAD9269662CD003CB2C6 /* SearchDuration.swift in Sources */,
|
||||
373CFAD126966290003CB2C6 /* SearchSortOrder.swift in Sources */,
|
||||
3705B184267B4E4900704544 /* TrendingCategory.swift in Sources */,
|
||||
37AAF2A226741C97007FC770 /* SubscriptionsView.swift in Sources */,
|
||||
372915E82687E3B900F5A35B /* Defaults.swift in Sources */,
|
||||
37D4B1812671653A00C925CA /* ContentView.swift in Sources */,
|
||||
37B76E98268747C900CE5671 /* ViewOptionsView.swift in Sources */,
|
||||
37B76E98268747C900CE5671 /* OptionsView.swift in Sources */,
|
||||
37CEE4BB2677B63F005A1EFE /* StreamResolution.swift in Sources */,
|
||||
3797758D2689345500DD52A8 /* Store.swift in Sources */,
|
||||
);
|
||||
|
@ -3,4 +3,70 @@
|
||||
uuid = "E30DA302-B258-4C14-8808-5E4CE238A4FF"
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
<Breakpoints>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "032F98C7-06A6-4DC6-8913-771A5D007CE5"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Apple TV/SearchView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "33"
|
||||
endingLineNumber = "33"
|
||||
landmarkName = "body"
|
||||
landmarkType = "24">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "8A4F4C9F-7372-4E74-9535-16BB3F2A3493"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Apple TV/VideosView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "13"
|
||||
endingLineNumber = "13"
|
||||
landmarkName = "body"
|
||||
landmarkType = "24">
|
||||
<Locations>
|
||||
<Location
|
||||
uuid = "8A4F4C9F-7372-4E74-9535-16BB3F2A3493 - 5e5aadfff65b9d"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "Pearvidious__Apple_TV_.VideosView.body.getter : some"
|
||||
moduleName = "Pearvidious (Apple TV)"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/arek/Developer/Pearvidious/Apple%20TV/VideosView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "15"
|
||||
endingLineNumber = "15"
|
||||
offsetFromSymbolStart = "660">
|
||||
</Location>
|
||||
<Location
|
||||
uuid = "8A4F4C9F-7372-4E74-9535-16BB3F2A3493 - d2d1bd8291983832"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "closure #1 () -> Swift.Optional<SwiftUI._ConditionalContent<Pearvidious__Apple_TV_.VideosCellsView, Pearvidious__Apple_TV_.VideosListView>> in Pearvidious__Apple_TV_.VideosView.body.getter : some"
|
||||
moduleName = "Pearvidious (Apple TV)"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/arek/Developer/Pearvidious/Apple%20TV/VideosView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "15"
|
||||
endingLineNumber = "15"
|
||||
offsetFromSymbolStart = "1920">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
@ -3,6 +3,9 @@ import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
@Default(.openChannel) var channel
|
||||
@Default(.showingVideoDetails) var showDetails
|
||||
|
||||
@State private var showingOptions = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
@ -33,6 +36,9 @@ struct ContentView: View {
|
||||
.tabItem { Image(systemName: "magnifyingglass") }
|
||||
.tag(TabSelection.search)
|
||||
}
|
||||
.fullScreenCover(isPresented: $showingOptions) { OptionsView() }
|
||||
.onPlayPauseCommand { showingOptions.toggle() }
|
||||
.background(videoDetailsViewNavigationLink)
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +48,10 @@ struct ContentView: View {
|
||||
set: { Defaults[.tabSelection] = $0 }
|
||||
)
|
||||
}
|
||||
|
||||
var videoDetailsViewNavigationLink: some View {
|
||||
NavigationLink("", destination: VideoDetailsView(), isActive: $showDetails).hidden()
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
|
@ -5,4 +5,10 @@ extension Defaults.Keys {
|
||||
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", default: nil)
|
||||
static let searchDuration = Key<SearchDuration?>("searchDuration", default: nil)
|
||||
static let openVideoID = Key<String>("videoID", default: "")
|
||||
static let showingVideoDetails = Key<Bool>("showingVideoDetails", default: false)
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
import Defaults
|
||||
|
||||
enum ListingLayout: String, CaseIterable, Defaults.Serializable {
|
||||
enum ListingLayout: String, CaseIterable, Identifiable, Defaults.Serializable {
|
||||
case list, cells
|
||||
|
||||
var id: String {
|
||||
rawValue
|
||||
}
|
||||
|
||||
var name: String {
|
||||
switch self {
|
||||
case .list:
|
||||
|
Loading…
Reference in New Issue
Block a user