Merge pull request #430 from InsanusMokrassar/0.20.46

0.20.46
This commit is contained in:
InsanusMokrassar 2024-04-27 15:41:22 +06:00 committed by GitHub
commit bd2558e852
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 36 additions and 3 deletions

View File

@ -1,5 +1,11 @@
# Changelog # Changelog
## 0.20.46
* `Common`:
* Now this repo depends on `klock`
* Add new object-serializer `DateTimeSerializer` for `klock` serializer
## 0.20.45 ## 0.20.45
* `Versions`: * `Versions`:

View File

@ -8,6 +8,11 @@ apply from: "$mppJvmJsAndroidLinuxMingwLinuxArm64ProjectPresetPath"
kotlin { kotlin {
sourceSets { sourceSets {
commonMain {
dependencies {
api libs.klock
}
}
jvmMain { jvmMain {
dependencies { dependencies {
api project(":micro_utils.coroutines") api project(":micro_utils.coroutines")

View File

@ -0,0 +1,23 @@
package dev.inmo.micro_utils.common
import korlibs.time.DateTime
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializer
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
@Serializer(DateTime::class)
object DateTimeSerializer : KSerializer<DateTime> {
override val descriptor: SerialDescriptor
get() = Double.serializer().descriptor
override fun deserialize(decoder: Decoder): DateTime {
return DateTime(decoder.decodeDouble())
}
override fun serialize(encoder: Encoder, value: DateTime) {
encoder.encodeDouble(value.unixMillis)
}
}

View File

@ -15,5 +15,5 @@ crypto_js_version=4.1.1
# Project data # Project data
group=dev.inmo group=dev.inmo
version=0.20.45 version=0.20.46
android_code_version=251 android_code_version=252

View File

@ -12,7 +12,6 @@ kotlin {
dependencies { dependencies {
api internalProject("micro_utils.common") api internalProject("micro_utils.common")
api libs.kt.serialization.cbor api libs.kt.serialization.cbor
api libs.klock
api libs.uuid api libs.uuid
api libs.ktor.io api libs.ktor.io
} }