MangaSwat: Update domain (#3975)
CI / Prepare job (push) Successful in 6s Details
CI / Build individual modules (push) Failing after 4m40s Details
CI / Publish repo (push) Has been skipped Details

* Update domain

* add configurable url

* Update src/ar/mangaswat/src/eu/kanade/tachiyomi/extension/ar/mangaswat/MangaSwat.kt

* Update MangaSwat.kt

* Update MangaSwat.kt

---------

Co-authored-by: AwkwardPeak7 <48650614+AwkwardPeak7@users.noreply.github.com>
This commit is contained in:
Yush0DAN 2024-07-13 00:45:20 -06:00 committed by Draff
parent 7614a8d083
commit c2b107a8bd
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 19 additions and 10 deletions

View File

@ -2,8 +2,8 @@ ext {
extName = 'MangaSwat' extName = 'MangaSwat'
extClass = '.MangaSwat' extClass = '.MangaSwat'
themePkg = 'mangathemesia' themePkg = 'mangathemesia'
baseUrl = 'https://normoyun.com' baseUrl = 'https://t1manga.com'
overrideVersionCode = 18 overrideVersionCode = 19
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -4,7 +4,6 @@ import android.app.Application
import android.content.SharedPreferences import android.content.SharedPreferences
import android.widget.Toast import android.widget.Toast
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import eu.kanade.tachiyomi.extension.BuildConfig
import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia
import eu.kanade.tachiyomi.network.interceptor.rateLimit import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.ConfigurableSource import eu.kanade.tachiyomi.source.ConfigurableSource
@ -22,17 +21,14 @@ import uy.kohesive.injekt.api.get
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
private const val swatUrl = "https://normoyun.com"
class MangaSwat : class MangaSwat :
MangaThemesia( MangaThemesia(
"MangaSwat", "MangaSwat",
swatUrl, "https://t1manga.com",
"ar", "ar",
dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("ar")), dateFormat = SimpleDateFormat("MMMM dd, yyyy", Locale("ar")),
), ),
ConfigurableSource { ConfigurableSource {
private val defaultBaseUrl = swatUrl
override val baseUrl by lazy { getPrefBaseUrl() } override val baseUrl by lazy { getPrefBaseUrl() }
@ -99,8 +95,9 @@ class MangaSwat :
companion object { companion object {
private const val RESTART_TACHIYOMI = "Restart Tachiyomi to apply new setting." private const val RESTART_TACHIYOMI = "Restart Tachiyomi to apply new setting."
private const val BASE_URL_PREF_TITLE = "Override BaseUrl" private const val BASE_URL_PREF_TITLE = "Override BaseUrl"
private const val BASE_URL_PREF = "overrideBaseUrl_v${BuildConfig.VERSION_CODE}" private const val BASE_URL_PREF = "overrideBaseUrl"
private const val BASE_URL_PREF_SUMMARY = "For temporary uses. Updating the extension will erase this setting." private const val BASE_URL_PREF_SUMMARY = "For temporary uses. Updating the extension will erase this setting."
private const val DEFAULT_BASE_URL_PREF = "defaultBaseUrl"
} }
override fun setupPreferenceScreen(screen: PreferenceScreen) { override fun setupPreferenceScreen(screen: PreferenceScreen) {
@ -108,8 +105,9 @@ class MangaSwat :
key = BASE_URL_PREF key = BASE_URL_PREF
title = BASE_URL_PREF_TITLE title = BASE_URL_PREF_TITLE
summary = BASE_URL_PREF_SUMMARY summary = BASE_URL_PREF_SUMMARY
this.setDefaultValue(defaultBaseUrl) setDefaultValue(super.baseUrl)
dialogTitle = BASE_URL_PREF_TITLE dialogTitle = BASE_URL_PREF_TITLE
dialogMessage = "Default: ${super.baseUrl}"
setOnPreferenceChangeListener { _, _ -> setOnPreferenceChangeListener { _, _ ->
Toast.makeText(screen.context, RESTART_TACHIYOMI, Toast.LENGTH_LONG).show() Toast.makeText(screen.context, RESTART_TACHIYOMI, Toast.LENGTH_LONG).show()
@ -119,5 +117,16 @@ class MangaSwat :
screen.addPreference(baseUrlPref) screen.addPreference(baseUrlPref)
} }
private fun getPrefBaseUrl(): String = preferences.getString(BASE_URL_PREF, defaultBaseUrl)!! private fun getPrefBaseUrl(): String = preferences.getString(BASE_URL_PREF, super.baseUrl)!!
init {
preferences.getString(DEFAULT_BASE_URL_PREF, null).let { prefDefaultBaseUrl ->
if (prefDefaultBaseUrl != super.baseUrl) {
preferences.edit()
.putString(BASE_URL_PREF, super.baseUrl)
.putString(DEFAULT_BASE_URL_PREF, super.baseUrl)
.apply()
}
}
}
} }