Videos cache model

This commit is contained in:
Arkadiusz Fal
2022-12-10 01:23:13 +01:00
parent 0c960c2461
commit 64146b26c2
12 changed files with 204 additions and 9 deletions

View File

@@ -20,6 +20,11 @@ extension PlayerModel {
return
}
if let video = VideosCacheModel.shared.retrieveVideo(watch.video.cacheKey) {
historyVideos.append(video)
return
}
guard let api = playerAPI(watch.video) else { return }
api.video(watch.videoID)
@@ -28,6 +33,7 @@ extension PlayerModel {
guard let self else { return }
if let video: Video = response.typedContent() {
VideosCacheModel.shared.storeVideo(video)
self.historyVideos.append(video)
}
}