mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-26 23:18:17 +03:00
Don't attempt to check chapter download status for local chapters
Fixes #8541
This commit is contained in:
parent
2c850d0e33
commit
8c1171a722
1 changed files with 13 additions and 2 deletions
|
@ -46,6 +46,7 @@ import eu.kanade.tachiyomi.data.track.TrackService
|
||||||
import eu.kanade.tachiyomi.network.HttpException
|
import eu.kanade.tachiyomi.network.HttpException
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
|
import eu.kanade.tachiyomi.source.isLocal
|
||||||
import eu.kanade.tachiyomi.ui.manga.track.TrackItem
|
import eu.kanade.tachiyomi.ui.manga.track.TrackItem
|
||||||
import eu.kanade.tachiyomi.util.chapter.getChapterSort
|
import eu.kanade.tachiyomi.util.chapter.getChapterSort
|
||||||
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
||||||
|
@ -496,14 +497,24 @@ class MangaInfoScreenModel(
|
||||||
dateRelativeTime: Int,
|
dateRelativeTime: Int,
|
||||||
dateFormat: DateFormat,
|
dateFormat: DateFormat,
|
||||||
): List<ChapterItem> {
|
): List<ChapterItem> {
|
||||||
|
val isLocal = manga.isLocal()
|
||||||
return map { chapter ->
|
return map { chapter ->
|
||||||
val activeDownload = downloadManager.queue.find { chapter.id == it.chapter.id }
|
val activeDownload = if (isLocal) {
|
||||||
val downloaded = downloadManager.isChapterDownloaded(chapter.name, chapter.scanlator, manga.title, manga.source)
|
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 {
|
val downloadState = when {
|
||||||
activeDownload != null -> activeDownload.status
|
activeDownload != null -> activeDownload.status
|
||||||
downloaded -> Download.State.DOWNLOADED
|
downloaded -> Download.State.DOWNLOADED
|
||||||
else -> Download.State.NOT_DOWNLOADED
|
else -> Download.State.NOT_DOWNLOADED
|
||||||
}
|
}
|
||||||
|
|
||||||
ChapterItem(
|
ChapterItem(
|
||||||
chapter = chapter,
|
chapter = chapter,
|
||||||
downloadState = downloadState,
|
downloadState = downloadState,
|
||||||
|
|
Loading…
Reference in a new issue