Reduce some usages of toDbManga (#8116)

Co-Authored-By: stevenyomi <95685115+stevenyomi@users.noreply.github.com>

Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>
This commit is contained in:
AntsyLich
2022-10-01 21:01:25 +06:00
committed by GitHub
parent 98c459a6b6
commit b04d1e5f50
3 changed files with 30 additions and 13 deletions

View File

@@ -99,6 +99,28 @@ data class Manga(
it.initialized = initialized
}
fun copyFrom(other: SManga): Manga {
val author = other.author ?: author
val artist = other.artist ?: artist
val description = other.description ?: description
val genres = if (other.genre != null) {
other.getGenres()
} else {
genre
}
val thumbnailUrl = other.thumbnail_url ?: thumbnailUrl
return this.copy(
author = author,
artist = artist,
description = description,
genre = genres,
thumbnailUrl = thumbnailUrl,
status = other.status.toLong(),
updateStrategy = other.update_strategy,
initialized = other.initialized && initialized,
)
}
companion object {
// Generic filter that does not filter anything
const val SHOW_ALL = 0x00000000L