Clean up manga restoring logic

Some behavior changes:
- It prioritizes new entries, then anything more recently updated
- It copies the more recently updated entry's metadata (description, thumbnail, etc.)
This commit is contained in:
arkon
2023-12-14 23:26:02 -05:00
parent d20a8fcf13
commit 58daedc89e
6 changed files with 150 additions and 203 deletions

View File

@@ -1,18 +0,0 @@
package eu.kanade.tachiyomi.source.model
import tachiyomi.data.Mangas
import tachiyomi.domain.manga.model.Manga
fun Manga.copyFrom(other: Mangas): Manga {
var manga = this
other.author?.let { manga = manga.copy(author = it) }
other.artist?.let { manga = manga.copy(artist = it) }
other.description?.let { manga = manga.copy(description = it) }
other.genre?.let { manga = manga.copy(genre = it) }
other.thumbnail_url?.let { manga = manga.copy(thumbnailUrl = it) }
manga = manga.copy(status = other.status)
if (!initialized) {
manga = manga.copy(initialized = other.initialized)
}
return manga
}