1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30

Fix for loading subscriptions

This commit is contained in:
Arkadiusz Fal 2021-09-19 19:31:21 +02:00
parent bede29dd51
commit 433725c5e8
5 changed files with 21 additions and 4 deletions

View File

@ -30,11 +30,12 @@ final class InvidiousAPI: Service {
$0.pipeline[.parsing].add(SwiftyJSONTransformer, contentTypes: ["*/json"])
}
configure("/auth/**") {
configure(requestMethods: [.get]) {
$0.headers["Cookie"] = self.authHeader
}
configure("**", requestMethods: [.post]) {
$0.headers["Cookie"] = self.authHeader
$0.pipeline[.parsing].removeTransformers()
}
@ -108,6 +109,10 @@ final class InvidiousAPI: Service {
.withParam("region", country.rawValue)
}
var home: Resource {
resource(baseURL: InvidiousAPI.instance, path: "/feed/subscriptions")
}
var feed: Resource {
resource("/auth/feed")
}

View File

@ -6,7 +6,6 @@ struct Profile {
var skippedSegmentsCategories = [String]() // SponsorBlockSegmentsProvider.categories
// var sid = "B3_WzklziGu8JKefihLrCsTNavdj73KMiPUBfN5HW2M="
var sid = "RpoS7YPPK2-QS81jJF9z4KSQAjmzsOnMpn84c73-GQ8="
var cellsColumns = 3

View File

@ -208,7 +208,10 @@ struct VideoView: View {
image
.resizable()
} placeholder: {
ProgressView()
HStack {
ProgressView()
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
}
}
} else {
Image(systemName: "exclamationmark.square")

View File

@ -12,7 +12,13 @@ struct SubscriptionsView: View {
var body: some View {
VideosView(videos: store.collection)
.onAppear {
resource.loadIfNeeded()
if let home = InvidiousAPI.shared.home.loadIfNeeded() {
home.onSuccess { _ in
resource.loadIfNeeded()
}
} else {
resource.loadIfNeeded()
}
}
.refreshable {
resource.load()

View File

@ -2,6 +2,10 @@ import Siesta
import SwiftUI
struct WatchNowView: View {
init() {
InvidiousAPI.shared.home.loadIfNeeded()
}
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
VStack(alignment: .leading, spacing: 0) {