From a115647015ad0d438fa54bd745d0131c5a8a42c2 Mon Sep 17 00:00:00 2001 From: Rene Luria Date: Fri, 28 Aug 2026 15:41:22 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20scope=20d=C3=A9di=C3=A9=20=C3=A0=20l'?= =?UTF-8?q?=C3=A9cran=20de=20jeu=20pour=20annuler=20le=20moteur=20=C3=A0?= =?UTF-8?q?=20la=20sortie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sharedUI/src/commonMain/kotlin/com/livrets/App.kt | 1 - sharedUI/src/commonMain/kotlin/com/livrets/ui/GameScreen.kt | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sharedUI/src/commonMain/kotlin/com/livrets/App.kt b/sharedUI/src/commonMain/kotlin/com/livrets/App.kt index bcc8b16..39fadc7 100644 --- a/sharedUI/src/commonMain/kotlin/com/livrets/App.kt +++ b/sharedUI/src/commonMain/kotlin/com/livrets/App.kt @@ -41,7 +41,6 @@ fun App( is Screen.Game -> GameScreen( config = current.config, - scope = scope, onFinish = { result -> screen = Screen.Results(result) scope.launch { history.save(result) } diff --git a/sharedUI/src/commonMain/kotlin/com/livrets/ui/GameScreen.kt b/sharedUI/src/commonMain/kotlin/com/livrets/ui/GameScreen.kt index 25cf6d2..425ecb6 100644 --- a/sharedUI/src/commonMain/kotlin/com/livrets/ui/GameScreen.kt +++ b/sharedUI/src/commonMain/kotlin/com/livrets/ui/GameScreen.kt @@ -26,6 +26,7 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -37,15 +38,14 @@ import com.livrets.game.GameConfig import com.livrets.game.GameEngine import com.livrets.game.GameResult import com.livrets.game.GameState -import kotlinx.coroutines.CoroutineScope @Composable fun GameScreen( config: GameConfig, - scope: CoroutineScope, onFinish: (GameResult) -> Unit, onQuit: () -> Unit, ) { + val scope = rememberCoroutineScope() val engine = remember(config) { GameEngine(config, scope, onFinish = onFinish) } val state by engine.state.collectAsState()