mirror of
https://github.com/yattee/yattee.git
synced 2025-01-07 18:10:33 +05:30
Accounts loading improvements
This commit is contained in:
parent
a32f417776
commit
78940a005b
@ -143,6 +143,8 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI {
|
|||||||
updateToken()
|
updateToken()
|
||||||
} else {
|
} else {
|
||||||
FeedModel.shared.onAccountChange()
|
FeedModel.shared.onAccountChange()
|
||||||
|
SubscribedChannelsModel.shared.onAccountChange()
|
||||||
|
PlaylistsModel.shared.onAccountChange()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,9 @@ final class PipedAPI: Service, ObservableObject, VideosAPI {
|
|||||||
if account.token.isNil || account.token!.isEmpty {
|
if account.token.isNil || account.token!.isEmpty {
|
||||||
updateToken()
|
updateToken()
|
||||||
} else {
|
} else {
|
||||||
FeedModel.shared.loadResources(force: true)
|
FeedModel.shared.onAccountChange()
|
||||||
|
SubscribedChannelsModel.shared.onAccountChange()
|
||||||
|
PlaylistsModel.shared.onAccountChange()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,4 +161,9 @@ final class SubscribedChannelsModel: ObservableObject, CacheModel {
|
|||||||
var formattedCacheTime: String {
|
var formattedCacheTime: String {
|
||||||
getFormattedDate(channelsTime)
|
getFormattedDate(channelsTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func onAccountChange() {
|
||||||
|
channels = []
|
||||||
|
load(force: true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,7 @@ final class FeedModel: ObservableObject, CacheModel {
|
|||||||
|
|
||||||
func onAccountChange() {
|
func onAccountChange() {
|
||||||
reset()
|
reset()
|
||||||
|
error = nil
|
||||||
loadResources(force: true)
|
loadResources(force: true)
|
||||||
calculateUnwatchedFeed()
|
calculateUnwatchedFeed()
|
||||||
}
|
}
|
||||||
|
@ -123,4 +123,10 @@ final class PlaylistsModel: ObservableObject {
|
|||||||
private var resource: Resource? {
|
private var resource: Resource? {
|
||||||
accounts.api.playlists
|
accounts.api.playlists
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func onAccountChange() {
|
||||||
|
error = nil
|
||||||
|
playlists = []
|
||||||
|
load()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,16 +38,6 @@ struct ContentView: View {
|
|||||||
TVNavigationView()
|
TVNavigationView()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
.onChange(of: accounts.current) { _ in
|
|
||||||
subscriptions.load(force: true)
|
|
||||||
playlists.load(force: true)
|
|
||||||
}
|
|
||||||
.onChange(of: accounts.signedIn) { newValue in
|
|
||||||
guard newValue else { return }
|
|
||||||
subscriptions.load(force: true)
|
|
||||||
playlists.load(force: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.overlay(videoPlayer)
|
.overlay(videoPlayer)
|
||||||
.sheet(isPresented: $navigation.presentingShareSheet) {
|
.sheet(isPresented: $navigation.presentingShareSheet) {
|
||||||
|
Loading…
Reference in New Issue
Block a user