set defaults values for serverSyncSTatus and isDeleted values

This commit is contained in:
Satindar Dhillon
2023-01-16 08:27:55 -08:00
parent d7c76bf9c5
commit 3f14cb08ae
4 changed files with 9 additions and 12 deletions

View File

@ -148,9 +148,7 @@ suspend fun Networker.createHighlight(input: CreateHighlightInput): Highlight? {
annotation = createdHighlight.highlightFields.annotation,
createdAt = null, // TODO: update gql query to get this
updatedAt = null, // TODO: fix updatedAtString?.let { LocalDate.parse(it) },
createdByMe = createdHighlight.highlightFields.createdByMe,
markedForDeletion = false,
serverSyncStatus = 0
createdByMe = createdHighlight.highlightFields.createdByMe
)
} else {
return null

View File

@ -51,9 +51,7 @@ suspend fun Networker.savedItem(slug: String): SavedItemQueryResponse {
annotation = it.highlightFields.annotation,
createdAt = null, // TODO: update gql query to get this
updatedAt = null, //updatedAtString?.let { str -> LocalDate.parse(str) }, TODO: fix date parsing
createdByMe = it.highlightFields.createdByMe,
markedForDeletion = false,
serverSyncStatus = 0
createdByMe = it.highlightFields.createdByMe
)
}

View File

@ -1,6 +1,7 @@
package app.omnivore.omnivore.persistence.entities
import androidx.room.*
import app.omnivore.omnivore.models.ServerSyncStatus
import java.time.LocalDate
import java.util.Date
@ -10,11 +11,11 @@ data class Highlight(
val annotation: String?,
val createdAt: String?,
val createdByMe: Boolean,
val markedForDeletion: Boolean, // default false
val markedForDeletion: Boolean = false,
val patch: String,
val prefix: String?,
val quote: String,
val serverSyncStatus: Int, // default 0
val serverSyncStatus: Int = ServerSyncStatus.IS_SYNCED.rawValue,
val shortId: String,
val suffix: String?,
val updatedAt: String?

View File

@ -84,10 +84,10 @@ class LibraryViewModel @Inject constructor(
dataService.syncOfflineItemsWithServerIfNeeded()
val result = dataService.sync(since = since, cursor = cursor)
// TODO: Defer this until later?
for (slug in result.savedItemSlugs) {
dataService.syncSavedItemContent(slug)
}
// TODO: Defer this until later? /fix - this results in a 429 server error
// for (slug in result.savedItemSlugs) {
// dataService.syncSavedItemContent(slug)
// }
val totalCount = count + result.count