Drake Scans: Add option to hide paid chapters (#11504)
* added support for paid chapter filtering * updated extension version correctly * using config screen correctly with orginal theme class * Update src/en/drakescans/src/eu/kanade/tachiyomi/extension/en/drakescans/DrakeScans.kt --------- Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
This commit is contained in:
parent
5578344e19
commit
809848ab33
@ -3,7 +3,7 @@ ext {
|
|||||||
extClass = '.DrakeScans'
|
extClass = '.DrakeScans'
|
||||||
themePkg = 'mangathemesia'
|
themePkg = 'mangathemesia'
|
||||||
baseUrl = 'https://drakecomic.org'
|
baseUrl = 'https://drakecomic.org'
|
||||||
overrideVersionCode = 14
|
overrideVersionCode = 15
|
||||||
isNsfw = false
|
isNsfw = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,20 +1,29 @@
|
|||||||
package eu.kanade.tachiyomi.extension.en.drakescans
|
package eu.kanade.tachiyomi.extension.en.drakescans
|
||||||
|
|
||||||
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
|
||||||
|
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesiaPaidChapterHelper
|
||||||
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
|
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
|
||||||
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
import keiyoushi.utils.getPreferencesLazy
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
import kotlin.getValue
|
||||||
|
|
||||||
class DrakeScans : MangaThemesia(
|
class DrakeScans :
|
||||||
|
MangaThemesia(
|
||||||
"Drake Scans",
|
"Drake Scans",
|
||||||
"https://drakecomic.org",
|
"https://drakecomic.org",
|
||||||
"en",
|
"en",
|
||||||
) {
|
),
|
||||||
|
ConfigurableSource {
|
||||||
// madara -> mangathemesia
|
// madara -> mangathemesia
|
||||||
override val versionId = 2
|
override val versionId = 2
|
||||||
|
|
||||||
|
private val preferences by getPreferencesLazy()
|
||||||
|
|
||||||
override val client = super.client.newBuilder()
|
override val client = super.client.newBuilder()
|
||||||
.rateLimitHost(baseUrl.toHttpUrl(), 3, 1, TimeUnit.SECONDS)
|
.rateLimitHost(baseUrl.toHttpUrl(), 3, 1, TimeUnit.SECONDS)
|
||||||
.build()
|
.build()
|
||||||
@ -29,4 +38,17 @@ class DrakeScans : MangaThemesia(
|
|||||||
companion object {
|
companion object {
|
||||||
val JETPACK_CDN_REGEX = """^https:\/\/i[0-9]\.wp\.com\/""".toRegex()
|
val JETPACK_CDN_REGEX = """^https:\/\/i[0-9]\.wp\.com\/""".toRegex()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val paidChapterHelper = MangaThemesiaPaidChapterHelper(lockedChapterSelector = "ul li.locked")
|
||||||
|
|
||||||
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
|
paidChapterHelper.addHidePaidChaptersPreferenceToScreen(screen, intl)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun chapterListSelector(): String {
|
||||||
|
return paidChapterHelper.getChapterListSelectorBasedOnHidePaidChaptersPref(
|
||||||
|
super.chapterListSelector(),
|
||||||
|
preferences,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user