Merge pull request 'Correct boolean serialization' (#73) from davidoskky/ReaderForSelfoss-multiplatform:swiping into master
Some checks are pending
continuous-integration/drone/push Build is running
Some checks are pending
continuous-integration/drone/push Build is running
Reviewed-on: https://gitea.amine-louveau.fr/Louvorg/ReaderForSelfoss-multiplatform/pulls/73
This commit is contained in:
commit
054e936657
@ -138,7 +138,11 @@ class SelfossModel {
|
|||||||
object BooleanSerializer : KSerializer<Boolean> {
|
object BooleanSerializer : KSerializer<Boolean> {
|
||||||
override fun deserialize(decoder: Decoder): Boolean {
|
override fun deserialize(decoder: Decoder): Boolean {
|
||||||
val json = ((decoder as JsonDecoder).decodeJsonElement()).jsonPrimitive
|
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
|
override val descriptor: SerialDescriptor
|
||||||
|
Loading…
Reference in New Issue
Block a user