mirror of
https://github.com/yattee/yattee.git
synced 2025-10-18 13:28:12 +00:00
Extended Piped support
This commit is contained in:
@@ -3,14 +3,14 @@ import Siesta
|
||||
import SwiftUI
|
||||
|
||||
struct WatchNowSection: View {
|
||||
let resource: Resource
|
||||
let resource: Resource?
|
||||
let label: String
|
||||
|
||||
@StateObject private var store = Store<[Video]>()
|
||||
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
|
||||
init(resource: Resource, label: String) {
|
||||
init(resource: Resource?, label: String) {
|
||||
self.resource = resource
|
||||
self.label = label
|
||||
}
|
||||
@@ -18,11 +18,11 @@ struct WatchNowSection: View {
|
||||
var body: some View {
|
||||
WatchNowSectionBody(label: label, videos: store.collection)
|
||||
.onAppear {
|
||||
resource.addObserver(store)
|
||||
resource.loadIfNeeded()
|
||||
resource?.addObserver(store)
|
||||
resource?.loadIfNeeded()
|
||||
}
|
||||
.onChange(of: accounts.current) { _ in
|
||||
resource.load()
|
||||
resource?.load()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,22 +5,22 @@ import SwiftUI
|
||||
struct WatchNowView: View {
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
|
||||
var api: InvidiousAPI! {
|
||||
accounts.invidious
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
PlayerControlsView {
|
||||
ScrollView(.vertical, showsIndicators: false) {
|
||||
if !accounts.current.isNil {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
if api.signedIn {
|
||||
WatchNowSection(resource: api.feed, label: "Subscriptions")
|
||||
if accounts.api.signedIn {
|
||||
WatchNowSection(resource: accounts.api.feed, label: "Subscriptions")
|
||||
}
|
||||
if accounts.app.supportsPopular {
|
||||
WatchNowSection(resource: accounts.api.popular, label: "Popular")
|
||||
}
|
||||
WatchNowSection(resource: accounts.api.trending(country: .pl, category: .default), label: "Trending")
|
||||
if accounts.app.supportsTrendingCategories {
|
||||
WatchNowSection(resource: accounts.api.trending(country: .pl, category: .movies), label: "Movies")
|
||||
WatchNowSection(resource: accounts.api.trending(country: .pl, category: .music), label: "Music")
|
||||
}
|
||||
WatchNowSection(resource: api.popular, label: "Popular")
|
||||
WatchNowSection(resource: api.trending(category: .default, country: .pl), label: "Trending")
|
||||
WatchNowSection(resource: api.trending(category: .movies, country: .pl), label: "Movies")
|
||||
WatchNowSection(resource: api.trending(category: .music, country: .pl), label: "Music")
|
||||
|
||||
// TODO: adding sections to view
|
||||
// ===================
|
||||
|
Reference in New Issue
Block a user