Skip nsfw sources for recommendations if disabled
This commit is contained in:
@@ -48,6 +48,7 @@ import org.koitharu.kotatsu.R
|
|||||||
import org.koitharu.kotatsu.browser.cloudflare.CaptchaNotifier
|
import org.koitharu.kotatsu.browser.cloudflare.CaptchaNotifier
|
||||||
import org.koitharu.kotatsu.core.exceptions.CloudFlareProtectedException
|
import org.koitharu.kotatsu.core.exceptions.CloudFlareProtectedException
|
||||||
import org.koitharu.kotatsu.core.model.distinctById
|
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.parser.MangaRepository
|
||||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||||
import org.koitharu.kotatsu.core.util.ext.almostEquals
|
import org.koitharu.kotatsu.core.util.ext.almostEquals
|
||||||
@@ -187,6 +188,9 @@ class SuggestionsWorker @AssistedInject constructor(
|
|||||||
val semaphore = Semaphore(MAX_PARALLELISM)
|
val semaphore = Semaphore(MAX_PARALLELISM)
|
||||||
val producer = channelFlow {
|
val producer = channelFlow {
|
||||||
for (it in sources.shuffled()) {
|
for (it in sources.shuffled()) {
|
||||||
|
if (it.isNsfw() && appSettings.isSuggestionsExcludeNsfw) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
launch {
|
launch {
|
||||||
semaphore.withPermit {
|
semaphore.withPermit {
|
||||||
send(getList(it, tags, tagsBlacklist))
|
send(getList(it, tags, tagsBlacklist))
|
||||||
|
|||||||
Reference in New Issue
Block a user