mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Refactor
This commit is contained in:
@@ -68,7 +68,7 @@ struct ChannelPlaylistView: View {
|
||||
.environment(\.listingStyle, channelPlaylistListingStyle)
|
||||
.onAppear {
|
||||
if let playlist = presentedPlaylist,
|
||||
let cache = ChannelPlaylistsCacheModel.shared.retrievePlaylist(playlist.id)
|
||||
let cache = ChannelPlaylistsCacheModel.shared.retrievePlaylist(playlist)
|
||||
{
|
||||
store.replace(cache)
|
||||
}
|
||||
|
@@ -82,8 +82,8 @@ struct FavoriteItemView: View {
|
||||
ChannelsCacheModel.shared.store(channel)
|
||||
}
|
||||
}
|
||||
case let .channelPlaylist(_, id, _):
|
||||
if let cache = ChannelPlaylistsCacheModel.shared.retrievePlaylist(id),
|
||||
case let .channelPlaylist(_, id, title):
|
||||
if let cache = ChannelPlaylistsCacheModel.shared.retrievePlaylist(.init(id: id, title: title)),
|
||||
!cache.videos.isEmpty
|
||||
{
|
||||
contentItems = ContentItem.array(of: cache.videos)
|
||||
|
@@ -54,7 +54,7 @@ struct PlaylistVideosView: View {
|
||||
}
|
||||
|
||||
func loadCachedResource() {
|
||||
if let cache = ChannelPlaylistsCacheModel.shared.retrievePlaylist(playlist.id) {
|
||||
if let cache = ChannelPlaylistsCacheModel.shared.retrievePlaylist(playlist.channelPlaylist) {
|
||||
DispatchQueue.main.async {
|
||||
self.channelPlaylist.replace(cache)
|
||||
}
|
||||
|
@@ -197,7 +197,8 @@ struct PlaylistsView: View {
|
||||
|
||||
func loadCachedResource() {
|
||||
if !selectedPlaylistID.isEmpty,
|
||||
let cache = ChannelPlaylistsCacheModel.shared.retrievePlaylist(selectedPlaylistID)
|
||||
let currentPlaylist,
|
||||
let cache = ChannelPlaylistsCacheModel.shared.retrievePlaylist(currentPlaylist.channelPlaylist)
|
||||
{
|
||||
DispatchQueue.main.async {
|
||||
self.channelPlaylist.replace(cache)
|
||||
|
@@ -18,6 +18,7 @@ struct ContentItemView: View {
|
||||
placeholderItem()
|
||||
}
|
||||
}
|
||||
.id(item.cacheKey)
|
||||
}
|
||||
|
||||
@ViewBuilder func videoItem(_ video: Video) -> some View {
|
||||
|
Reference in New Issue
Block a user