From 777f677175492886c89df18525395e0a4f572dd7 Mon Sep 17 00:00:00 2001 From: Ritox2 Date: Fri, 25 Nov 2022 16:18:37 -0800 Subject: [PATCH] Fix for #14342 (#14375) * Fix for #14276 * increase versionCode * fixed issue with requests going to page 1 * ehentai filter fix * added comments and removed logging * update gradle * Update src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt Co-authored-by: Two-Ai <81279822+Two-Ai@users.noreply.github.com> * Update src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt Co-authored-by: Two-Ai <81279822+Two-Ai@users.noreply.github.com> Co-authored-by: Alec Co-authored-by: Two-Ai <81279822+Two-Ai@users.noreply.github.com> --- src/all/ehentai/build.gradle | 2 +- .../tachiyomi/extension/all/ehentai/EHentai.kt | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/all/ehentai/build.gradle b/src/all/ehentai/build.gradle index 0ec182b9a..a26f33cee 100644 --- a/src/all/ehentai/build.gradle +++ b/src/all/ehentai/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'E-Hentai' pkgNameSuffix = 'all.ehentai' extClass = '.EHFactory' - extVersionCode = 19 + extVersionCode = 20 isNsfw = true } diff --git a/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt b/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt index ad41256d1..26f9668a1 100644 --- a/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt +++ b/src/all/ehentai/src/eu/kanade/tachiyomi/extension/all/ehentai/EHentai.kt @@ -165,9 +165,22 @@ abstract class EHentai( .joinToString(",") .let { if (it.isNotEmpty()) ",$it" else it } uri.appendQueryParameter("f_search", modifiedQuery) + //when attempting to search with no genres selected, will auto select all genres + filters.filterIsInstance().firstOrNull()?.state?.let { + //variable to to check is any genres are selected + val check = it.any { option -> option.state } // or it.any(GenreOption::state) + //if no genres are selected by the user set all genres to on + if (!check) { + for (i in it) { + (i as GenreOption).state = true + } + } + } + filters.forEach { if (it is UriFilter) it.addToUri(uri) } + if (uri.toString().contains("f_spf") || uri.toString().contains("f_spt")) { if (page > 1) uri.appendQueryParameter("from", lastMangaId) } @@ -182,7 +195,7 @@ abstract class EHentai( override fun latestUpdatesParse(response: Response) = genericMangaParse(response) private fun exGet(url: String, page: Int? = null, additionalHeaders: Headers? = null, cache: Boolean = true): Request { - //pages no longer exist, if app attempts to go to the first page after a request, do not include the page append + // pages no longer exist, if app attempts to go to the first page after a request, do not include the page append val pageIndex = if (page == 1) null else page return GET( pageIndex?.let { @@ -373,7 +386,7 @@ abstract class EHentai( EnforceLanguageFilter(getEnforceLanguagePref()), Watched(), GenreGroup(), - TagFilter("Misc Tags", triStateBoxesFrom(miscTags), ""), + TagFilter("Misc Tags", triStateBoxesFrom(miscTags), "other"), TagFilter("Female Tags", triStateBoxesFrom(femaleTags), "female"), TagFilter("Male Tags", triStateBoxesFrom(maleTags), "male"), AdvancedGroup()