Skip to content

Commit 5e88cc2

Browse files
committed
Format
1 parent de286d5 commit 5e88cc2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

firebase-common/src/androidMain/kotlin/dev/gitlive/firebase/_decoders.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ actual fun FirebaseDecoder.structureDecoder(descriptor: SerialDescriptor, decode
1515
StructureKind.CLASS, StructureKind.OBJECT, PolymorphicKind.SEALED -> (value as Map<*, *>).let { map ->
1616
FirebaseClassDecoder(decodeDouble, map.size, { map.containsKey(it) }) { desc, index -> map[desc.getElementName(index)] }
1717
}
18-
StructureKind.LIST, PolymorphicKind.SEALED-> (value as List<*>).let {
18+
StructureKind.LIST -> (value as List<*>).let {
1919
FirebaseCompositeDecoder(decodeDouble, it.size) { _, index -> it[index] }
2020
}
2121
StructureKind.MAP -> (value as Map<*, *>).entries.toList().let {

firebase-common/src/androidMain/kotlin/dev/gitlive/firebase/_encoders.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import kotlinx.serialization.descriptors.StructureKind
1111
import kotlin.collections.set
1212

1313
actual fun FirebaseEncoder.structureEncoder(descriptor: SerialDescriptor): CompositeEncoder = when(descriptor.kind) {
14-
StructureKind.LIST -> mutableListOf<Any?>()
15-
.also { value = it }
16-
.let { FirebaseCompositeEncoder(shouldEncodeElementDefault, positiveInfinity) { _, index, value -> it.add(index, value) } }
17-
StructureKind.MAP -> mutableListOf<Any?>()
18-
.let { FirebaseCompositeEncoder(shouldEncodeElementDefault, positiveInfinity, { value = it.chunked(2).associate { (k, v) -> k to v } }) { _, _, value -> it.add(value) } }
19-
StructureKind.CLASS, StructureKind.OBJECT, PolymorphicKind.SEALED -> mutableMapOf<Any?, Any?>()
20-
.also { value = it }
21-
.let { FirebaseCompositeEncoder(shouldEncodeElementDefault, positiveInfinity) { _, index, value -> it[descriptor.getElementName(index)] = value } }
22-
else -> TODO("The firebase-kotlin-sdk does not support $descriptor for serialization yet")
23-
}
14+
StructureKind.LIST -> mutableListOf<Any?>()
15+
.also { value = it }
16+
.let { FirebaseCompositeEncoder(shouldEncodeElementDefault, positiveInfinity) { _, index, value -> it.add(index, value) } }
17+
StructureKind.MAP -> mutableListOf<Any?>()
18+
.let { FirebaseCompositeEncoder(shouldEncodeElementDefault, positiveInfinity, { value = it.chunked(2).associate { (k, v) -> k to v } }) { _, _, value -> it.add(value) } }
19+
StructureKind.CLASS, StructureKind.OBJECT, PolymorphicKind.SEALED -> mutableMapOf<Any?, Any?>()
20+
.also { value = it }
21+
.let { FirebaseCompositeEncoder(shouldEncodeElementDefault, positiveInfinity) { _, index, value -> it[descriptor.getElementName(index)] = value } }
22+
else -> TODO("The firebase-kotlin-sdk does not support $descriptor for serialization yet")
23+
}

0 commit comments

Comments
 (0)