Asura Scans: Remove obsolete permanent chapter url pref (#10964)

* Remove Permanent Chapter Url Pref from Asura Scans

* Bump Version
This commit is contained in:
FourTOne5 2022-02-28 18:22:50 +06:00 committed by GitHub
parent afc62b04a8
commit a83919a98a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 46 deletions

View File

@ -9,7 +9,6 @@ import eu.kanade.tachiyomi.multisrc.wpmangastream.WPMangaStream
import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.OkHttpClient
import rx.Observable
@ -73,28 +72,6 @@ open class AsuraScans(
return this
}
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
val sManga = manga.tempUrlToPermIfNeeded()
return super.fetchChapterList(sManga).map { sChapterList ->
sChapterList.map { it.tempUrlToPermIfNeeded(sManga) }
}
}
private fun SChapter.tempUrlToPermIfNeeded(manga: SManga): SChapter {
val turnTempUrlToPerm = preferences.getBoolean(getPermanentChapterUrlPreferenceKey(), true)
if (!turnTempUrlToPerm) return this
val sChapterNameFirstWord = this.name.split(" ")[0]
val sMangaTitleFirstWord = manga.title.split(" ")[0]
if (
!this.url.contains("/$sChapterNameFirstWord", ignoreCase = true) &&
!this.url.contains("/$sMangaTitleFirstWord", ignoreCase = true)
) {
this.url = this.url.replaceFirst(TEMP_TO_PERM_URL_REGEX, "$1")
}
return this
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
val permanentMangaUrlPref = SwitchPreferenceCompat(screen.context).apply {
key = getPermanentMangaUrlPreferenceKey()
@ -109,30 +86,12 @@ open class AsuraScans(
.commit()
}
}
val permanentChapterUrlPref = SwitchPreferenceCompat(screen.context).apply {
key = getPermanentChapterUrlPreferenceKey()
title = PREF_PERM_CHAPTER_URL_TITLE
summary = PREF_PERM_CHAPTER_URL_SUMMARY
setDefaultValue(true)
setOnPreferenceChangeListener { _, newValue ->
val checkValue = newValue as Boolean
preferences.edit()
.putBoolean(getPermanentChapterUrlPreferenceKey(), checkValue)
.commit()
}
}
screen.addPreference(permanentMangaUrlPref)
screen.addPreference(permanentChapterUrlPref)
}
private fun getPermanentMangaUrlPreferenceKey(): String {
return PREF_PERM_MANGA_URL_KEY_PREFIX + lang
}
private fun getPermanentChapterUrlPreferenceKey(): String {
return PREF_PERM_CHAPTER_URL_KEY_PREFIX + lang
}
// Permanent Url for Manga/Chapter End
companion object {
@ -140,10 +99,6 @@ open class AsuraScans(
private const val PREF_PERM_MANGA_URL_TITLE = "Permanent Manga URL"
private const val PREF_PERM_MANGA_URL_SUMMARY = "Turns all manga urls into permanent ones."
private const val PREF_PERM_CHAPTER_URL_KEY_PREFIX = "pref_permanent_chapter_url"
private const val PREF_PERM_CHAPTER_URL_TITLE = "Permanent Chapter URL"
private const val PREF_PERM_CHAPTER_URL_SUMMARY = "Turns all chapter urls into permanent one."
private val TEMP_TO_PERM_URL_REGEX = Regex("""(/)\d+-""")
}
}

View File

@ -13,7 +13,7 @@ class WPMangaStreamGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 13
override val sources = listOf(
MultiLang("Asura Scans", "https://www.asurascans.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 10),
MultiLang("Asura Scans", "https://www.asurascans.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 11),
SingleLang("Infernal Void Scans", "https://infernalvoidscans.com", "en", overrideVersionCode = 3),
SingleLang("KlanKomik", "https://klankomik.com", "id", overrideVersionCode = 1),
SingleLang("Kombatch", "https://kombatch.com", "id"),