From 8c1171a72256f76972e787d53e182869df2a87d4 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 20 Nov 2022 15:28:51 -0500 Subject: [PATCH] Don't attempt to check chapter download status for local chapters Fixes #8541 --- .../kanade/tachiyomi/ui/manga/MangaScreenModel.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 4ffa23fb6b..759e153b2f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -46,6 +46,7 @@ import eu.kanade.tachiyomi.data.track.TrackService import eu.kanade.tachiyomi.network.HttpException import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager +import eu.kanade.tachiyomi.source.isLocal import eu.kanade.tachiyomi.ui.manga.track.TrackItem import eu.kanade.tachiyomi.util.chapter.getChapterSort import eu.kanade.tachiyomi.util.chapter.getNextUnread @@ -496,14 +497,24 @@ class MangaInfoScreenModel( dateRelativeTime: Int, dateFormat: DateFormat, ): List { + val isLocal = manga.isLocal() return map { chapter -> - val activeDownload = downloadManager.queue.find { chapter.id == it.chapter.id } - val downloaded = downloadManager.isChapterDownloaded(chapter.name, chapter.scanlator, manga.title, manga.source) + val activeDownload = if (isLocal) { + null + } else { + downloadManager.queue.find { chapter.id == it.chapter.id } + } + val downloaded = if (isLocal) { + true + } else { + downloadManager.isChapterDownloaded(chapter.name, chapter.scanlator, manga.title, manga.source) + } val downloadState = when { activeDownload != null -> activeDownload.status downloaded -> Download.State.DOWNLOADED else -> Download.State.NOT_DOWNLOADED } + ChapterItem( chapter = chapter, downloadState = downloadState,