From ce040b89832d2b5bcdbf651f568b465a9124cf4c Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 9 Jun 2022 10:44:00 -0700 Subject: [PATCH] Use cached PDFs if available --- .../Sources/App/PDFSupport/PDFViewerViewModel.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift index fc9a2f4b1..5b25456cb 100644 --- a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift @@ -90,6 +90,9 @@ public final class PDFViewerViewModel: ObservableObject { public func downloadPDF(dataService: DataService) async -> URL? { do { + if itemDownloaded { + return pdfItem.localPdfURL + } if let localURL = try await dataService.fetchPDFData(slug: pdfItem.slug, pageURLString: pdfItem.originalArticleURL) { return localURL }