Fixed Mangadex sorting issues when filtering (#9020)
* fixed sorting issues Fixed "Sort by Most Follows" since it was no longer the default, and added relevance sorting to the list of possible sorts * Fixed Mangadex sorting when browsing * Changed default sort to Most Followed manga * Fixed it so that the "Number of follows" is the default sorting filter selected instead of "Manga created at" * When sorting by ascending for Number of follows, returns manga with the fewest follows instead of default search with no sort Co-authored-by: nayan <TheOneMaster@users.noreply.github.com>
This commit is contained in:
parent
efa546c94b
commit
fc204bd93a
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'MangaDex'
|
||||
pkgNameSuffix = 'all.mangadex'
|
||||
extClass = '.MangaDexFactory'
|
||||
extVersionCode = 131
|
||||
extVersionCode = 132
|
||||
containsNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -191,12 +191,13 @@ class MangaDexFilters {
|
|||
Filter.Select<String>("Excluded tags mode", arrayOf("And", "Or"), 1)
|
||||
|
||||
val sortableList = listOf(
|
||||
Pair("Number of follows", ""),
|
||||
Pair("Number of follows", "followedCount"),
|
||||
Pair("Manga created at", "createdAt"),
|
||||
Pair("Manga info updated at", "updatedAt"),
|
||||
Pair("Relevant manga", "relevance")
|
||||
)
|
||||
|
||||
class SortFilter(sortables: Array<String>) : Filter.Sort("Sort", sortables, Selection(1, false))
|
||||
class SortFilter(sortables: Array<String>) : Filter.Sort("Sort", sortables, Selection(0, false))
|
||||
|
||||
internal fun addFiltersToUrl(url: HttpUrl.Builder, filters: FilterList): String {
|
||||
url.apply {
|
||||
|
@ -256,14 +257,12 @@ class MangaDexFilters {
|
|||
}
|
||||
is SortFilter -> {
|
||||
if (filter.state != null) {
|
||||
if (filter.state!!.index != 0) {
|
||||
val query = sortableList[filter.state!!.index].second
|
||||
val value = when (filter.state!!.ascending) {
|
||||
true -> "asc"
|
||||
false -> "desc"
|
||||
}
|
||||
addQueryParameter("order[$query]", value)
|
||||
val query = sortableList[filter.state!!.index].second
|
||||
val value = when (filter.state!!.ascending) {
|
||||
true -> "asc"
|
||||
false -> "desc"
|
||||
}
|
||||
addQueryParameter("order[$query]", value)
|
||||
}
|
||||
}
|
||||
is TagList -> {
|
||||
|
|
Loading…
Reference in New Issue