package com.lagradost.cloudstream3.ui.settings.extensions import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import com.fasterxml.jackson.annotation.JsonProperty import com.lagradost.cloudstream3.AcraApplication.Companion.getKey import com.lagradost.cloudstream3.plugins.PREBUILT_REPOSITORIES data class RepositoryData( @JsonProperty("name") val name: String, @JsonProperty("url") val url: String ) const val REPOSITORIES_KEY = "REPOSITORIES_KEY" class ExtensionsViewModel : ViewModel() { private val _repositories = MutableLiveData>() val repositories: LiveData> = _repositories fun loadRepositories() { // Crashes weirdly with List val urls = (getKey>(REPOSITORIES_KEY) ?: emptyArray()) + PREBUILT_REPOSITORIES _repositories.postValue(urls) } }