From a60a5e3991f64aeeed8b7b4369ee3b1d13e5d67a Mon Sep 17 00:00:00 2001 From: Satindar Dhillon Date: Mon, 18 Apr 2022 17:03:34 -0700 Subject: [PATCH] mark some models as deprecated --- .../App/PDFSupport/PDFViewerViewModel.swift | 10 +++---- .../App/Views/Home/HomeFeedViewModel.swift | 6 ++-- .../App/Views/Labels/ApplyLabelsView.swift | 8 +++--- .../App/Views/Labels/LabelsViewModel.swift | 14 +++++----- .../App/Views/WebReader/WebReader.swift | 2 +- .../Views/WebReader/WebReaderContent.swift | 4 +-- .../Views/WebReader/WebReaderViewModel.swift | 4 +-- .../CoreDataModel.xcdatamodel/contents | 28 +++++++++---------- ...eContent.swift => ArticleContentDep.swift} | 6 ++-- .../Sources/Models/DataModels/FeedItem.swift | 4 +-- ...ItemLabel.swift => FeedItemLabelDep.swift} | 2 +- .../{Highlight.swift => HighlightDep.swift} | 6 ++-- .../Services/DataService/DataService.swift | 4 +-- .../Mutations/CreateHighlight.swift | 4 +-- .../Mutations/CreateLabelPublisher.swift | 4 +-- .../Mutations/MergeHighlight.swift | 4 +-- .../UpdateArticleLabelsPublisher.swift | 4 +-- .../Mutations/UpdateHighlightAttributes.swift | 4 +-- .../Queries/ArticleContentQuery.swift | 6 ++-- .../DataService/Queries/LabelsPublisher.swift | 4 +-- .../Queries/PDFHighlightsQuery.swift | 6 ++-- .../Selections/FeedItemLabelSelection.swift | 2 +- .../Selections/HighlightSelection.swift | 2 +- .../CachedPDFHighlights.swift | 6 ++-- .../OmnivoreKit/Sources/Views/TextChip.swift | 4 +-- 25 files changed, 74 insertions(+), 74 deletions(-) rename apple/OmnivoreKit/Sources/Models/DataModels/{ArticleContent.swift => ArticleContentDep.swift} (78%) rename apple/OmnivoreKit/Sources/Models/DataModels/{FeedItemLabel.swift => FeedItemLabelDep.swift} (88%) rename apple/OmnivoreKit/Sources/Models/DataModels/{Highlight.swift => HighlightDep.swift} (95%) diff --git a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift index 7d1048eef..c1fde6ec3 100644 --- a/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/PDFSupport/PDFViewerViewModel.swift @@ -17,7 +17,7 @@ public final class PDFViewerViewModel: ObservableObject { self.feedItem = feedItem } - public func loadHighlights(completion onComplete: @escaping ([Highlight]) -> Void) { + public func loadHighlights(completion onComplete: @escaping ([HighlightDep]) -> Void) { guard let username = services.dataService.currentViewer?.username else { return } services.dataService.pdfHighlightsPublisher(username: username, slug: feedItem.slug).sink( @@ -32,8 +32,8 @@ public final class PDFViewerViewModel: ObservableObject { .store(in: &subscriptions) } - private func allHighlights(fetchedHighlights: [Highlight]) -> [Highlight] { - var resultSet = [String: Highlight]() + private func allHighlights(fetchedHighlights: [HighlightDep]) -> [HighlightDep] { + var resultSet = [String: HighlightDep]() for highlight in services.dataService.cachedHighlights(pdfID: feedItem.id) { resultSet[highlight.id] = highlight @@ -50,7 +50,7 @@ public final class PDFViewerViewModel: ObservableObject { public func createHighlight(shortId: String, highlightID: String, quote: String, patch: String) { services.dataService.persistHighlight( pdfID: feedItem.id, - highlight: Highlight( + highlight: HighlightDep( id: highlightID, shortId: shortId, quote: quote, @@ -88,7 +88,7 @@ public final class PDFViewerViewModel: ObservableObject { ) { services.dataService.persistHighlight( pdfID: feedItem.id, - highlight: Highlight( + highlight: HighlightDep( id: highlightID, shortId: shortId, quote: quote, diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift index 0460a1578..d2d052fb8 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift @@ -12,14 +12,14 @@ import Views var uncommittedReadingProgressUpdates = [String: Double]() /// Track label updates to be committed when user navigates back to grid view - var uncommittedLabelUpdates = [String: [FeedItemLabel]]() + var uncommittedLabelUpdates = [String: [FeedItemLabelDep]]() @Published var items = [FeedItem]() @Published var isLoading = false @Published var showPushNotificationPrimer = false @Published var itemUnderLabelEdit: FeedItem? @Published var searchTerm = "" - @Published var selectedLabels = [FeedItemLabel]() + @Published var selectedLabels = [FeedItemLabelDep]() @Published var snoozePresented = false @Published var itemToSnooze: FeedItem? @Published var selectedLinkItem: FeedItem? @@ -194,7 +194,7 @@ import Views } } - func updateLabels(itemID: String, labels: [FeedItemLabel]) { + func updateLabels(itemID: String, labels: [FeedItemLabelDep]) { // If item is being being displayed then delay the state update of labels until // user is no longer reading the item. if selectedLinkItem != nil { diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift index 5c81b1b70..8e2fa47f1 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift @@ -6,7 +6,7 @@ import Views struct ApplyLabelsView: View { enum Mode { case item(FeedItem) - case list([FeedItemLabel]) + case list([FeedItemLabelDep]) var navTitle: String { switch self { @@ -28,7 +28,7 @@ struct ApplyLabelsView: View { } let mode: Mode - let commitLabelChanges: ([FeedItemLabel]) -> Void + let commitLabelChanges: ([FeedItemLabelDep]) -> Void @EnvironmentObject var dataService: DataService @Environment(\.presentationMode) private var presentationMode @@ -147,8 +147,8 @@ struct ApplyLabelsView: View { } } -private extension Sequence where Element == FeedItemLabel { - func applySearchFilter(_ searchFilter: String) -> [FeedItemLabel] { +private extension Sequence where Element == FeedItemLabelDep { + func applySearchFilter(_ searchFilter: String) -> [FeedItemLabelDep] { if searchFilter.isEmpty { return map { $0 } // return the identity of the sequence } diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsViewModel.swift index 35159e8ca..d35f3c9d7 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsViewModel.swift @@ -7,9 +7,9 @@ import Views final class LabelsViewModel: ObservableObject { private var hasLoadedInitialLabels = false @Published var isLoading = false - @Published var selectedLabels = [FeedItemLabel]() - @Published var unselectedLabels = [FeedItemLabel]() - @Published var labels = [FeedItemLabel]() + @Published var selectedLabels = [FeedItemLabelDep]() + @Published var unselectedLabels = [FeedItemLabelDep]() + @Published var labels = [FeedItemLabelDep]() @Published var showCreateEmailModal = false var subscriptions = Set() @@ -19,7 +19,7 @@ final class LabelsViewModel: ObservableObject { /// - dataService: `DataService` reference /// - item: Optional `FeedItem` for applying labels to a single item /// - initiallySelectedLabels: Optional `[FeedItemLabel]` for filtering a list of items - func loadLabels(dataService: DataService, item: FeedItem? = nil, initiallySelectedLabels: [FeedItemLabel]? = nil) { + func loadLabels(dataService: DataService, item: FeedItem? = nil, initiallySelectedLabels: [FeedItemLabelDep]? = nil) { guard !hasLoadedInitialLabels else { return } isLoading = true @@ -82,7 +82,7 @@ final class LabelsViewModel: ObservableObject { .store(in: &subscriptions) } - func saveItemLabelChanges(itemID: String, dataService: DataService, onComplete: @escaping ([FeedItemLabel]) -> Void) { + func saveItemLabelChanges(itemID: String, dataService: DataService, onComplete: @escaping ([FeedItemLabelDep]) -> Void) { isLoading = true dataService.updateArticleLabelsPublisher(itemID: itemID, labelIDs: selectedLabels.map(\.id)).sink( receiveCompletion: { [weak self] _ in @@ -93,12 +93,12 @@ final class LabelsViewModel: ObservableObject { .store(in: &subscriptions) } - func addLabelToItem(_ label: FeedItemLabel) { + func addLabelToItem(_ label: FeedItemLabelDep) { selectedLabels.insert(label, at: 0) unselectedLabels.removeAll { $0.id == label.id } } - func removeLabelFromItem(_ label: FeedItemLabel) { + func removeLabelFromItem(_ label: FeedItemLabelDep) { unselectedLabels.insert(label, at: 0) selectedLabels.removeAll { $0.id == label.id } } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift index a4544fafb..c7c678c2e 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReader.swift @@ -6,7 +6,7 @@ import WebKit #if os(iOS) struct WebReader: UIViewRepresentable { - let articleContent: ArticleContent + let articleContent: ArticleContentDep let item: FeedItem let openLinkAction: (URL) -> Void let webViewActionHandler: (WKScriptMessage, WKScriptMessageReplyHandler?) -> Void diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContent.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContent.swift index 1f0b813ea..8414c374d 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContent.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContent.swift @@ -4,12 +4,12 @@ import Utils struct WebReaderContent { let textFontSize: Int - let articleContent: ArticleContent + let articleContent: ArticleContentDep let item: FeedItem let themeKey: String init( - articleContent: ArticleContent, + articleContent: ArticleContentDep, item: FeedItem, isDark: Bool, fontSize: Int diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift index 4b7b8f855..3895f6b35 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderViewModel.swift @@ -9,14 +9,14 @@ struct SafariWebLink: Identifiable { let url: URL } -func encodeHighlightResult(_ highlight: Highlight) -> [String: Any]? { +func encodeHighlightResult(_ highlight: HighlightDep) -> [String: Any]? { guard let data = try? JSONEncoder().encode(highlight) else { return nil } return try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any] } final class WebReaderViewModel: ObservableObject { @Published var isLoading = false - @Published var articleContent: ArticleContent? + @Published var articleContent: ArticleContentDep? var slug: String? var subscriptions = Set() diff --git a/apple/OmnivoreKit/Sources/Models/CoreData/CoreDataModel.xcdatamodeld/CoreDataModel.xcdatamodel/contents b/apple/OmnivoreKit/Sources/Models/CoreData/CoreDataModel.xcdatamodeld/CoreDataModel.xcdatamodel/contents index 2a18d1709..568d9d5e3 100644 --- a/apple/OmnivoreKit/Sources/Models/CoreData/CoreDataModel.xcdatamodeld/CoreDataModel.xcdatamodel/contents +++ b/apple/OmnivoreKit/Sources/Models/CoreData/CoreDataModel.xcdatamodeld/CoreDataModel.xcdatamodel/contents @@ -1,5 +1,17 @@ + + + + + + + + + + + + @@ -36,19 +48,7 @@ - - - - - - - - - - - - - + @@ -88,7 +88,7 @@ - + diff --git a/apple/OmnivoreKit/Sources/Models/DataModels/ArticleContent.swift b/apple/OmnivoreKit/Sources/Models/DataModels/ArticleContentDep.swift similarity index 78% rename from apple/OmnivoreKit/Sources/Models/DataModels/ArticleContent.swift rename to apple/OmnivoreKit/Sources/Models/DataModels/ArticleContentDep.swift index bc55cf570..101900231 100644 --- a/apple/OmnivoreKit/Sources/Models/DataModels/ArticleContent.swift +++ b/apple/OmnivoreKit/Sources/Models/DataModels/ArticleContentDep.swift @@ -1,12 +1,12 @@ import Foundation -public struct ArticleContent { +public struct ArticleContentDep { public let htmlContent: String - public let highlights: [Highlight] + public let highlights: [HighlightDep] public init( htmlContent: String, - highlights: [Highlight] + highlights: [HighlightDep] ) { self.htmlContent = htmlContent self.highlights = highlights diff --git a/apple/OmnivoreKit/Sources/Models/DataModels/FeedItem.swift b/apple/OmnivoreKit/Sources/Models/DataModels/FeedItem.swift index 3a2b3ea83..f7618d6bc 100644 --- a/apple/OmnivoreKit/Sources/Models/DataModels/FeedItem.swift +++ b/apple/OmnivoreKit/Sources/Models/DataModels/FeedItem.swift @@ -28,7 +28,7 @@ public struct FeedItem: Identifiable, Hashable { public let slug: String public let isArchived: Bool public let contentReader: String? - public var labels: [FeedItemLabel] + public var labels: [FeedItemLabelDep] public init( id: String, @@ -48,7 +48,7 @@ public struct FeedItem: Identifiable, Hashable { slug: String, isArchived: Bool, contentReader: String?, - labels: [FeedItemLabel] + labels: [FeedItemLabelDep] ) { self.id = id self.title = title diff --git a/apple/OmnivoreKit/Sources/Models/DataModels/FeedItemLabel.swift b/apple/OmnivoreKit/Sources/Models/DataModels/FeedItemLabelDep.swift similarity index 88% rename from apple/OmnivoreKit/Sources/Models/DataModels/FeedItemLabel.swift rename to apple/OmnivoreKit/Sources/Models/DataModels/FeedItemLabelDep.swift index eeed689b7..ef40ae284 100644 --- a/apple/OmnivoreKit/Sources/Models/DataModels/FeedItemLabel.swift +++ b/apple/OmnivoreKit/Sources/Models/DataModels/FeedItemLabelDep.swift @@ -1,6 +1,6 @@ import Foundation -public struct FeedItemLabel: Decodable, Hashable { +public struct FeedItemLabelDep: Decodable, Hashable { public let id: String public let name: String public let color: String diff --git a/apple/OmnivoreKit/Sources/Models/DataModels/Highlight.swift b/apple/OmnivoreKit/Sources/Models/DataModels/HighlightDep.swift similarity index 95% rename from apple/OmnivoreKit/Sources/Models/DataModels/Highlight.swift rename to apple/OmnivoreKit/Sources/Models/DataModels/HighlightDep.swift index a7d079125..8e2c43c5f 100644 --- a/apple/OmnivoreKit/Sources/Models/DataModels/Highlight.swift +++ b/apple/OmnivoreKit/Sources/Models/DataModels/HighlightDep.swift @@ -1,7 +1,7 @@ import CoreData import Foundation -public struct Highlight: Identifiable, Hashable, Codable { +public struct HighlightDep: Identifiable, Hashable, Codable { public let id: String public let shortId: String public let quote: String @@ -54,8 +54,8 @@ public struct Highlight: Identifiable, Hashable, Codable { return persistedHighlight } - public static func make(from persistedHighlight: PersistedHighlight) -> Highlight { - Highlight( + public static func make(from persistedHighlight: PersistedHighlight) -> HighlightDep { + HighlightDep( id: persistedHighlight.id ?? "", shortId: persistedHighlight.shortId ?? "", quote: persistedHighlight.quote ?? "", diff --git a/apple/OmnivoreKit/Sources/Services/DataService/DataService.swift b/apple/OmnivoreKit/Sources/Services/DataService/DataService.swift index 57287283b..de32ddbd2 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/DataService.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/DataService.swift @@ -76,13 +76,13 @@ public extension DataService { } } - func pageFromCache(slug: String) -> ArticleContent? { + func pageFromCache(slug: String) -> ArticleContentDep? { let fetchRequest: NSFetchRequest = PersistedArticleContent.fetchRequest() fetchRequest.predicate = NSPredicate( format: "slug = %@", slug ) if let htmlContent = try? persistentContainer.viewContext.fetch(fetchRequest).first?.htmlContent { - return ArticleContent(htmlContent: htmlContent, highlights: []) + return ArticleContentDep(htmlContent: htmlContent, highlights: []) } else { return nil } diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateHighlight.swift b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateHighlight.swift index 3634157c8..09d9e112e 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateHighlight.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateHighlight.swift @@ -11,9 +11,9 @@ public extension DataService { patch: String, articleId: String, annotation: String? = nil - ) -> AnyPublisher { + ) -> AnyPublisher { enum MutationResult { - case saved(highlight: Highlight) + case saved(highlight: HighlightDep) case error(errorCode: Enums.CreateHighlightErrorCode) } diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateLabelPublisher.swift b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateLabelPublisher.swift index 6400f87cf..cd266f4f1 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateLabelPublisher.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateLabelPublisher.swift @@ -8,9 +8,9 @@ public extension DataService { name: String, color: String, description: String? - ) -> AnyPublisher { + ) -> AnyPublisher { enum MutationResult { - case saved(label: FeedItemLabel) + case saved(label: FeedItemLabelDep) case error(errorCode: Enums.CreateLabelErrorCode) } diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/MergeHighlight.swift b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/MergeHighlight.swift index 3575032f3..01d6545c6 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/MergeHighlight.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/MergeHighlight.swift @@ -12,9 +12,9 @@ public extension DataService { patch: String, articleId: String, overlapHighlightIdList: [String] - ) -> AnyPublisher { + ) -> AnyPublisher { enum MutationResult { - case saved(highlight: Highlight) + case saved(highlight: HighlightDep) case error(errorCode: Enums.MergeHighlightErrorCode) } diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/UpdateArticleLabelsPublisher.swift b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/UpdateArticleLabelsPublisher.swift index 0809b693a..df552adaa 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/UpdateArticleLabelsPublisher.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/UpdateArticleLabelsPublisher.swift @@ -4,9 +4,9 @@ import Models import SwiftGraphQL public extension DataService { - func updateArticleLabelsPublisher(itemID: String, labelIDs: [String]) -> AnyPublisher<[FeedItemLabel], BasicError> { + func updateArticleLabelsPublisher(itemID: String, labelIDs: [String]) -> AnyPublisher<[FeedItemLabelDep], BasicError> { enum MutationResult { - case saved(feedItem: [FeedItemLabel]) + case saved(feedItem: [FeedItemLabelDep]) case error(errorCode: Enums.SetLabelsErrorCode) } diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/UpdateHighlightAttributes.swift b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/UpdateHighlightAttributes.swift index 33b75a012..8bfde44e0 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/UpdateHighlightAttributes.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/UpdateHighlightAttributes.swift @@ -8,9 +8,9 @@ public extension DataService { highlightID: String, annotation: String?, sharedAt: Date? - ) -> AnyPublisher { + ) -> AnyPublisher { enum MutationResult { - case saved(highlight: Highlight) + case saved(highlight: HighlightDep) case error(errorCode: Enums.UpdateHighlightErrorCode) } diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift b/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift index 3218215d8..f63a51c00 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Queries/ArticleContentQuery.swift @@ -4,14 +4,14 @@ import Models import SwiftGraphQL public extension DataService { - func articleContentPublisher(username: String, slug: String) -> AnyPublisher { + func articleContentPublisher(username: String, slug: String) -> AnyPublisher { enum QueryResult { - case success(result: ArticleContent) + case success(result: ArticleContentDep) case error(error: String) } let articleSelection = Selection.Article { - ArticleContent( + ArticleContentDep( htmlContent: try $0.content(), highlights: try $0.highlights(selection: highlightSelection.list) ) diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Queries/LabelsPublisher.swift b/apple/OmnivoreKit/Sources/Services/DataService/Queries/LabelsPublisher.swift index 5cce49647..3e01903f9 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Queries/LabelsPublisher.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Queries/LabelsPublisher.swift @@ -4,9 +4,9 @@ import Models import SwiftGraphQL public extension DataService { - func labelsPublisher() -> AnyPublisher<[FeedItemLabel], ServerError> { + func labelsPublisher() -> AnyPublisher<[FeedItemLabelDep], ServerError> { enum QueryResult { - case success(result: [FeedItemLabel]) + case success(result: [FeedItemLabelDep]) case error(error: String) } diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Queries/PDFHighlightsQuery.swift b/apple/OmnivoreKit/Sources/Services/DataService/Queries/PDFHighlightsQuery.swift index 9dcacd325..7fe2ff470 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Queries/PDFHighlightsQuery.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Queries/PDFHighlightsQuery.swift @@ -4,14 +4,14 @@ import Models import SwiftGraphQL public extension DataService { - func pdfHighlightsPublisher(username: String, slug: String) -> AnyPublisher<[Highlight], ServerError> { + func pdfHighlightsPublisher(username: String, slug: String) -> AnyPublisher<[HighlightDep], ServerError> { enum QueryResult { - case success(result: [Highlight]) + case success(result: [HighlightDep]) case error(error: String) } let highlightSelection = Selection.Highlight { - Highlight( + HighlightDep( id: try $0.id(), shortId: try $0.shortId(), quote: try $0.quote(), diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Selections/FeedItemLabelSelection.swift b/apple/OmnivoreKit/Sources/Services/DataService/Selections/FeedItemLabelSelection.swift index 2b0abade0..656392464 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Selections/FeedItemLabelSelection.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Selections/FeedItemLabelSelection.swift @@ -2,7 +2,7 @@ import Models import SwiftGraphQL let feedItemLabelSelection = Selection.Label { - FeedItemLabel( + FeedItemLabelDep( id: try $0.id(), name: try $0.name(), color: try $0.color(), diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Selections/HighlightSelection.swift b/apple/OmnivoreKit/Sources/Services/DataService/Selections/HighlightSelection.swift index 769901b40..276078550 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Selections/HighlightSelection.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Selections/HighlightSelection.swift @@ -2,7 +2,7 @@ import Models import SwiftGraphQL let highlightSelection = Selection.Highlight { - Highlight( + HighlightDep( id: try $0.id(), shortId: try $0.shortId(), quote: try $0.quote(), diff --git a/apple/OmnivoreKit/Sources/Services/Persistence/PersistableModels/CachedPDFHighlights.swift b/apple/OmnivoreKit/Sources/Services/Persistence/PersistableModels/CachedPDFHighlights.swift index c9a225c11..415be2bb1 100644 --- a/apple/OmnivoreKit/Sources/Services/Persistence/PersistableModels/CachedPDFHighlights.swift +++ b/apple/OmnivoreKit/Sources/Services/Persistence/PersistableModels/CachedPDFHighlights.swift @@ -4,17 +4,17 @@ import Foundation import Models public extension DataService { - func cachedHighlights(pdfID: String) -> [Highlight] { + func cachedHighlights(pdfID: String) -> [HighlightDep] { let fetchRequest: NSFetchRequest = PersistedHighlight.fetchRequest() fetchRequest.predicate = NSPredicate( format: "associatedItemId = %@ AND markedForDeletion = %@", pdfID, false ) let highlights = (try? persistentContainer.viewContext.fetch(fetchRequest)) ?? [] - return highlights.map { Highlight.make(from: $0) } + return highlights.map { HighlightDep.make(from: $0) } } - func persistHighlight(pdfID: String, highlight: Highlight) { + func persistHighlight(pdfID: String, highlight: HighlightDep) { _ = highlight.toManagedObject( context: persistentContainer.viewContext, associatedItemID: pdfID diff --git a/apple/OmnivoreKit/Sources/Views/TextChip.swift b/apple/OmnivoreKit/Sources/Views/TextChip.swift index c07ce3463..198d42d94 100644 --- a/apple/OmnivoreKit/Sources/Views/TextChip.swift +++ b/apple/OmnivoreKit/Sources/Views/TextChip.swift @@ -8,7 +8,7 @@ public struct TextChip: View { self.color = color } - public init?(feedItemLabel: FeedItemLabel) { + public init?(feedItemLabel: FeedItemLabelDep) { guard let color = Color(hex: feedItemLabel.color) else { return nil } self.text = feedItemLabel.name @@ -41,7 +41,7 @@ public struct TextChipButton: View { } public static func makeRemovableLabelButton( - feedItemLabel: FeedItemLabel, + feedItemLabel: FeedItemLabelDep, onTap: @escaping () -> Void ) -> TextChipButton { TextChipButton(