2021-06-11 22:49:42 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct SubscriptionsView: View {
|
2021-06-28 10:43:07 +00:00
|
|
|
@ObservedObject private var store = Store<[Video]>()
|
2021-06-26 11:37:24 +00:00
|
|
|
|
2021-06-28 10:43:07 +00:00
|
|
|
var resource = InvidiousAPI.shared.subscriptions
|
2021-06-11 22:49:42 +00:00
|
|
|
|
2021-06-28 10:43:07 +00:00
|
|
|
init() {
|
|
|
|
resource.addObserver(store)
|
|
|
|
}
|
2021-06-26 11:37:24 +00:00
|
|
|
|
2021-06-28 10:43:07 +00:00
|
|
|
var body: some View {
|
|
|
|
VideosView(videos: store.collection)
|
|
|
|
.onAppear {
|
|
|
|
resource.loadIfNeeded()
|
|
|
|
}
|
2021-07-11 20:52:49 +00:00
|
|
|
.refreshable {
|
|
|
|
resource.load()
|
|
|
|
}
|
|
|
|
#if !os(tvOS)
|
|
|
|
.navigationTitle("Subscriptions")
|
|
|
|
#endif
|
2021-06-11 22:49:42 +00:00
|
|
|
}
|
|
|
|
}
|