Skip nsfw sources for recommendations if disabled

master
Koitharu 2 years ago
parent 0f28d5de11
commit 6e8a1cd6af
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -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))

Loading…
Cancel
Save