mirror of
https://github.com/yattee/yattee.git
synced 2025-11-24 18:28:20 +00:00
Add Piped support
This commit is contained in:
@@ -6,7 +6,7 @@ struct ChannelVideosView: View {
|
||||
|
||||
@StateObject private var store = Store<Channel>()
|
||||
|
||||
@EnvironmentObject<InvidiousAPI> private var api
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
@EnvironmentObject<SubscriptionsModel> private var subscriptions
|
||||
|
||||
@@ -99,7 +99,7 @@ struct ChannelVideosView: View {
|
||||
}
|
||||
|
||||
var resource: Resource {
|
||||
let resource = api.channel(channel.id)
|
||||
let resource = accounts.invidious.channel(channel.id)
|
||||
resource.addObserver(store)
|
||||
|
||||
return resource
|
||||
|
||||
@@ -52,6 +52,10 @@ struct PlayerControlsView<Content: View>: View {
|
||||
.padding(.vertical, 20)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
#if !os(tvOS)
|
||||
.keyboardShortcut("o")
|
||||
#endif
|
||||
|
||||
Group {
|
||||
if model.isPlaying {
|
||||
Button(action: {
|
||||
@@ -65,7 +69,7 @@ struct PlayerControlsView<Content: View>: View {
|
||||
}) {
|
||||
Label("Play", systemImage: "play.fill")
|
||||
}
|
||||
.disabled(model.player.currentItem == nil)
|
||||
.disabled(model.player.currentItem.isNil)
|
||||
}
|
||||
}
|
||||
.frame(minWidth: 30)
|
||||
|
||||
@@ -4,10 +4,10 @@ import SwiftUI
|
||||
struct PopularView: View {
|
||||
@StateObject private var store = Store<[Video]>()
|
||||
|
||||
@EnvironmentObject<InvidiousAPI> private var api
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
|
||||
var resource: Resource {
|
||||
api.popular
|
||||
accounts.invidious.popular
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
|
||||
@@ -5,12 +5,14 @@ struct SignInRequiredView<Content: View>: View {
|
||||
let title: String
|
||||
let content: Content
|
||||
|
||||
@EnvironmentObject<InvidiousAPI> private var api
|
||||
@Default(.instances) private var instances
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
|
||||
#if !os(macOS)
|
||||
@EnvironmentObject<NavigationModel> private var navigation
|
||||
#endif
|
||||
|
||||
@Default(.instances) private var instances
|
||||
|
||||
init(title: String, @ViewBuilder content: @escaping () -> Content) {
|
||||
self.title = title
|
||||
self.content = content()
|
||||
@@ -18,7 +20,7 @@ struct SignInRequiredView<Content: View>: View {
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if api.signedIn {
|
||||
if accounts.signedIn {
|
||||
content
|
||||
} else {
|
||||
prompt
|
||||
|
||||
@@ -4,7 +4,11 @@ import SwiftUI
|
||||
struct SubscriptionsView: View {
|
||||
@StateObject private var store = Store<[Video]>()
|
||||
|
||||
@EnvironmentObject<InvidiousAPI> private var api
|
||||
@EnvironmentObject<AccountsModel> private var accounts
|
||||
|
||||
var api: InvidiousAPI {
|
||||
accounts.invidious
|
||||
}
|
||||
|
||||
var feed: Resource {
|
||||
api.feed
|
||||
@@ -17,10 +21,7 @@ struct SubscriptionsView: View {
|
||||
.onAppear {
|
||||
loadResources()
|
||||
}
|
||||
.onChange(of: api.account) { _ in
|
||||
loadResources(force: true)
|
||||
}
|
||||
.onChange(of: feed) { _ in
|
||||
.onChange(of: accounts.account) { _ in
|
||||
loadResources(force: true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user