From 4c4b6b1787d28cfd0c59cdb584a4318564bc466d Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Fri, 7 Oct 2022 00:06:14 +0200 Subject: [PATCH] Fix selecting random api --- .../com/lagradost/cloudstream3/ui/home/HomeViewModel.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeViewModel.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeViewModel.kt index 6254cb9b..d8497876 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeViewModel.kt @@ -276,9 +276,6 @@ class HomeViewModel : ViewModel() { if (preferredApiName == noneApi.name) { setKey(USER_SELECTED_HOMEPAGE_API, noneApi.name) loadAndCancel(noneApi) - // If the plugin isn't loaded yet. (Does not set the key) - } else if (api == null) { - loadAndCancel(noneApi) } else if (preferredApiName == randomApi.name) { val validAPIs = context?.filterProviderByPreferredMedia() if (validAPIs.isNullOrEmpty()) { @@ -289,6 +286,9 @@ class HomeViewModel : ViewModel() { loadAndCancel(apiRandom) setKey(USER_SELECTED_HOMEPAGE_API, apiRandom.name) } + // If the plugin isn't loaded yet. (Does not set the key) + } else if (api == null) { + loadAndCancel(noneApi) } else { setKey(USER_SELECTED_HOMEPAGE_API, api.name) loadAndCancel(api)