Skip to content

Commit

Permalink
GenzToons: Update theme and domain (#5587)
Browse files Browse the repository at this point in the history
* update theme and domain

* add paid chapters preference
  • Loading branch information
bapeey authored Oct 19, 2024
1 parent 02383f1 commit 4bf6be0
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/en/suryascans/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 4bf6be0

Please sign in to comment.