Add Mangadex blocked groups and uploaders extension preference support

This commit is contained in:
Jobobby04
2022-02-01 17:09:20 -05:00
parent ffcb5f6954
commit 2eef81c468
3 changed files with 38 additions and 6 deletions
@@ -95,6 +95,8 @@ class MangaDex(delegate: HttpSource, val context: Context) :
private fun dataSaver() = sourcePreferences.getBoolean(getDataSaverPreferenceKey(mdLang.lang), false)
private fun usePort443Only() = sourcePreferences.getBoolean(getStandardHttpsPreferenceKey(mdLang.lang), false)
private fun blockedGroups() = sourcePreferences.getString(getBlockedGroupsPrefKey(mdLang.lang), "").orEmpty()
private fun blockedUploaders() = sourcePreferences.getString(getBlockedGroupsPrefKey(mdLang.lang), "").orEmpty()
private val mangadexService by lazy {
MangaDexService(client)
@@ -187,11 +189,11 @@ class MangaDex(delegate: HttpSource, val context: Context) :
}
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
return mangaHandler.fetchChapterListObservable(manga)
return mangaHandler.fetchChapterListObservable(manga, blockedGroups(), blockedUploaders())
}
override suspend fun getChapterList(manga: MangaInfo): List<ChapterInfo> {
return mangaHandler.getChapterList(manga)
return mangaHandler.getChapterList(manga, blockedGroups(), blockedUploaders())
}
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
@@ -316,5 +318,17 @@ class MangaDex(delegate: HttpSource, val context: Context) :
fun getStandardHttpsPreferenceKey(dexLang: String): String {
return "${standardHttpsPortPref}_$dexLang"
}
private const val blockedGroupsPref = "blockedGroups"
fun getBlockedGroupsPrefKey(dexLang: String): String {
return "${blockedGroupsPref}_$dexLang"
}
private const val blockedUploaderPref = "blockedUploader"
fun getBlockedUploaderPrefKey(dexLang: String): String {
return "${blockedUploaderPref}_$dexLang"
}
}
}