GenzToons: Update theme and domain (#5587)

* update theme and domain

* add paid chapters preference
This commit is contained in:
bapeey 2024-10-19 07:47:20 -05:00 committed by Draff
parent 033f5cb3e6
commit 38567075ae
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 56 additions and 10 deletions

View File

@ -1,9 +1,9 @@
ext {
extName = 'Genz Toons'
extClass = '.GenzToons'
themePkg = 'mangathemesia'
baseUrl = 'https://genztoons.com'
overrideVersionCode = 4
themePkg = 'keyoapp'
baseUrl = 'https://genzupdates.com'
overrideVersionCode = 28
}
apply from: "$rootDir/common.gradle"

View File

@ -1,16 +1,62 @@
package eu.kanade.tachiyomi.extension.en.suryascans
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import android.app.Application
import android.content.SharedPreferences
import androidx.preference.PreferenceScreen
import androidx.preference.SwitchPreferenceCompat
import eu.kanade.tachiyomi.multisrc.keyoapp.Keyoapp
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.source.model.SChapter
import org.jsoup.nodes.Element
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
class GenzToons : MangaThemesia(
"Genz Toons",
"https://genztoons.com",
"en",
) {
override val id = 2909429739457928148
class GenzToons :
Keyoapp(
"Genz Toons",
"https://genztoons.com",
"en",
),
ConfigurableSource {
private val preferences: SharedPreferences =
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
override val client = super.client.newBuilder()
.rateLimit(3)
.build()
override fun chapterListSelector(): String {
if (!preferences.showPaidChapters) {
return "#chapters > a:not(:has(.text-sm span:matches(Upcoming))):not(:has(img[src*=Coin.svg]))"
}
return "#chapters > a:not(:has(.text-sm span:matches(Upcoming)))"
}
override fun chapterFromElement(element: Element): SChapter {
return super.chapterFromElement(element).apply {
if (element.select("img[src*=Coin.svg]").isNotEmpty()) {
name = "🔒 $name"
}
}
}
override fun setupPreferenceScreen(screen: PreferenceScreen) {
SwitchPreferenceCompat(screen.context).apply {
key = SHOW_PAID_CHAPTERS_PREF
title = "Display paid chapters"
summaryOn = "Paid chapters will appear."
summaryOff = "Only free chapters will be displayed."
setDefaultValue(SHOW_PAID_CHAPTERS_DEFAULT)
}.also(screen::addPreference)
}
private val SharedPreferences.showPaidChapters: Boolean
get() = getBoolean(SHOW_PAID_CHAPTERS_PREF, SHOW_PAID_CHAPTERS_DEFAULT)
companion object {
private const val SHOW_PAID_CHAPTERS_PREF = "pref_show_paid_chap"
private const val SHOW_PAID_CHAPTERS_DEFAULT = false
}
}