mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 07:15:08 +01:00
fix new chapter auto downloading when disabled (#414)
* fix downloading new chapter when disabled * fix method name
This commit is contained in:
parent
5ed8805de9
commit
c2e2076b0a
@ -67,7 +67,7 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion < 54)
|
if (oldVersion < 54)
|
||||||
DownloadProvider(context).renameChaapters()
|
DownloadProvider(context).renameChapters()
|
||||||
if (oldVersion < 62) {
|
if (oldVersion < 62) {
|
||||||
LibraryPresenter.updateDB()
|
LibraryPresenter.updateDB()
|
||||||
// Restore jobs after migrating from Evernote's job scheduler to WorkManager.
|
// Restore jobs after migrating from Evernote's job scheduler to WorkManager.
|
||||||
|
@ -109,7 +109,7 @@ class DownloadProvider(private val context: Context) {
|
|||||||
* @param manga the manga of the chapter.
|
* @param manga the manga of the chapter.
|
||||||
* @param source the source of the chapter.
|
* @param source the source of the chapter.
|
||||||
*/
|
*/
|
||||||
fun renameChaapters() {
|
fun renameChapters() {
|
||||||
val db by injectLazy<DatabaseHelper>()
|
val db by injectLazy<DatabaseHelper>()
|
||||||
val sourceManager by injectLazy<SourceManager>()
|
val sourceManager by injectLazy<SourceManager>()
|
||||||
val mangas = db.getLibraryMangas().executeAsBlocking()
|
val mangas = db.getLibraryMangas().executeAsBlocking()
|
||||||
|
@ -410,15 +410,15 @@ class MangaDetailsPresenter(
|
|||||||
val newChapters = syncChaptersWithSource(db, finChapters, manga, source)
|
val newChapters = syncChaptersWithSource(db, finChapters, manga, source)
|
||||||
if (newChapters.first.isNotEmpty()) {
|
if (newChapters.first.isNotEmpty()) {
|
||||||
val downloadNew = preferences.downloadNew().getOrDefault()
|
val downloadNew = preferences.downloadNew().getOrDefault()
|
||||||
val categoriesToDownload =
|
if (downloadNew && !controller.fromCatalogue && mangaWasInitalized) {
|
||||||
preferences.downloadNewCategories().getOrDefault().map(String::toInt)
|
val categoriesToDownload = preferences.downloadNewCategories().getOrDefault().map(String::toInt)
|
||||||
val shouldDownload = !controller.fromCatalogue && mangaWasInitalized
|
val shouldDownload = categoriesToDownload.isEmpty() || getMangaCategoryIds().any { it in categoriesToDownload }
|
||||||
(downloadNew && (categoriesToDownload.isEmpty() || getMangaCategoryIds().any { it in categoriesToDownload }))
|
|
||||||
if (shouldDownload) {
|
if (shouldDownload) {
|
||||||
downloadChapters(newChapters.first.sortedBy { it.chapter_number }
|
downloadChapters(newChapters.first.sortedBy { it.chapter_number }
|
||||||
.map { it.toModel() })
|
.map { it.toModel() })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (newChapters.second.isNotEmpty()) {
|
if (newChapters.second.isNotEmpty()) {
|
||||||
val removedChaptersId = newChapters.second.map { it.id }
|
val removedChaptersId = newChapters.second.map { it.id }
|
||||||
val removedChapters = this@MangaDetailsPresenter.chapters.filter {
|
val removedChapters = this@MangaDetailsPresenter.chapters.filter {
|
||||||
|
Loading…
Reference in New Issue
Block a user