mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
try to set default
This commit is contained in:
parent
db67c893f6
commit
8492c47a0b
1 changed files with 15 additions and 1 deletions
|
@ -5,6 +5,7 @@ import androidx.lifecycle.LiveData
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.lagradost.cloudstream3.APIHolder.allProviders
|
||||
import com.lagradost.cloudstream3.APIHolder.apis
|
||||
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.context
|
||||
|
@ -492,7 +493,20 @@ class HomeViewModel : ViewModel() {
|
|||
return@ioSafe
|
||||
}
|
||||
|
||||
val api = getApiFromNameNull(preferredApiName)
|
||||
var api = getApiFromNameNull(preferredApiName)
|
||||
// So if we have PREBUILD - try to hack default selection :)
|
||||
if (preferredApiName == null && allProviders.isEmpty() == false && fromUI == false) {
|
||||
val littleDefault = allProviders.firstOrNull { it.name == "UASerial" } // ["UASerial", "UASerial.club", "UASerialsPro", "UAserialsVip"]
|
||||
if (littleDefault != null) {
|
||||
api = getApiFromNameNull(littleDefault.name)
|
||||
if (api != null) {
|
||||
DataStoreHelper.currentHomePage = api.name
|
||||
loadAndCancel(api)
|
||||
return@ioSafe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (preferredApiName == noneApi.name) {
|
||||
// just set to random
|
||||
if (fromUI) DataStoreHelper.currentHomePage = noneApi.name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue