From d9f31622f2b4fdd32ffbdd5769da982188853237 Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 18 Apr 2018 08:23:54 -0400 Subject: [PATCH] mangadex: remove search by letter since it was removed from mangadex (#304) --- src/all/mangadex/build.gradle | 4 +-- .../extension/all/mangadex/Mangadex.kt | 35 +++++++------------ 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/src/all/mangadex/build.gradle b/src/all/mangadex/build.gradle index 4b45195dd..7a8b83f5d 100644 --- a/src/all/mangadex/build.gradle +++ b/src/all/mangadex/build.gradle @@ -5,8 +5,8 @@ ext { appName = 'Tachiyomi: MangaDex' pkgNameSuffix = "all.mangadex" extClass = '.MangadexFactory' - extVersionCode = 19 - extVersionSuffix = 19 + extVersionCode = 20 + extVersionSuffix = 20 libVersion = '1.2' } diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt index be019a788..94c233fd0 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt @@ -130,27 +130,19 @@ open class Mangadex(override val lang: String, private val internalLang: String, } } } - //do browse by letter if set - val byLetter = filters.find { it is ByLetter } - - if (byLetter != null && (byLetter as ByLetter).state.first().state != 0) { - val s = byLetter.state.first().values[byLetter.state.first().state] - val pageStr = if (page != 1) (((page - 1) * 100)).toString() else "0" - val url = HttpUrl.parse("$baseUrl/titles/")!!.newBuilder().addPathSegment(s).addPathSegment(pageStr) - return GET(url.toString(), headers) - - } else { - //do traditional search - val url = HttpUrl.parse("$baseUrl/?page=search")!!.newBuilder().addQueryParameter("p", page.toString()).addQueryParameter("title", query) - filters.forEach { filter -> - when (filter) { - is TextField -> url.addQueryParameter(filter.key, filter.state) - } + //do traditional search + val url = HttpUrl.parse("$baseUrl/?page=search")!!.newBuilder().addQueryParameter("p", page.toString()).addQueryParameter("title", query) + filters.forEach { filter -> + when (filter) { + is TextField -> url.addQueryParameter(filter.key, filter.state) } - if (genres.isNotEmpty()) url.addQueryParameter("genres", genres.joinToString(",")) - - return GET(url.toString(), headers) } + if (genres.isNotEmpty()) { + url.addQueryParameter("genres", genres.joinToString(",")) + } + + return GET(url.toString(), headers) + } override fun searchMangaSelector() = "div.col-sm-6" @@ -321,15 +313,12 @@ open class Mangadex(override val lang: String, private val internalLang: String, private class Genre(val id: String, name: String) : Filter.CheckBox(name) private class GenreList(genres: List) : Filter.Group("Genres", genres) private class R18 : Filter.Select("R18+", arrayOf("Show all", "Show only", "Show none")) - private class ByLetter(letters: List) : Filter.Group("Browse by Letter only", letters) - private class Letters : Filter.Select("Letter", arrayOf("", "~", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")) override fun getFilterList() = FilterList( TextField("Author", "author"), TextField("Artist", "artist"), R18(), - GenreList(getGenreList()), - ByLetter(listOf(Letters())) + GenreList(getGenreList()) )