From b7426e09eb7bcbbeafaa2eb5666b3871a8be7f88 Mon Sep 17 00:00:00 2001 From: Rene Luria Date: Fri, 28 Aug 2026 15:33:53 +0200 Subject: [PATCH] fix: Dispatchers.Default pour la compat native iOS (IO internal en K/N) --- .../commonMain/kotlin/com/livrets/data/HistoryRepository.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sharedUI/src/commonMain/kotlin/com/livrets/data/HistoryRepository.kt b/sharedUI/src/commonMain/kotlin/com/livrets/data/HistoryRepository.kt index f85d090..171a0eb 100644 --- a/sharedUI/src/commonMain/kotlin/com/livrets/data/HistoryRepository.kt +++ b/sharedUI/src/commonMain/kotlin/com/livrets/data/HistoryRepository.kt @@ -14,7 +14,7 @@ class HistoryRepository( ) { private val json = Json { ignoreUnknownKeys = true } - suspend fun load(): List = withContext(Dispatchers.IO) { + suspend fun load(): List = withContext(Dispatchers.Default) { if (!fileSystem.exists(filePath)) return@withContext emptyList() fileSystem.read(filePath) { readUtf8() } .let { json.decodeFromString(ListSerializer(GameResult.serializer()), it) } @@ -22,7 +22,7 @@ class HistoryRepository( suspend fun save(result: GameResult) { val all = load() + result - withContext(Dispatchers.IO) { + withContext(Dispatchers.Default) { filePath.parent?.let { fileSystem.createDirectories(it) } fileSystem.write(filePath) { writeUtf8(json.encodeToString(ListSerializer(GameResult.serializer()), all))