From 2a7a87de09f22fbe2344ed0d5e3be92038141562 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 13 Jun 2022 09:42:59 -0700 Subject: [PATCH] Remove debug lines --- .../Sources/App/PDFSupport/PDFViewer.swift | 1 - .../App/PDFSupport/PDFViewerViewModel.swift | 1 - .../Queries/ArticleContentQuery.swift | 21 ++++--------------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift index fa89eeb4e..d6217081c 100644 --- a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift +++ b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewer.swift @@ -142,7 +142,6 @@ import Utils // NOTE: the issue here is the PDF is downloaded, but saved to a URL we don't know about // because it is changed. let pdfURL = await viewModel.downloadPDF(dataService: dataService) - print("PDF URL", pdfURL) if let pdfURL = pdfURL { let document = HighlightedDocument(url: pdfURL, viewModel: viewModel) pdfStateObject.document = document diff --git a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift index 2f78cef45..14bcb6ed2 100644 --- a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift @@ -97,7 +97,6 @@ public final class PDFViewerViewModel: ObservableObject { if let tempURL = pdfItem.tempPDFURL { if let localURL = try? PDFUtils.copyToLocal(url: tempURL) { return tempURL - // return URL(string: localURL) } } if let localURL = try await dataService.fetchPDFData(slug: pdfItem.slug, pageURLString: pdfItem.originalArticleURL) { diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift b/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift index 843239a1f..e1851149b 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift @@ -251,30 +251,17 @@ public extension DataService { } } - if item.isPDF { - if needsPDFDownload { - print("PDF does not exist, downloading", item.id, item.title) - try await backgroundContext.perform { - let fetchRequest: NSFetchRequest = LinkedItem.fetchRequest() - fetchRequest.predicate = NSPredicate(format: "id == %@", item.id) - - let existingItem = try? self.backgroundContext.fetch(fetchRequest).first - print("EXISTING ITEM", existingItem) - } - - try await fetchPDFData(slug: item.slug, pageURLString: item.pageURLString) - } else { - print("PDF already exists, not downloading", item.id) - } + if item.isPDF && needsPDFDownload { + try await fetchPDFData(slug: item.slug, pageURLString: item.pageURLString) } try await backgroundContext.perform { [weak self] in do { try self?.backgroundContext.save() - // logger.debug("ArticleContent saved succesfully") + logger.debug("ArticleContent saved succesfully") } catch { self?.backgroundContext.rollback() - // logger.debug("Failed to save ArticleContent") + logger.debug("Failed to save ArticleContent") throw error } }