mirror of
https://github.com/mihonapp/mihon.git
synced 2025-02-06 23:35:17 +01:00
If the browse manga is initialized update everything otherwise only update the title and thumbnail
This commit is contained in:
parent
cb5025dd18
commit
1c202920be
@ -17,10 +17,18 @@ class NetworkToLocalManga(
|
|||||||
}
|
}
|
||||||
!localManga.favorite -> {
|
!localManga.favorite -> {
|
||||||
// if the manga isn't a favorite, update new info from source to db
|
// 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,
|
id = localManga.id,
|
||||||
thumbnailUrl = manga.thumbnailUrl?.takeUnless { it.isBlank() },
|
thumbnailUrl = newThumbnail,
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
localManga.toMangaUpdate().copy(
|
||||||
|
title = manga.title,
|
||||||
|
thumbnailUrl = newThumbnail,
|
||||||
|
)
|
||||||
|
}
|
||||||
mangaRepository.update(mangaUpdate)
|
mangaRepository.update(mangaUpdate)
|
||||||
manga.copy(id = localManga.id)
|
manga.copy(id = localManga.id)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user