From 639a34de5be53c9ebe162ae2d5e87b7e01b7f48e Mon Sep 17 00:00:00 2001 From: Rene Luria Date: Sat, 29 Aug 2026 09:05:38 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20fiabilit=C3=A9=20de=20la=20soumission=20?= =?UTF-8?q?du=20score=20en=20fin=20de=20partie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sharedUI/src/commonMain/kotlin/com/livrets/App.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sharedUI/src/commonMain/kotlin/com/livrets/App.kt b/sharedUI/src/commonMain/kotlin/com/livrets/App.kt index 3418881..3055689 100644 --- a/sharedUI/src/commonMain/kotlin/com/livrets/App.kt +++ b/sharedUI/src/commonMain/kotlin/com/livrets/App.kt @@ -20,7 +20,9 @@ import com.livrets.ui.HistoryScreen import com.livrets.ui.HomeScreen import com.livrets.ui.ResultsScreen import com.livrets.ui.SwipeBack +import kotlinx.coroutines.NonCancellable import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import okio.Path.Companion.toPath sealed interface Screen { @@ -63,11 +65,15 @@ fun App( config = current.config, onFinish = { result -> screen = Screen.Results(result) - scope.launch { history.save(result) } scope.launch { - val score = result.leaderboardScore() - if (score > 0 && gamesServices.isSignedIn()) { - gamesServices.submitScore(result.config.leaderboardId(), score) + withContext(NonCancellable) { history.save(result) } + } + scope.launch { + withContext(NonCancellable) { + val score = result.leaderboardScore() + if (score > 0 && (gamesServices.isSignedIn() || gamesServices.signIn())) { + gamesServices.submitScore(result.config.leaderboardId(), score) + } } } },