mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
rename article content models to avoid clashing
This commit is contained in:
parent
6968e06da5
commit
6658d1d69b
4 changed files with 9 additions and 9 deletions
|
|
@ -11,7 +11,7 @@ struct SafariWebLink: Identifiable {
|
|||
|
||||
final class WebReaderViewModel: ObservableObject {
|
||||
@Published var isLoading = false
|
||||
@Published var articleContent: ArticleContentDep?
|
||||
@Published var articleContent: ArticleContent?
|
||||
|
||||
var slug: String?
|
||||
var subscriptions = Set<AnyCancellable>()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import Foundation
|
||||
|
||||
public struct ArticleContentDep {
|
||||
public struct ArticleContent {
|
||||
public let htmlContent: String
|
||||
public let highlightsJSONString: String
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ public extension DataService {
|
|||
}
|
||||
}
|
||||
|
||||
func pageFromCache(slug: String) -> ArticleContentDep? {
|
||||
func pageFromCache(slug: String) -> ArticleContent? {
|
||||
// TODO: cerate highlightsJSON from stored highlights
|
||||
// let fetchRequest: NSFetchRequest<Models.LinkedItem> = LinkedItem.fetchRequest()
|
||||
// fetchRequest.predicate = NSPredicate(
|
||||
|
|
@ -98,7 +98,7 @@ public extension DataService {
|
|||
)
|
||||
|
||||
if let articleContent = (try? persistentContainer.viewContext.fetch(fetchRequest))?.first {
|
||||
return ArticleContentDep(
|
||||
return ArticleContent(
|
||||
htmlContent: articleContent.htmlContent ?? "",
|
||||
highlightsJSONString: articleContent.highlightsJSONString ?? ""
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@ import Models
|
|||
import SwiftGraphQL
|
||||
|
||||
public extension DataService {
|
||||
struct ArticleContent {
|
||||
struct ArticleProps {
|
||||
let htmlContent: String
|
||||
let highlights: [InternalHighlight]
|
||||
}
|
||||
|
||||
func articleContentPublisher(username: String, slug: String) -> AnyPublisher<ArticleContentDep, ServerError> {
|
||||
func articleContentPublisher(username: String, slug: String) -> AnyPublisher<ArticleContent, ServerError> {
|
||||
enum QueryResult {
|
||||
case success(result: ArticleContent)
|
||||
case success(result: ArticleProps)
|
||||
case error(error: String)
|
||||
}
|
||||
|
||||
let articleSelection = Selection.Article {
|
||||
ArticleContent(
|
||||
ArticleProps(
|
||||
htmlContent: try $0.content(),
|
||||
highlights: try $0.highlights(selection: highlightSelection.list)
|
||||
)
|
||||
|
|
@ -56,7 +56,7 @@ public extension DataService {
|
|||
highlightsJSONString: highlightsJSONString
|
||||
)
|
||||
promise(.success(
|
||||
ArticleContentDep(
|
||||
ArticleContent(
|
||||
htmlContent: result.htmlContent,
|
||||
highlightsJSONString: highlightsJSONString
|
||||
))
|
||||
|
|
|
|||
Loading…
Reference in a new issue