diff --git a/app/src/main/java/com/lagradost/cloudstream3/plugins/RepositoryManager.kt b/app/src/main/java/com/lagradost/cloudstream3/plugins/RepositoryManager.kt index 5bc38f39..a3fb7857 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/plugins/RepositoryManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/plugins/RepositoryManager.kt @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.AcraApplication.Companion.getKey import com.lagradost.cloudstream3.AcraApplication.Companion.removeKey import com.lagradost.cloudstream3.AcraApplication.Companion.setKey +import com.lagradost.cloudstream3.PROVIDER_STATUS_OK import com.lagradost.cloudstream3.apmap import com.lagradost.cloudstream3.app import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall @@ -27,17 +28,26 @@ data class Repository( @JsonProperty("pluginLists") val pluginLists: List ) +/** + * Status int as the following: + * 0: Down + * 1: Ok + * 2: Slow + * 3: Beta only + * */ data class SitePlugin( @JsonProperty("url") val url: String, - @JsonProperty("tvTypes") val tvTypes: List?, + @JsonProperty("status") val status: Int, @JsonProperty("version") val version: Int, @JsonProperty("apiVersion") val apiVersion: Int, @JsonProperty("name") val name: String, @JsonProperty("authors") val authors: List, @JsonProperty("description") val description: String?, @JsonProperty("repositoryUrl") val repositoryUrl: String?, + @JsonProperty("tvTypes") val tvTypes: List?, @JsonProperty("language") val language: String?, - @JsonProperty("iconUrl") val iconUrl: String? + @JsonProperty("iconUrl") val iconUrl: String?, + @JsonProperty("isAdult") val isAdult: Boolean?, ) @@ -63,7 +73,7 @@ object RepositoryManager { val repo = parseRepository(repositoryUrl) ?: return null return repo.pluginLists.apmap { parsePlugins(it) - }.filterNotNull().flatten() + }.flatten() } suspend fun downloadPluginToFile(context: Context, pluginUrl: String, name: String): File? { diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginAdapter.kt index 61ad2601..af42d228 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/PluginAdapter.kt @@ -3,6 +3,7 @@ package com.lagradost.cloudstream3.ui.settings.extensions import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.plugins.PluginData @@ -51,7 +52,8 @@ class PluginAdapter( R.drawable.ic_baseline_delete_outline_24 else R.drawable.netflix_download - itemView.action_button.setImageResource(drawableInt) + itemView.nsfw_marker?.isVisible = plugin.isAdult == true + itemView.action_button?.setImageResource(drawableInt) itemView.action_button?.setOnClickListener { iconClickCallback.invoke(this@PluginAdapter, plugin, isDownloaded) diff --git a/app/src/main/res/layout/repository_item.xml b/app/src/main/res/layout/repository_item.xml index 10ba5336..3fb31591 100644 --- a/app/src/main/res/layout/repository_item.xml +++ b/app/src/main/res/layout/repository_item.xml @@ -7,9 +7,9 @@ android:padding="20dp"> - + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 29c8b4de..b6b8da5a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -576,4 +576,5 @@ Plugin Loaded Plugin Deleted Failed to load %s + 18+