mirror of
https://github.com/mihonapp/mihon.git
synced 2025-07-07 16:34:31 +02:00
If the browse manga is initialized update everything otherwise only update the title and thumbnail
This commit is contained in:
@ -17,10 +17,18 @@ class NetworkToLocalManga(
|
||||
}
|
||||
!localManga.favorite -> {
|
||||
// if the manga isn't a favorite, update new info from source to db
|
||||
val mangaUpdate = manga.toMangaUpdate().copy(
|
||||
val newThumbnail = manga.thumbnailUrl?.takeUnless { it.isBlank() }
|
||||
val mangaUpdate = if (manga.initialized) {
|
||||
manga.toMangaUpdate().copy(
|
||||
id = localManga.id,
|
||||
thumbnailUrl = manga.thumbnailUrl?.takeUnless { it.isBlank() },
|
||||
thumbnailUrl = newThumbnail,
|
||||
)
|
||||
} else {
|
||||
localManga.toMangaUpdate().copy(
|
||||
title = manga.title,
|
||||
thumbnailUrl = newThumbnail,
|
||||
)
|
||||
}
|
||||
mangaRepository.update(mangaUpdate)
|
||||
manga.copy(id = localManga.id)
|
||||
}
|
||||
|
Reference in New Issue
Block a user