Ensure memo is correctly passed around when transforming classes
This commit is contained in:
@@ -13,6 +13,7 @@ fun Chapter.toSChapter(): SChapter {
|
||||
it.date_upload = dateUpload
|
||||
it.chapter_number = chapterNumber.toFloat()
|
||||
it.scanlator = scanlator
|
||||
it.memo = memo
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +24,7 @@ fun Chapter.copyFromSChapter(sChapter: SChapter): Chapter {
|
||||
dateUpload = sChapter.date_upload,
|
||||
chapterNumber = sChapter.chapter_number.toDouble(),
|
||||
scanlator = sChapter.scanlator?.ifBlank { null }?.trim(),
|
||||
memo = sChapter.memo,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -39,4 +41,5 @@ fun Chapter.toDbChapter(): DbChapter = ChapterImpl().also {
|
||||
it.date_upload = dateUpload
|
||||
it.chapter_number = chapterNumber.toFloat()
|
||||
it.source_order = sourceOrder.toInt()
|
||||
it.memo = memo
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ fun Manga.toSManga(): SManga = SManga.create().also {
|
||||
it.status = status.toInt()
|
||||
it.thumbnail_url = thumbnailUrl
|
||||
it.initialized = initialized
|
||||
it.memo = memo
|
||||
}
|
||||
|
||||
fun Manga.copyFrom(other: SManga): Manga {
|
||||
@@ -66,6 +67,7 @@ fun Manga.copyFrom(other: SManga): Manga {
|
||||
status = other.status.toLong(),
|
||||
updateStrategy = other.update_strategy,
|
||||
initialized = other.initialized && initialized,
|
||||
memo = other.memo,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package eu.kanade.tachiyomi.data.database.models
|
||||
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import mihon.core.common.extensions.EMPTY
|
||||
|
||||
class ChapterImpl : Chapter {
|
||||
|
||||
@@ -34,7 +35,7 @@ class ChapterImpl : Chapter {
|
||||
|
||||
override var version: Long = 0
|
||||
|
||||
override var memo: JsonObject = JsonObject(emptyMap())
|
||||
override var memo: JsonObject = JsonObject.EMPTY
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
||||
@@ -15,6 +15,7 @@ fun SManga.toDomainManga(sourceId: Long): Manga {
|
||||
thumbnailUrl = thumbnail_url,
|
||||
updateStrategy = update_strategy,
|
||||
initialized = initialized,
|
||||
memo = memo,
|
||||
source = sourceId,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ class ShouldUpdateDbChapter {
|
||||
dbChapter.name != sourceChapter.name ||
|
||||
dbChapter.dateUpload != sourceChapter.dateUpload ||
|
||||
dbChapter.chapterNumber != sourceChapter.chapterNumber ||
|
||||
dbChapter.sourceOrder != sourceChapter.sourceOrder
|
||||
dbChapter.sourceOrder != sourceChapter.sourceOrder ||
|
||||
dbChapter.memo != sourceChapter.memo
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ interface SChapter : Serializable {
|
||||
date_upload = other.date_upload
|
||||
chapter_number = other.chapter_number
|
||||
scanlator = other.scanlator
|
||||
memo = other.memo
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package eu.kanade.tachiyomi.source.model
|
||||
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import mihon.core.common.extensions.EMPTY
|
||||
|
||||
class SChapterImpl : SChapter {
|
||||
|
||||
@@ -16,5 +17,5 @@ class SChapterImpl : SChapter {
|
||||
|
||||
override var date_upload: Long = 0
|
||||
|
||||
override var memo: JsonObject = JsonObject(emptyMap())
|
||||
override var memo: JsonObject = JsonObject.EMPTY
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ interface SManga : Serializable {
|
||||
it.thumbnail_url = thumbnail_url
|
||||
it.update_strategy = update_strategy
|
||||
it.initialized = initialized
|
||||
it.memo = memo
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package eu.kanade.tachiyomi.source.model
|
||||
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import mihon.core.common.extensions.EMPTY
|
||||
|
||||
class SMangaImpl : SManga {
|
||||
|
||||
@@ -26,5 +27,5 @@ class SMangaImpl : SManga {
|
||||
|
||||
override var initialized: Boolean = false
|
||||
|
||||
override var memo: JsonObject = JsonObject(emptyMap())
|
||||
override var memo: JsonObject = JsonObject.EMPTY
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user