mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-10 11:08:56 +01:00
Change return value of SyncChaptersWithSource.await() (#7715)
* Change return value of `SyncChaptersWithSource.await()` `updatedToAdd.subtract(reAdded).toList()` never worked as at this point `updatedToAdd` contained ids from db where `reAdded` had default one. Was the same case before the rewrite. Removed `toDelete` from return value as it was not being used anywhere * Add doc string * Use HashSet Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>
This commit is contained in:
@@ -350,7 +350,7 @@ class LibraryUpdateService(
|
||||
else -> {
|
||||
// Convert to the manga that contains new chapters
|
||||
mangaWithNotif.toDomainManga()?.let { domainManga ->
|
||||
val (newChapters, _) = updateManga(domainManga)
|
||||
val newChapters = updateManga(domainManga)
|
||||
val newDbChapters = newChapters.map { it.toDbChapter() }
|
||||
|
||||
if (newChapters.isNotEmpty()) {
|
||||
@@ -428,7 +428,7 @@ class LibraryUpdateService(
|
||||
* @param manga the manga to update.
|
||||
* @return a pair of the inserted and removed chapters.
|
||||
*/
|
||||
private suspend fun updateManga(manga: DomainManga): Pair<List<DomainChapter>, List<DomainChapter>> {
|
||||
private suspend fun updateManga(manga: DomainManga): List<DomainChapter> {
|
||||
val source = sourceManager.getOrStub(manga.source)
|
||||
|
||||
val mangaInfo: MangaInfo = manga.toMangaInfo()
|
||||
@@ -444,7 +444,7 @@ class LibraryUpdateService(
|
||||
|
||||
// Get manga from database to account for if it was removed during the update
|
||||
val dbManga = getManga.await(manga.id)
|
||||
?: return Pair(emptyList(), emptyList())
|
||||
?: return emptyList()
|
||||
|
||||
// [dbmanga] was used so that manga data doesn't get overwritten
|
||||
// in case manga gets new chapter
|
||||
|
||||
Reference in New Issue
Block a user