mirror of
https://github.com/mihonapp/mihon.git
synced 2025-02-06 15:25:00 +01:00
inline manga update
This commit is contained in:
parent
fd742d51e3
commit
b8997ecbc8
@ -17,7 +17,13 @@ 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
|
||||||
manga.updateManga(localManga.id)
|
mangaRepository.update(
|
||||||
|
manga.toMangaUpdate()
|
||||||
|
.copy(
|
||||||
|
id = localManga.id,
|
||||||
|
thumbnailUrl = manga.thumbnailUrl?.takeIf { it.isNotBlank() },
|
||||||
|
),
|
||||||
|
)
|
||||||
manga.copy(id = localManga.id)
|
manga.copy(id = localManga.id)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
@ -33,14 +39,4 @@ class NetworkToLocalManga(
|
|||||||
private suspend fun insertManga(manga: Manga): Long? {
|
private suspend fun insertManga(manga: Manga): Long? {
|
||||||
return mangaRepository.insert(manga)
|
return mangaRepository.insert(manga)
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun Manga.updateManga(id: Long) {
|
|
||||||
mangaRepository.update(
|
|
||||||
toMangaUpdate()
|
|
||||||
.copy(
|
|
||||||
id = id,
|
|
||||||
thumbnailUrl = thumbnailUrl?.takeIf { it.isNotBlank() },
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user