Merge pull request #2114 from omnivore-app/fix/android-highlight-loading

Set type on highlight objects so they are properly loaded
This commit is contained in:
Jackson Harper 2023-04-25 16:34:25 +08:00 committed by GitHub
commit 29da91e760
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 15 additions and 6 deletions

View file

@ -17,8 +17,8 @@ android {
applicationId "app.omnivore.omnivore"
minSdk 26
targetSdk 33
versionCode 44
versionName "0.0.44"
versionCode 46
versionName "0.0.46"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {

File diff suppressed because one or more lines are too long

View file

@ -45,6 +45,7 @@ fragment ArticleFields on Article {
fragment HighlightFields on Highlight {
id
type
shortId
quote
prefix

View file

@ -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(),

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,11 +2,14 @@ package app.omnivore.omnivore.persistence.entities
import androidx.room.*
import app.omnivore.omnivore.models.ServerSyncStatus
import com.google.gson.annotations.SerializedName
@Entity
data class Highlight(
@SerializedName("id")
@PrimaryKey val highlightId: String,
val type: String,
var annotation: String?,
val createdAt: String?,
val createdByMe: Boolean,

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "webpack --mode production",
"build-and-update": "yarn build && cp build/bundle.js ../../apple/OmnivoreKit/Sources/Views/Resources/bundle.js"
"build-and-update": "yarn build && cp build/bundle.js ../../apple/OmnivoreKit/Sources/Views/Resources/bundle.js && cp build/bundle.js ../../android/Omnivore/app/src/main/assets/bundle.js"
},
"dependencies": {
"@omnivore/web": "1.0.0"