让发现用例自己管理线程
This commit is contained in:
2 files changed
+2
-4
No files matched your search
@@ -78,10 +78,8 @@ import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
|||||||
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
||||||
import io.legado.app.ui.widget.components.text.AppText
|
import io.legado.app.ui.widget.components.text.AppText
|
||||||
import io.legado.app.utils.startActivity
|
import io.legado.app.utils.startActivity
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
import org.koin.compose.koinInject
|
import org.koin.compose.koinInject
|
||||||
import top.yukonga.miuix.kmp.theme.MiuixTheme
|
import top.yukonga.miuix.kmp.theme.MiuixTheme
|
||||||
@@ -107,7 +105,6 @@ fun ExploreScreen(
|
|||||||
viewModel.effects.collect { effect ->
|
viewModel.effects.collect { effect ->
|
||||||
when (effect) {
|
when (effect) {
|
||||||
is ExploreEffect.ExecuteKindAction -> {
|
is ExploreEffect.ExecuteKindAction -> {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val infoMap = getExploreInfoMap(effect.sourceUrl)
|
val infoMap = getExploreInfoMap(effect.sourceUrl)
|
||||||
exploreKindUseCase.executeAction(
|
exploreKindUseCase.executeAction(
|
||||||
action = effect.kind.action,
|
action = effect.kind.action,
|
||||||
@@ -121,7 +118,6 @@ fun ExploreScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
val expandedHeader = remember(uiState.expandedId, uiState.listItems) {
|
val expandedHeader = remember(uiState.expandedId, uiState.listItems) {
|
||||||
val expandedId = uiState.expandedId ?: return@remember null
|
val expandedId = uiState.expandedId ?: return@remember null
|
||||||
|
|||||||
@@ -76,8 +76,10 @@ class ExploreKindUiUseCase(
|
|||||||
override fun reUiView() = onRefreshKinds()
|
override fun reUiView() = onRefreshKinds()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
withContext(IO) {
|
||||||
evalButtonClick(actionText, source, effectiveInfoMap, title, sourceJsExtensions)
|
evalButtonClick(actionText, source, effectiveInfoMap, title, sourceJsExtensions)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun parseLiteralViewName(viewName: String?): String? {
|
private fun parseLiteralViewName(viewName: String?): String? {
|
||||||
if (viewName.isNullOrEmpty()) return null
|
if (viewName.isNullOrEmpty()) return null
|
||||||
|
|||||||
Reference in new issue
Block a user