[RU]Remanga hide Bookmarks from site (#10520)

This commit is contained in:
e-shl 2022-01-20 15:00:59 +05:00 committed by GitHub
parent 07247b4fd9
commit 161d7efaa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 4 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Remanga'
pkgNameSuffix = 'ru.remanga'
extClass = '.Remanga'
extVersionCode = 42
extVersionCode = 43
}
dependencies {

View File

@ -140,7 +140,11 @@ class Remanga : ConfigurableSource, HttpSource() {
return MangasPage(mangas, page.props.page < page.props.total_pages)
} else {
val page = json.decodeFromString<PageWrapperDto<LibraryDto>>(response.body!!.string())
val mangas = page.content.map {
var content = page.content
if (preferences.getBoolean(isLib_PREF, false)) {
content = content.filter { it.bookmark_type.isNullOrEmpty() }
}
val mangas = content.map {
it.toSManga()
}
return MangasPage(mangas, page.props.page < page.props.total_pages)
@ -628,7 +632,7 @@ class Remanga : ConfigurableSource, HttpSource() {
SearchFilter("юри", "41"),
SearchFilter("яой", "43")
)
private class MyList(favorites: Array<String>) : Filter.Select<String>("Мои списки (только)", favorites)
private class MyList(favorites: Array<String>) : Filter.Select<String>("Закладки (только)", favorites)
private data class MyListUnit(val name: String, val id: String)
private val MyStatus = getMyList().map {
it.name
@ -701,8 +705,20 @@ class Remanga : ConfigurableSource, HttpSource() {
preferences.edit().putBoolean(key, checkValue).commit()
}
}
val bookmarksHide = androidx.preference.CheckBoxPreference(screen.context).apply {
key = isLib_PREF
title = isLib_PREF_Title
summary = "Скрывает мангу находящуюся в закладках пользователя на сайте."
setDefaultValue(false)
setOnPreferenceChangeListener { _, newValue ->
val checkValue = newValue as Boolean
preferences.edit().putBoolean(key, checkValue).commit()
}
}
screen.addPreference(domainPref)
screen.addPreference(paidChapterShow)
screen.addPreference(bookmarksHide)
screen.addPreference(screen.editTextPreference(USERNAME_TITLE, USERNAME_DEFAULT, username))
screen.addPreference(screen.editTextPreference(PASSWORD_TITLE, PASSWORD_DEFAULT, password, true))
}
@ -731,5 +747,8 @@ class Remanga : ConfigurableSource, HttpSource() {
private const val PAID_PREF = "PaidChapter"
private const val PAID_PREF_Title = "Показывать платные главы"
private const val isLib_PREF = "LibBookmarks"
private const val isLib_PREF_Title = "Скрыть «Закладки»"
}
}

View File

@ -25,7 +25,8 @@ data class LibraryDto(
val en_name: String,
val rus_name: String,
val dir: String,
val img: ImgDto
val img: ImgDto,
val bookmark_type: String? = null
)
@Serializable
data class MyLibraryDto(