refactor: lazily query saved and read state in UI

Having this always be read from the UI avoids values going stale inside data models

Fixes #641
This commit is contained in:
Harsh Shandilya 2024-08-28 13:11:42 +05:30
parent 6f424ae2d5
commit 8651a4f66b
12 changed files with 56 additions and 100 deletions

View file

@ -27,8 +27,6 @@ data class UIPost(
@SerialName("submitter_user") val submitter: String,
val tags: List<String>,
val comments: List<Comment> = emptyList(),
val isSaved: Boolean = false,
val isRead: Boolean = false,
val userIsAuthor: Boolean = false,
) {
@KonvertFrom(
@ -37,7 +35,6 @@ data class UIPost(
[
Mapping(target = "submitter", expression = "it.submitterName"),
Mapping(target = "commentCount", expression = "it.commentCount ?: 0"),
Mapping(target = "isSaved", expression = "true"),
],
)
companion object