Manga set to download chapters now downloads new chapters from manga details refresh
This commit is contained in:
parent
da7adb8197
commit
931e37b903
1 changed files with 12 additions and 1 deletions
|
@ -411,7 +411,18 @@ class MangaDetailsPresenter(
|
||||||
}
|
}
|
||||||
val finChapters = chapters.await()
|
val finChapters = chapters.await()
|
||||||
if (finChapters.isNotEmpty()) {
|
if (finChapters.isNotEmpty()) {
|
||||||
syncChaptersWithSource(db, finChapters, manga, source)
|
val newChapters = syncChaptersWithSource(db, finChapters, manga, source)
|
||||||
|
if (newChapters.first.isNotEmpty()) {
|
||||||
|
val downloadNew = preferences.downloadNew().getOrDefault()
|
||||||
|
val categoriesToDownload =
|
||||||
|
preferences.downloadNewCategories().getOrDefault().map(String::toInt)
|
||||||
|
val shouldDownload =
|
||||||
|
(downloadNew && (categoriesToDownload.isEmpty() || getMangaCategoryIds().any { it in categoriesToDownload }))
|
||||||
|
if (shouldDownload) {
|
||||||
|
downloadChapters(newChapters.first.sortedBy { it.chapter_number }
|
||||||
|
.map { it.toModel() })
|
||||||
|
}
|
||||||
|
}
|
||||||
withContext(Dispatchers.IO) { updateChapters() }
|
withContext(Dispatchers.IO) { updateChapters() }
|
||||||
}
|
}
|
||||||
isLoading = false
|
isLoading = false
|
||||||
|
|
Reference in a new issue