Remove debug lines

This commit is contained in:
Jackson Harper 2022-06-13 09:42:59 -07:00
parent 7084f18932
commit 2a7a87de09
3 changed files with 4 additions and 19 deletions

View file

@ -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

View file

@ -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) {

View file

@ -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<Models.LinkedItem> = 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
}
}