MangAdventure: fix sort filter & description (#10074)

This commit is contained in:
ObserverOfTime 2021-12-12 20:13:31 +02:00 committed by GitHub
parent 96d01c1285
commit 2cf0e7779f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

@ -172,9 +172,13 @@ abstract class MangAdventure(
url = series.url
title = series.title
thumbnail_url = series.cover
description = series.description?.plus(
series.aliases?.joinToString("\n", "\n\nAlternative titles:\n")
)
description = buildString {
series.description?.let(::append)
series.aliases.let {
if (!it.isNullOrEmpty())
it.joinTo(this, "\n", "\n\nAlternative titles:\n")
}
}
author = series.authors?.joinToString()
artist = series.artists?.joinToString()
genre = series.categories?.joinToString()

View File

@ -29,18 +29,18 @@ internal class Artist : Filter.Text("Artist"), UriFilter {
*/
internal class SortOrder(
private val labels: Array<String>
) : Filter.Sort("Sort", values, null), UriFilter {
) : Filter.Sort("Sort", labels, null), UriFilter {
override val param = "sort"
override fun toString() = when (state?.ascending) {
null -> ""
true -> labels[state!!.index]
false -> "-" + labels[state!!.index]
true -> sorts[state!!.index]
false -> "-" + sorts[state!!.index]
}
companion object {
/** The available sort order values. */
private val values = arrayOf(
private val sorts = arrayOf(
"title", "views", "latest_upload", "chapter_count"
)
}

View File

@ -9,7 +9,7 @@ class MangAdventureGenerator : ThemeSourceGenerator {
override val themeClass = "MangAdventure"
override val baseVersionCode = 7
override val baseVersionCode = 8
override val sources = listOf(
SingleLang("Arc-Relight", "https://arc-relight.com", "en", className = "ArcRelight"),