mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #541 from omnivore-app/fix/add-labels-to-appreader
Display labels on the appreader page
This commit is contained in:
commit
b4d89b673f
4 changed files with 16 additions and 1 deletions
|
|
@ -66,6 +66,7 @@ struct WebReaderContent {
|
|||
contentReader: "WEB",
|
||||
readingProgressPercent: \(item.readingProgress),
|
||||
readingProgressAnchorIndex: \(item.readingProgressAnchor),
|
||||
labels: \(item.labelsJSONString),
|
||||
highlights: \(highlightsJSONString),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,19 @@ public extension LinkedItem {
|
|||
return URL(string: pageURLString ?? "")
|
||||
}
|
||||
|
||||
var labelsJSONString: String {
|
||||
let labels = self.labels.asArray(of: LinkedItemLabel.self).map { label in
|
||||
[
|
||||
"id": NSString(string: label.id ?? ""),
|
||||
"color": NSString(string: label.color ?? ""),
|
||||
"name": NSString(string: label.name ?? ""),
|
||||
"description": NSString(string: label.labelDescription ?? "")
|
||||
]
|
||||
}
|
||||
guard let JSON = (try? JSONSerialization.data(withJSONObject: labels, options: .prettyPrinted)) else { return "[]" }
|
||||
return String(data: JSON, encoding: .utf8) ?? "[]"
|
||||
}
|
||||
|
||||
static func lookup(byID itemID: String, inContext context: NSManagedObjectContext) -> LinkedItem? {
|
||||
let fetchRequest: NSFetchRequest<Models.LinkedItem> = LinkedItem.fetchRequest()
|
||||
fetchRequest.predicate = NSPredicate(
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -34,6 +34,7 @@ const App = () => {
|
|||
>
|
||||
<ArticleContainer
|
||||
article={window.omnivoreArticle}
|
||||
labels={window.omnivoreArticle.labels}
|
||||
scrollElementRef={React.createRef()}
|
||||
isAppleAppEmbed={true}
|
||||
highlightBarDisabled={true}
|
||||
|
|
|
|||
Loading…
Reference in a new issue