fix(merged-reader): Fix chapter list's download badge in Reader (#1117)

* Fix chapter list's download badge in Reader

* improve
This commit is contained in:
Cuong-Tran 2025-08-29 18:11:38 +07:00 committed by GitHub
parent d385dfe808
commit 46f0e26dd3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -428,12 +428,19 @@ class ReaderViewModel @JvmOverloads constructor(
// SY -->
fun getChapters(): List<ReaderChapterItem> {
// KMK -->
val manga = manga ?: return emptyList()
val mangaList = state.value.mergedManga?.takeIf { it.isNotEmpty() } ?: mapOf(manga.id to manga)
// KMK <--
val currentChapter = getCurrentChapter()
return chapterList.map {
ReaderChapterItem(
chapter = it.chapter.toDomainChapter()!!,
manga = manga!!,
// KMK -->
manga = mangaList[it.chapter.manga_id] ?: manga,
// KMK <--
isCurrent = it.chapter.id == currentChapter?.chapter?.id,
dateFormat = UiPreferences.dateFormat(uiPreferences.dateFormat().get()),
)