feature(ui): hide NSFW plugins (#1117)

Hide NSFW plugins if Settings / Providers NSFW is disabled
This commit is contained in:
int3debug 2024-06-05 23:07:54 +02:00 committed by GitHub
parent b3e3dadc72
commit 9bebfe4590
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.lagradost.cloudstream3.CommonActivity.showToast
import com.lagradost.cloudstream3.MainAPI.Companion.settingsForProvider
import com.lagradost.cloudstream3.PROVIDER_STATUS_DOWN
import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.amap
@ -181,8 +182,11 @@ class PluginsViewModel : ViewModel() {
}
private suspend fun updatePluginListPrivate(context: Context, repositoryUrl: String) {
val isAdult = settingsForProvider.enableAdult
val plugins = getPlugins(repositoryUrl)
val list = plugins.map { plugin ->
val list = plugins.filter {
return@filter !(it.second.tvTypes?.contains("NSFW") == true && !isAdult)
}.map { plugin ->
PluginViewData(plugin, isDownloaded(context, plugin.second.internalName, plugin.first))
}