mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Fix handling feed
This commit is contained in:
@@ -34,30 +34,7 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
||||
func setAccount(_ account: Account) {
|
||||
self.account = account
|
||||
|
||||
wipeResources()
|
||||
configure()
|
||||
|
||||
if !account.anonymous {
|
||||
validate()
|
||||
}
|
||||
}
|
||||
|
||||
func validate() {
|
||||
validateSID()
|
||||
}
|
||||
|
||||
func validateSID() {
|
||||
guard signedIn, !(account.token?.isEmpty ?? true) else {
|
||||
return
|
||||
}
|
||||
|
||||
feed?
|
||||
.load()
|
||||
.onFailure { _ in
|
||||
self.updateToken(force: true)
|
||||
}
|
||||
|
||||
wipeResources()
|
||||
}
|
||||
|
||||
func configure() {
|
||||
@@ -162,7 +139,11 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
||||
return CommentsPage(comments: comments, nextPage: nextPage, disabled: disabled)
|
||||
}
|
||||
|
||||
updateToken()
|
||||
if account.token.isNil || account.token!.isEmpty {
|
||||
updateToken()
|
||||
} else {
|
||||
FeedModel.shared.onAccountChange()
|
||||
}
|
||||
}
|
||||
|
||||
func updateToken(force: Bool = false) {
|
||||
|
@@ -26,7 +26,6 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
|
||||
func setAccount(_ account: Account) {
|
||||
self.account = account
|
||||
|
||||
wipeResources()
|
||||
configure()
|
||||
}
|
||||
|
||||
@@ -108,8 +107,10 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
|
||||
content.json.arrayValue.compactMap { self.extractUserPlaylist(from: $0) }
|
||||
}
|
||||
|
||||
if account.token.isNil {
|
||||
if account.token.isNil || account.token!.isEmpty {
|
||||
updateToken()
|
||||
} else {
|
||||
FeedModel.shared.loadResources(force: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user