Set type on highlight objects so they are properly loaded
This commit is contained in:
@ -45,6 +45,7 @@ fragment ArticleFields on Article {
|
||||
|
||||
fragment HighlightFields on Highlight {
|
||||
id
|
||||
type
|
||||
shortId
|
||||
quote
|
||||
prefix
|
||||
|
||||
@ -13,6 +13,7 @@ suspend fun DataService.createWebHighlight(jsonString: String) {
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
val highlight = Highlight(
|
||||
type = "HIGHLIGHT",
|
||||
highlightId = createHighlightInput.id,
|
||||
shortId = createHighlightInput.shortId,
|
||||
quote = createHighlightInput.quote.getOrNull(),
|
||||
|
||||
@ -113,6 +113,7 @@ suspend fun DataService.sync(since: String, cursor: String?, limit: Int = 20): S
|
||||
it.highlights ?: listOf()
|
||||
}.map {
|
||||
Highlight(
|
||||
type = it.highlightFields.type.toString(),
|
||||
highlightId = it.highlightFields.id,
|
||||
annotation = it.highlightFields.annotation,
|
||||
createdByMe = it.highlightFields.createdByMe,
|
||||
|
||||
@ -139,6 +139,7 @@ suspend fun Networker.createHighlight(input: CreateHighlightInput): Highlight? {
|
||||
// val updatedAtString = createdHighlight.highlightFields.updatedAt as? String
|
||||
|
||||
return Highlight(
|
||||
type = createdHighlight.highlightFields.type.toString(),
|
||||
highlightId = createdHighlight.highlightFields.id,
|
||||
shortId = createdHighlight.highlightFields.shortId,
|
||||
quote = createdHighlight.highlightFields.quote,
|
||||
|
||||
@ -44,6 +44,7 @@ suspend fun Networker.savedItem(slug: String): SavedItemQueryResponse {
|
||||
|
||||
Highlight(
|
||||
highlightId = it.highlightFields.id,
|
||||
type = it.highlightFields.type.toString(),
|
||||
shortId = it.highlightFields.shortId,
|
||||
quote = it.highlightFields.quote,
|
||||
prefix = it.highlightFields.prefix,
|
||||
|
||||
@ -71,6 +71,7 @@ suspend fun Networker.search(
|
||||
highlights = (it.node.highlights ?: listOf()).map { highlight ->
|
||||
Highlight(
|
||||
highlightId = highlight.highlightFields.id,
|
||||
type = highlight.highlightFields.type.toString(),
|
||||
annotation = highlight.highlightFields.annotation,
|
||||
createdByMe = highlight.highlightFields.createdByMe,
|
||||
patch = highlight.highlightFields.patch,
|
||||
|
||||
@ -13,7 +13,7 @@ import app.omnivore.omnivore.persistence.entities.*
|
||||
SavedItemAndSavedItemLabelCrossRef::class,
|
||||
SavedItemAndHighlightCrossRef::class
|
||||
],
|
||||
version = 5
|
||||
version = 6
|
||||
)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
abstract fun viewerDao(): ViewerDao
|
||||
|
||||
@ -7,6 +7,7 @@ import app.omnivore.omnivore.models.ServerSyncStatus
|
||||
@Entity
|
||||
data class Highlight(
|
||||
@PrimaryKey val highlightId: String,
|
||||
val type: String,
|
||||
var annotation: String?,
|
||||
val createdAt: String?,
|
||||
val createdByMe: Boolean,
|
||||
|
||||
Reference in New Issue
Block a user