fix: 电量显示

This commit is contained in:
HapeLee committed 2026-06-10 01:01:15 +08:00
1 parent 38bbe6f3ff
commit b27f068525
1 file changed
+2 -5
@@ -46,7 +46,6 @@ import io.legado.app.ui.replace.ReplaceEditRoute
import io.legado.app.ui.replace.ReplaceRuleActivity import io.legado.app.ui.replace.ReplaceRuleActivity
import io.legado.app.utils.StartActivityContract import io.legado.app.utils.StartActivityContract
import io.legado.app.utils.takePersistablePermissionSafely import io.legado.app.utils.takePersistablePermissionSafely
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.flow.onSubscription import kotlinx.coroutines.flow.onSubscription
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -233,10 +232,9 @@ fun ReadBookRouteScreen(
// ── Effect collection: route handles launcher effects, rest goes to bridge ── // ── Effect collection: route handles launcher effects, rest goes to bridge ──
LaunchedEffect(viewModel) { LaunchedEffect(viewModel) {
val effectsSubscribed = CompletableDeferred<Unit>()
launch { launch {
viewModel.effects viewModel.effects
.onSubscription { effectsSubscribed.complete(Unit) } .onSubscription { onEffectsReady() }
.collect { effect -> .collect { effect ->
try { try {
when (effect) { when (effect) {
@@ -278,6 +276,7 @@ fun ReadBookRouteScreen(
putExtra("sourceOrigin", effect.sourceOrigin) putExtra("sourceOrigin", effect.sourceOrigin)
putExtra("sourceName", effect.sourceName) putExtra("sourceName", effect.sourceName)
effect.sourceType?.let { putExtra("sourceType", it) } effect.sourceType?.let { putExtra("sourceType", it) }
effect.html?.let { putExtra("html", it) }
} }
) )
} }
@@ -363,8 +362,6 @@ fun ReadBookRouteScreen(
} }
} }
} }
effectsSubscribed.await()
onEffectsReady()
} }
// ── System UI sync ──────────────────────────────────────────────── // ── System UI sync ────────────────────────────────────────────────