mirror of
https://github.com/mihonapp/mihon.git
synced 2025-01-29 19:34:56 +01:00
inline manga update
This commit is contained in:
parent
fd742d51e3
commit
b8997ecbc8
@ -17,7 +17,13 @@ class NetworkToLocalManga(
|
||||
}
|
||||
!localManga.favorite -> {
|
||||
// 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)
|
||||
}
|
||||
else -> {
|
||||
@ -33,14 +39,4 @@ class NetworkToLocalManga(
|
||||
private suspend fun insertManga(manga: Manga): Long? {
|
||||
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