From 0c960c246119b4e52e6ef8ca541b8cac69408422 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 9 Dec 2022 20:33:01 +0100 Subject: [PATCH] Peertube fixes --- Model/HistoryModel.swift | 6 ++++-- Model/Watch.swift | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Model/HistoryModel.swift b/Model/HistoryModel.swift index 15d0a0e6..4d715f5d 100644 --- a/Model/HistoryModel.swift +++ b/Model/HistoryModel.swift @@ -11,7 +11,6 @@ extension PlayerModel { } func loadHistoryVideoDetails(_ watch: Watch) { - logger.info("id: \(watch.videoID), instance \(watch.instanceURL), app \(watch.appName)") guard historyVideo(watch.videoID).isNil else { return } @@ -21,7 +20,10 @@ extension PlayerModel { return } - playerAPI(watch.video).video(watch.videoID).load() + guard let api = playerAPI(watch.video) else { return } + + api.video(watch.videoID) + .load() .onSuccess { [weak self] response in guard let self else { return } diff --git a/Model/Watch.swift b/Model/Watch.swift index f1b7b00a..69a52023 100644 --- a/Model/Watch.swift +++ b/Model/Watch.swift @@ -89,8 +89,12 @@ extension Watch { } var video: Video { - if !Video.VideoID.isValid(videoID), let url = URL(string: videoID) { - return .local(url) + let url = URL(string: videoID) + + if app == nil || !Video.VideoID.isValid(videoID) { + if let url { + return .local(url) + } } return Video(app: app, instanceURL: instanceURL, videoID: videoID)