Use ChapterInfo wherever possible
This commit is contained in:
@@ -3,7 +3,6 @@ package exh.md.utils
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.mdlist.MdList
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.all.MangaDex
|
||||
import exh.log.xLogD
|
||||
@@ -25,6 +24,7 @@ import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import org.jsoup.parser.Parser
|
||||
import tachiyomi.source.model.ChapterInfo
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
@@ -233,7 +233,7 @@ class MdUtil {
|
||||
return scanlators.sorted().joinToString(scanlatorSeparator)
|
||||
}
|
||||
|
||||
fun getMissingChapterCount(chapters: List<SChapter>, mangaStatus: Int): String? {
|
||||
fun getMissingChapterCount(chapters: List<ChapterInfo>, mangaStatus: Int): String? {
|
||||
if (mangaStatus == SManga.COMPLETED) return null
|
||||
|
||||
val remove0ChaptersFromCount = chapters.distinctBy {
|
||||
@@ -242,14 +242,14 @@ class MdUtil {
|
||||
} else {*/
|
||||
it.name
|
||||
/*}*/
|
||||
}.sortedByDescending { it.chapter_number }
|
||||
}.sortedByDescending { it.number }
|
||||
|
||||
remove0ChaptersFromCount.firstOrNull()?.let { chapter ->
|
||||
val chpNumber = chapter.chapter_number.floor()
|
||||
val chpNumber = chapter.number.floor()
|
||||
val allChapters = (1..chpNumber).toMutableSet()
|
||||
|
||||
remove0ChaptersFromCount.forEach {
|
||||
allChapters.remove(it.chapter_number.floor())
|
||||
allChapters.remove(it.number.floor())
|
||||
}
|
||||
|
||||
if (allChapters.isEmpty()) return null
|
||||
|
||||
Reference in New Issue
Block a user