From 232131242732e713dc853676dfbb29382444124d Mon Sep 17 00:00:00 2001 From: ronaldheft Date: Sun, 21 Aug 2022 11:34:30 -0400 Subject: [PATCH] Revert "Fixes missing LocalMediaProgress for downloads without existing progress" This reverts commit 7745ccefabddd83b222b863e63a463212ec59733. --- ios/App/App/plugins/AbsDownloader.swift | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ios/App/App/plugins/AbsDownloader.swift b/ios/App/App/plugins/AbsDownloader.swift index 04dae1a6..a5dbffa2 100644 --- a/ios/App/App/plugins/AbsDownloader.swift +++ b/ios/App/App/plugins/AbsDownloader.swift @@ -186,15 +186,12 @@ public class AbsDownloader: CAPPlugin, URLSessionDownloadDelegate { statusNotification["localLibraryItem"] = try? localLibraryItem.asDictionary() - var localMediaProgress: LocalMediaProgress if let progress = libraryItem.userMediaProgress { let episode = downloadItem.media?.episodes.first(where: { $0.id == downloadItem.episodeId }) - localMediaProgress = LocalMediaProgress(localLibraryItem: localLibraryItem!, episode: episode, progress: progress) - } else { - localMediaProgress = LocalMediaProgress.fetchOrCreateLocalMediaProgress(localMediaProgressId: nil, localLibraryItemId: localLibraryItem?.id, localEpisodeId: downloadItem.episodeId)! + let localMediaProgress = LocalMediaProgress(localLibraryItem: localLibraryItem!, episode: episode, progress: progress) + Database.shared.saveLocalMediaProgress(localMediaProgress) + statusNotification["localMediaProgress"] = try? localMediaProgress.asDictionary() } - Database.shared.saveLocalMediaProgress(localMediaProgress) - statusNotification["localMediaProgress"] = try? localMediaProgress.asDictionary() self.notifyListeners("onItemDownloadComplete", data: statusNotification) }