From f7752a98b2452a69f22a469d0bcbf761fb1c6569 Mon Sep 17 00:00:00 2001 From: Cuong-Tran Date: Fri, 25 Oct 2024 00:51:47 +0700 Subject: [PATCH] Avoid blocking call to load categories in settings (#1364) --- .../more/settings/screen/SettingsDownloadScreen.kt | 3 +-- .../presentation/more/settings/screen/SettingsLibraryScreen.kt | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt index 27f0504ce..680d73405 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDownloadScreen.kt @@ -15,7 +15,6 @@ import eu.kanade.presentation.more.settings.widget.TriStateListDialog import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.toImmutableMap -import kotlinx.coroutines.runBlocking import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.model.Category import tachiyomi.domain.download.service.DownloadPreferences @@ -35,7 +34,7 @@ object SettingsDownloadScreen : SearchableSettings { @Composable override fun getPreferences(): List { val getCategories = remember { Injekt.get() } - val allCategories by getCategories.subscribe().collectAsState(initial = runBlocking { getCategories.await() }) + val allCategories by getCategories.subscribe().collectAsState(initial = emptyList()) val downloadPreferences = remember { Injekt.get() } return listOf( diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt index c3ef07d42..9ba7281a2 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt @@ -24,7 +24,6 @@ import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.persistentMapOf import kotlinx.collections.immutable.toImmutableMap import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking import tachiyomi.domain.category.interactor.GetCategories import tachiyomi.domain.category.interactor.ResetCategoryFlags import tachiyomi.domain.category.model.Category @@ -53,7 +52,7 @@ object SettingsLibraryScreen : SearchableSettings { override fun getPreferences(): List { val getCategories = remember { Injekt.get() } val libraryPreferences = remember { Injekt.get() } - val allCategories by getCategories.subscribe().collectAsState(initial = runBlocking { getCategories.await() }) + val allCategories by getCategories.subscribe().collectAsState(initial = emptyList()) return listOf( getCategoriesGroup(LocalNavigator.currentOrThrow, allCategories, libraryPreferences),