Show PREBUILT_REPOSITORIES in extensions tab

This commit is contained in:
Blatzar 2022-08-09 05:30:51 +02:00
parent 72f1726367
commit 08d7f3444f
2 changed files with 4 additions and 2 deletions

View file

@ -15,6 +15,7 @@ import androidx.navigation.fragment.findNavController
import com.lagradost.cloudstream3.CommonActivity.showToast import com.lagradost.cloudstream3.CommonActivity.showToast
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.mvvm.observe import com.lagradost.cloudstream3.mvvm.observe
import com.lagradost.cloudstream3.plugins.PREBUILT_REPOSITORIES
import com.lagradost.cloudstream3.plugins.RepositoryManager import com.lagradost.cloudstream3.plugins.RepositoryManager
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
@ -42,7 +43,7 @@ class ExtensionsFragment : Fragment() {
setUpToolbar(R.string.extensions) setUpToolbar(R.string.extensions)
repo_recycler_view?.adapter = RepoAdapter(emptyArray(), false, { repo_recycler_view?.adapter = RepoAdapter(PREBUILT_REPOSITORIES, false, {
findNavController().navigate( findNavController().navigate(
R.id.navigation_settings_extensions_to_navigation_settings_plugins, R.id.navigation_settings_extensions_to_navigation_settings_plugins,
Bundle().apply { Bundle().apply {

View file

@ -5,6 +5,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.AcraApplication.Companion.getKey import com.lagradost.cloudstream3.AcraApplication.Companion.getKey
import com.lagradost.cloudstream3.plugins.PREBUILT_REPOSITORIES
data class RepositoryData( data class RepositoryData(
@JsonProperty("name") val name: String, @JsonProperty("name") val name: String,
@ -19,7 +20,7 @@ class ExtensionsViewModel : ViewModel() {
fun loadRepositories() { fun loadRepositories() {
// Crashes weirdly with List<RepositoryData> // Crashes weirdly with List<RepositoryData>
val urls = getKey<Array<RepositoryData>>(REPOSITORIES_KEY) ?: emptyArray() val urls = (getKey<Array<RepositoryData>>(REPOSITORIES_KEY) ?: emptyArray()) + PREBUILT_REPOSITORIES
_repositories.postValue(urls) _repositories.postValue(urls)
} }
} }