修复发现某些点击项错误响应的问题
This commit is contained in:
3 files changed
+18
-30
No files matched your search
@@ -53,6 +53,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
import io.legado.app.data.entities.BookSourcePart
|
import io.legado.app.data.entities.BookSourcePart
|
||||||
|
import io.legado.app.help.source.getExploreInfoMap
|
||||||
import io.legado.app.ui.widget.components.explore.ExploreKindUiUseCase
|
import io.legado.app.ui.widget.components.explore.ExploreKindUiUseCase
|
||||||
import io.legado.app.ui.book.search.SearchActivity
|
import io.legado.app.ui.book.search.SearchActivity
|
||||||
import io.legado.app.ui.book.search.SearchScope
|
import io.legado.app.ui.book.search.SearchScope
|
||||||
@@ -77,8 +78,10 @@ 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
|
||||||
@@ -104,10 +107,13 @@ 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)
|
||||||
exploreKindUseCase.executeAction(
|
exploreKindUseCase.executeAction(
|
||||||
action = effect.kind.action,
|
action = effect.kind.action,
|
||||||
title = effect.kind.title,
|
title = effect.kind.title,
|
||||||
sourceUrl = effect.sourceUrl,
|
sourceUrl = effect.sourceUrl,
|
||||||
|
infoMap = infoMap,
|
||||||
activity = activity,
|
activity = activity,
|
||||||
onRefreshKinds = { viewModel.refreshExploreKinds(effect.sourceUrl) }
|
onRefreshKinds = { viewModel.refreshExploreKinds(effect.sourceUrl) }
|
||||||
)
|
)
|
||||||
@@ -115,6 +121,7 @@ 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
|
||||||
@@ -201,13 +208,7 @@ fun ExploreScreen(
|
|||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
items = uiState.listItems,
|
items = uiState.listItems,
|
||||||
key = { it.key },
|
key = { it.key }
|
||||||
contentType = {
|
|
||||||
when (it) {
|
|
||||||
is ExploreListItem.Header -> "source-header"
|
|
||||||
is ExploreListItem.KindRow -> "kind-row"
|
|
||||||
}
|
|
||||||
}
|
|||||||