From 32e7fc00385ea762d8bd3d413c9f8df507ceacc8 Mon Sep 17 00:00:00 2001 From: davidoskky Date: Tue, 4 Oct 2022 15:01:22 +0200 Subject: [PATCH] Correct boolean serialization --- .../bou/amine/apps/readerforselfossv2/model/SelfossModel.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt index 2543979..e30d260 100644 --- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/model/SelfossModel.kt @@ -138,7 +138,11 @@ class SelfossModel { object BooleanSerializer : KSerializer { override fun deserialize(decoder: Decoder): Boolean { val json = ((decoder as JsonDecoder).decodeJsonElement()).jsonPrimitive - return json.booleanOrNull ?: json.int == 1 + return if (json.booleanOrNull != null) { + json.boolean + } else { + json.int == 1 + } } override val descriptor: SerialDescriptor