fix: Dispatchers.Default pour la compat native iOS (IO internal en K/N)

This commit is contained in:
herel committed 2026-08-28 15:33:53 +02:00
1 parent 2c7c07377e
commit b7426e09eb
1 file changed
+2 -2
@@ -14,7 +14,7 @@ class HistoryRepository(
) {
private val json = Json { ignoreUnknownKeys = true }
suspend fun load(): List<GameResult> = withContext(Dispatchers.IO) {
suspend fun load(): List<GameResult> = 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))