diff --git a/src/pt/randomscan/build.gradle b/src/pt/randomscan/build.gradle index 41a188242..8687f3929 100644 --- a/src/pt/randomscan/build.gradle +++ b/src/pt/randomscan/build.gradle @@ -3,7 +3,11 @@ ext { extClass = '.LuraToon' themePkg = 'peachscan' baseUrl = 'https://luratoon.com' - overrideVersionCode = 39 + overrideVersionCode = 40 } apply from: "$rootDir/common.gradle" + +dependencies { + implementation project(':lib:randomua') +} diff --git a/src/pt/randomscan/src/eu/kanade/tachiyomi/extension/pt/randomscan/LuraToon.kt b/src/pt/randomscan/src/eu/kanade/tachiyomi/extension/pt/randomscan/LuraToon.kt index 78201d350..39807ac2a 100644 --- a/src/pt/randomscan/src/eu/kanade/tachiyomi/extension/pt/randomscan/LuraToon.kt +++ b/src/pt/randomscan/src/eu/kanade/tachiyomi/extension/pt/randomscan/LuraToon.kt @@ -1,10 +1,39 @@ package eu.kanade.tachiyomi.extension.pt.randomscan +import android.app.Application +import android.content.SharedPreferences +import androidx.preference.PreferenceScreen +import eu.kanade.tachiyomi.lib.randomua.addRandomUAPreferenceToScreen +import eu.kanade.tachiyomi.lib.randomua.getPrefCustomUA +import eu.kanade.tachiyomi.lib.randomua.getPrefUAType +import eu.kanade.tachiyomi.lib.randomua.setRandomUserAgent import eu.kanade.tachiyomi.multisrc.peachscan.PeachScan import eu.kanade.tachiyomi.network.interceptor.rateLimit +import eu.kanade.tachiyomi.source.ConfigurableSource +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get + +class LuraToon : + PeachScan( + "Lura Toon", + "https://luratoon.com", + "pt-BR", + ), + ConfigurableSource { + + private val preferences: SharedPreferences by lazy { + Injekt.get().getSharedPreferences("source_$id", 0x0000) + } -class LuraToon : PeachScan("Lura Toon", "https://luratoon.com", "pt-BR") { override val client = super.client.newBuilder() .rateLimit(1, 2) + .setRandomUserAgent( + preferences.getPrefUAType(), + preferences.getPrefCustomUA(), + ) .build() + + override fun setupPreferenceScreen(screen: PreferenceScreen) { + addRandomUAPreferenceToScreen(screen) + } }