fix(all/yomiroll): Make pref subtitle show up first in case app can't determine locale (#2850)

This commit is contained in:
Samfun75 2024-01-31 17:26:05 +03:00 committed by GitHub
parent d058cd77f8
commit 8ffc21113b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 8 deletions

View File

@ -1,7 +1,7 @@
ext {
extName = 'Yomiroll'
extClass = '.Yomiroll'
extVersionCode = 29
extVersionCode = 30
}
apply from: "$rootDir/common.gradle"

View File

@ -188,7 +188,8 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
return info.data.first().toSAnimeOrNull(anime) ?: anime
}
override fun animeDetailsParse(response: Response): SAnime = throw UnsupportedOperationException()
override fun animeDetailsParse(response: Response): SAnime =
throw UnsupportedOperationException()
// ============================== Episodes ==============================
@ -287,10 +288,8 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
val sub = json.decodeFromString<Subtitle>(value.jsonObject.toString())
Track(sub.url, sub.locale.getLocale())
}?.sortedWith(
compareBy(
{ it.lang },
{ it.lang.contains(subLocale) },
),
compareByDescending<Track> { it.lang.contains(subLocale) }
.thenBy { it.lang },
)
}.getOrNull() ?: emptyList()
@ -355,7 +354,6 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
Pair("en-IN", "English (India)"),
Pair("es-419", "Spanish (América Latina)"),
Pair("es-ES", "Spanish (España)"),
Pair("es-LA", "Spanish (América Latina)"),
Pair("fr-FR", "French"),
Pair("ja-JP", "Japanese"),
Pair("hi-IN", "Hindi"),
@ -415,7 +413,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
}
} ?: SAnime.UNKNOWN
author = content_provider
description = anime?.description ?: StringBuilder().apply {
description = StringBuilder().apply {
appendLine(this@toSAnime.description)
appendLine()