fix: 阅读界面电量显示

This commit is contained in:
HapeLee committed 2026-06-09 13:08:05 +08:00
1 parent 0adb3a1484
commit b731d201c1
1 file changed
+8 -8
@@ -46,9 +46,9 @@ import io.legado.app.ui.replace.ReplaceEditRoute
import io.legado.app.ui.replace.ReplaceRuleActivity
import io.legado.app.utils.StartActivityContract
import io.legado.app.utils.takePersistablePermissionSafely
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.flow.onSubscription
import kotlinx.coroutines.launch
import kotlinx.coroutines.yield
data class ReadBookViewRefs(
@@ -233,9 +233,11 @@ fun ReadBookRouteScreen(
// ── Effect collection: route handles launcher effects, rest goes to bridge ──
LaunchedEffect(viewModel) {
coroutineScope {
val collector = launch {
viewModel.effects.collect { effect ->
val effectsSubscribed = CompletableDeferred<Unit>()
launch {
viewModel.effects
.onSubscription { effectsSubscribed.complete(Unit) }
.collect { effect ->
try {
when (effect) {
// Launcher-dependent effects — handled directly by route
@@ -353,10 +355,8 @@ fun ReadBookRouteScreen(
}
}
}
yield()
effectsSubscribed.await()
onEffectsReady()
collector.join()
}
}
// ── System UI sync ────────────────────────────────────────────────