mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
feature(ui): hide NSFW plugins (#1117)
Hide NSFW plugins if Settings / Providers NSFW is disabled
This commit is contained in:
parent
b3e3dadc72
commit
9bebfe4590
1 changed files with 5 additions and 1 deletions
|
@ -9,6 +9,7 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||||
|
import com.lagradost.cloudstream3.MainAPI.Companion.settingsForProvider
|
||||||
import com.lagradost.cloudstream3.PROVIDER_STATUS_DOWN
|
import com.lagradost.cloudstream3.PROVIDER_STATUS_DOWN
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
import com.lagradost.cloudstream3.amap
|
import com.lagradost.cloudstream3.amap
|
||||||
|
@ -181,8 +182,11 @@ class PluginsViewModel : ViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun updatePluginListPrivate(context: Context, repositoryUrl: String) {
|
private suspend fun updatePluginListPrivate(context: Context, repositoryUrl: String) {
|
||||||
|
val isAdult = settingsForProvider.enableAdult
|
||||||
val plugins = getPlugins(repositoryUrl)
|
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))
|
PluginViewData(plugin, isDownloaded(context, plugin.second.internalName, plugin.first))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue