diff --git a/src/all/mangadex/build.gradle b/src/all/mangadex/build.gradle index 0398f9b06..7adc3914e 100644 --- a/src/all/mangadex/build.gradle +++ b/src/all/mangadex/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'MangaDex' pkgNameSuffix = 'all.mangadex' extClass = '.MangaDexFactory' - extVersionCode = 162 + extVersionCode = 163 isNsfw = true } diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt index 7e8bcd2f2..bfb91b06d 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/MangaDexHelper.kt @@ -86,27 +86,26 @@ class MangaDexHelper(private val lang: String) { } /** - * Maps dex status to tachi status + * Maps dex status to Tachi status. + * Adapted from the MangaDex handler from TachiyomiSY. */ fun getPublicationStatus(attr: MangaAttributesDto, chapters: List): Int { - return when (attr.status) { - null -> SManga.UNKNOWN + val tempStatus = when (attr.status) { "ongoing" -> SManga.ONGOING - "completed", "cancelled" -> doubleCheckChapters(attr, chapters) - "hiatus" -> SManga.ONGOING + "cancelled" -> SManga.CANCELLED + "completed" -> SManga.PUBLISHING_FINISHED + "hiatus" -> SManga.ON_HIATUS else -> SManga.UNKNOWN } - } - /** - * if the manga is 'completed' or 'cancelled' then it'll have a lastChapter in the manga obj. - * if the simple list of chapters contains that lastChapter, then we can consider it completed. - */ - private fun doubleCheckChapters(attr: MangaAttributesDto, chapters: List): Int { - return if (chapters.contains(attr.lastChapter)) + val publishedOrCancelled = tempStatus == SManga.PUBLISHING_FINISHED || + tempStatus == SManga.CANCELLED + + return if (chapters.contains(attr.lastChapter) && publishedOrCancelled) { SManga.COMPLETED - else - SManga.UNKNOWN + } else { + tempStatus + } } fun parseDate(dateAsString: String): Long =