Cleanup usage of NetworkToLocalManga

This commit is contained in:
Cuong-Tran
2024-11-02 23:58:35 +07:00
parent addb4ae9ad
commit 80031faafe
6 changed files with 21 additions and 9 deletions

View File

@@ -14,11 +14,6 @@ class NetworkToLocalManga(
val id = insertManga(manga)
manga.copy(id = id!!)
}
!localManga.favorite -> {
// if the manga isn't a favorite, set its display title from source
// if it later becomes a favorite, updated title will go to db
localManga.copy(title = manga.title)
}
else -> {
localManga
}

View File

@@ -72,6 +72,15 @@ data class Manga(
return chapterFlags and CHAPTER_SORT_DIR_MASK == CHAPTER_SORT_DESC
}
fun shouldUseNetworkMangaInfo(networkManga: Manga): Manga =
if (!favorite) {
// if the manga isn't a favorite, set its display title from source
// if it later becomes a favorite, updated title will go to db
copy(title = networkManga.title)
} else {
this
}
companion object {
// Generic filter that does not filter anything
const val SHOW_ALL = 0x00000000L