[RU]Remanga AgeLimit warning & language option (#10861)
* [RU]Remanga AgeLimit authorization warning * [RU]Remanga option for changing cover language
This commit is contained in:
parent
06c12928cc
commit
c42cf60d41
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'Remanga'
|
extName = 'Remanga'
|
||||||
pkgNameSuffix = 'ru.remanga'
|
pkgNameSuffix = 'ru.remanga'
|
||||||
extClass = '.Remanga'
|
extClass = '.Remanga'
|
||||||
extVersionCode = 45
|
extVersionCode = 46
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -122,6 +122,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
val mangas = page.content.map {
|
val mangas = page.content.map {
|
||||||
it.title.toSManga()
|
it.title.toSManga()
|
||||||
}
|
}
|
||||||
|
|
||||||
return MangasPage(mangas, page.props.page < page.props.total_pages)
|
return MangasPage(mangas, page.props.page < page.props.total_pages)
|
||||||
} else {
|
} else {
|
||||||
val page = json.decodeFromString<PageWrapperDto<LibraryDto>>(response.body!!.string())
|
val page = json.decodeFromString<PageWrapperDto<LibraryDto>>(response.body!!.string())
|
||||||
|
@ -139,7 +140,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
private fun LibraryDto.toSManga(): SManga =
|
private fun LibraryDto.toSManga(): SManga =
|
||||||
SManga.create().apply {
|
SManga.create().apply {
|
||||||
// Do not change the title name to ensure work with a multilingual catalog!
|
// Do not change the title name to ensure work with a multilingual catalog!
|
||||||
title = en_name
|
title = if (isEng.equals("rus")) rus_name else en_name
|
||||||
url = "/api/titles/$dir/"
|
url = "/api/titles/$dir/"
|
||||||
thumbnail_url = if (img.high.isNotEmpty()) {
|
thumbnail_url = if (img.high.isNotEmpty()) {
|
||||||
baseUrl + img.high
|
baseUrl + img.high
|
||||||
|
@ -186,6 +187,9 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
is AgeList -> filter.state.forEach { age ->
|
is AgeList -> filter.state.forEach { age ->
|
||||||
if (age.state) {
|
if (age.state) {
|
||||||
|
if ((age.id == "2") and (USER_ID == "")) {
|
||||||
|
throw Exception("Для просмотра 18+ контента необходима авторизация через WebView")
|
||||||
|
}
|
||||||
url.addQueryParameter("age_limit", age.id)
|
url.addQueryParameter("age_limit", age.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +201,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
is MyList -> {
|
is MyList -> {
|
||||||
if (filter.state > 0) {
|
if (filter.state > 0) {
|
||||||
if (USER_ID == "") {
|
if (USER_ID == "") {
|
||||||
throw Exception("Пользователь не найден")
|
throw Exception("Пользователь не найден, необходима авторизация через WebView")
|
||||||
}
|
}
|
||||||
val TypeQ = getMyList()[filter.state].id
|
val TypeQ = getMyList()[filter.state].id
|
||||||
val UserProfileUrl = "$baseUrl/api/users/$USER_ID/bookmarks/?type=$TypeQ&page=$page".toHttpUrl().newBuilder()
|
val UserProfileUrl = "$baseUrl/api/users/$USER_ID/bookmarks/?type=$TypeQ&page=$page".toHttpUrl().newBuilder()
|
||||||
|
@ -252,14 +256,15 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
val o = this
|
val o = this
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
// Do not change the title name to ensure work with a multilingual catalog!
|
// Do not change the title name to ensure work with a multilingual catalog!
|
||||||
title = en_name
|
title = if (isEng.equals("rus")) rus_name else en_name
|
||||||
url = "/api/titles/$dir/"
|
url = "/api/titles/$dir/"
|
||||||
thumbnail_url = baseUrl + img.high
|
thumbnail_url = baseUrl + img.high
|
||||||
var altName = ""
|
var altName = ""
|
||||||
if (another_name.isNotEmpty()) {
|
if (another_name.isNotEmpty()) {
|
||||||
altName = "Альтернативные названия:\n" + another_name + "\n\n"
|
altName = "Альтернативные названия:\n" + another_name + "\n\n"
|
||||||
}
|
}
|
||||||
this.description = rus_name + "\n" + ratingStar + " " + ratingValue + " (голосов: " + count_rating + ")\n" + altName + Jsoup.parse(o.description).text()
|
val mediaNameLanguage = if (isEng.equals("rus")) en_name else rus_name
|
||||||
|
this.description = mediaNameLanguage + "\n" + ratingStar + " " + ratingValue + " (голосов: " + count_rating + ")\n" + altName + Jsoup.parse(o.description).text()
|
||||||
genre = parseType(type) + ", " + parseAge(age_limit) + ", " + (genres + categories).joinToString { it.name }
|
genre = parseType(type) + ", " + parseAge(age_limit) + ", " + (genres + categories).joinToString { it.name }
|
||||||
status = parseStatus(o.status.id)
|
status = parseStatus(o.status.id)
|
||||||
}
|
}
|
||||||
|
@ -279,7 +284,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.map { response ->
|
.map { response ->
|
||||||
(if (warnLogin) manga.apply { description = "Авторизуйтесь для просмотра списка глав" } else mangaDetailsParse(response))
|
(if (warnLogin) manga.apply { description = "Для просмотра 18+ контента необходима авторизация через WebView" } else mangaDetailsParse(response))
|
||||||
.apply {
|
.apply {
|
||||||
initialized = true
|
initialized = true
|
||||||
}
|
}
|
||||||
|
@ -642,7 +647,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
MyListUnit("Брошено ", "3"),
|
MyListUnit("Брошено ", "3"),
|
||||||
MyListUnit("Не интересно ", "5")
|
MyListUnit("Не интересно ", "5")
|
||||||
)
|
)
|
||||||
|
private var isEng: String? = preferences.getString(LANGUAGE_PREF, "eng")
|
||||||
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: androidx.preference.PreferenceScreen) {
|
||||||
val domainPref = ListPreference(screen.context).apply {
|
val domainPref = ListPreference(screen.context).apply {
|
||||||
key = DOMAIN_PREF
|
key = DOMAIN_PREF
|
||||||
|
@ -663,6 +668,20 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val titleLanguagePref = ListPreference(screen.context).apply {
|
||||||
|
key = LANGUAGE_PREF
|
||||||
|
title = LANGUAGE_PREF_Title
|
||||||
|
entries = arrayOf("Английский", "Русский")
|
||||||
|
entryValues = arrayOf("eng", "rus")
|
||||||
|
summary = "%s"
|
||||||
|
setDefaultValue("eng")
|
||||||
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
val titleLanguage = preferences.edit().putString(LANGUAGE_PREF, newValue as String).commit()
|
||||||
|
val warning = "Если язык обложки не изменился очистите базу данных в приложении (Настройки -> Дополнительно -> Очистить базу данных)"
|
||||||
|
Toast.makeText(screen.context, warning, Toast.LENGTH_LONG).show()
|
||||||
|
titleLanguage
|
||||||
|
}
|
||||||
|
}
|
||||||
val paidChapterShow = androidx.preference.CheckBoxPreference(screen.context).apply {
|
val paidChapterShow = androidx.preference.CheckBoxPreference(screen.context).apply {
|
||||||
key = PAID_PREF
|
key = PAID_PREF
|
||||||
title = PAID_PREF_Title
|
title = PAID_PREF_Title
|
||||||
|
@ -686,6 +705,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screen.addPreference(domainPref)
|
screen.addPreference(domainPref)
|
||||||
|
screen.addPreference(titleLanguagePref)
|
||||||
screen.addPreference(paidChapterShow)
|
screen.addPreference(paidChapterShow)
|
||||||
screen.addPreference(bookmarksHide)
|
screen.addPreference(bookmarksHide)
|
||||||
}
|
}
|
||||||
|
@ -702,6 +722,9 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
private const val DOMAIN_PREF = "REMangaDomain"
|
private const val DOMAIN_PREF = "REMangaDomain"
|
||||||
private const val DOMAIN_PREF_Title = "Выбор домена"
|
private const val DOMAIN_PREF_Title = "Выбор домена"
|
||||||
|
|
||||||
|
private const val LANGUAGE_PREF = "ReMangaTitleLanguage"
|
||||||
|
private const val LANGUAGE_PREF_Title = "Выбор языка на обложке"
|
||||||
|
|
||||||
private const val PAID_PREF = "PaidChapter"
|
private const val PAID_PREF = "PaidChapter"
|
||||||
private const val PAID_PREF_Title = "Показывать платные главы"
|
private const val PAID_PREF_Title = "Показывать платные главы"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue