diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomPresenter.kt index 68d9ffe0c9..ea4f60f383 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/extension/ExtensionBottomPresenter.kt @@ -146,19 +146,22 @@ class ExtensionBottomPresenter( private fun toItems(tuple: ExtensionTuple): List { val context = bottomSheet.context val activeLangs = preferences.enabledLanguages().get() + val showNsfwExtensions = preferences.showNsfwExtension().get() val (installed, untrusted, available) = tuple val items = mutableListOf() - val installedSorted = installed.sortedWith(compareBy({ !it.hasUpdate }, { !it.isObsolete }, { it.pkgName })) + val installedSorted = installed.filter { showNsfwExtensions || !it.isNsfw } + .sortedWith(compareBy({ !it.hasUpdate }, { !it.isObsolete }, { it.pkgName })) val untrustedSorted = untrusted.sortedBy { it.pkgName } val availableSorted = available // Filter out already installed extensions and disabled languages .filter { avail -> installed.none { it.pkgName == avail.pkgName } && untrusted.none { it.pkgName == avail.pkgName } && - (avail.lang in activeLangs || avail.lang == "all") + (avail.lang in activeLangs || avail.lang == "all") && + (showNsfwExtensions || !avail.isNsfw) } .sortedBy { it.pkgName }