From 6e8a1cd6af6c69fc207c07dd96b9b750fddfc4fb Mon Sep 17 00:00:00 2001 From: Koitharu Date: Tue, 20 Aug 2024 16:28:39 +0300 Subject: [PATCH] Skip nsfw sources for recommendations if disabled --- .../org/koitharu/kotatsu/suggestions/ui/SuggestionsWorker.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/suggestions/ui/SuggestionsWorker.kt b/app/src/main/kotlin/org/koitharu/kotatsu/suggestions/ui/SuggestionsWorker.kt index 7737e2c98..4b06a43cf 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/suggestions/ui/SuggestionsWorker.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/suggestions/ui/SuggestionsWorker.kt @@ -48,6 +48,7 @@ import org.koitharu.kotatsu.R import org.koitharu.kotatsu.browser.cloudflare.CaptchaNotifier import org.koitharu.kotatsu.core.exceptions.CloudFlareProtectedException import org.koitharu.kotatsu.core.model.distinctById +import org.koitharu.kotatsu.core.model.isNsfw import org.koitharu.kotatsu.core.parser.MangaRepository import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.util.ext.almostEquals @@ -187,6 +188,9 @@ class SuggestionsWorker @AssistedInject constructor( val semaphore = Semaphore(MAX_PARALLELISM) val producer = channelFlow { for (it in sources.shuffled()) { + if (it.isNsfw() && appSettings.isSuggestionsExcludeNsfw) { + continue + } launch { semaphore.withPermit { send(getList(it, tags, tagsBlacklist))