From ec9df374599274e86ff3c408e290ccb23639ebd5 Mon Sep 17 00:00:00 2001 From: y9vad9 Date: Wed, 27 Sep 2023 20:51:23 +0200 Subject: [PATCH] fix: build --- rsocket-engine/build.gradle.kts | 4 ++++ .../sessions/types/SerializableTimerState.kt | 20 +++++++++++++++++++ .../rsocket/timers/types/SerializableTimer.kt | 2 ++ sdk/build.gradle.kts | 4 ++++ 4 files changed, 30 insertions(+) diff --git a/rsocket-engine/build.gradle.kts b/rsocket-engine/build.gradle.kts index 51945db..8b144bf 100644 --- a/rsocket-engine/build.gradle.kts +++ b/rsocket-engine/build.gradle.kts @@ -35,4 +35,8 @@ deployLibrary { version = System.getenv("TIMEMATES_SDK_VERSION") } +} + +tasks.withType { + useJUnitPlatform() } \ No newline at end of file diff --git a/rsocket-engine/src/commonMain/kotlin/io/timemates/api/rsocket/timers/sessions/types/SerializableTimerState.kt b/rsocket-engine/src/commonMain/kotlin/io/timemates/api/rsocket/timers/sessions/types/SerializableTimerState.kt index 3856e86..eb54b71 100644 --- a/rsocket-engine/src/commonMain/kotlin/io/timemates/api/rsocket/timers/sessions/types/SerializableTimerState.kt +++ b/rsocket-engine/src/commonMain/kotlin/io/timemates/api/rsocket/timers/sessions/types/SerializableTimerState.kt @@ -59,4 +59,24 @@ internal fun SerializableTimerState.sdk(): Timer.State { publishTime = publishTime, ) } +} + +internal fun Timer.State.serializable(): SerializableTimerState { + return when (this) { + is Timer.State.ConfirmationWaiting -> SerializableTimerState.Confirmation( + endsAt.toEpochMilliseconds(), publishTime.toEpochMilliseconds(), + ) + is Timer.State.Inactive -> SerializableTimerState.Inactive( + publishTime.toEpochMilliseconds(), + ) + is Timer.State.Paused -> SerializableTimerState.Pause( + publishTime.toEpochMilliseconds(), + ) + is Timer.State.Rest -> SerializableTimerState.Rest( + endsAt.toEpochMilliseconds(), publishTime.toEpochMilliseconds(), + ) + is Timer.State.Running -> SerializableTimerState.Running( + endsAt.toEpochMilliseconds(), publishTime.toEpochMilliseconds(), + ) + } } \ No newline at end of file diff --git a/rsocket-engine/src/commonMain/kotlin/io/timemates/api/rsocket/timers/types/SerializableTimer.kt b/rsocket-engine/src/commonMain/kotlin/io/timemates/api/rsocket/timers/types/SerializableTimer.kt index 02c45a6..d108c6b 100644 --- a/rsocket-engine/src/commonMain/kotlin/io/timemates/api/rsocket/timers/types/SerializableTimer.kt +++ b/rsocket-engine/src/commonMain/kotlin/io/timemates/api/rsocket/timers/types/SerializableTimer.kt @@ -1,6 +1,7 @@ package io.timemates.api.rsocket.timers.types import io.timemates.api.rsocket.timers.sessions.types.SerializableTimerState +import io.timemates.api.rsocket.timers.sessions.types.sdk import io.timemates.sdk.common.constructor.createOrThrow import io.timemates.sdk.common.types.value.Count import io.timemates.sdk.timers.types.Timer @@ -29,5 +30,6 @@ internal fun SerializableTimer.sdk(): Timer { ownerId = UserId.createOrThrow(ownerId), membersCount = Count.createOrThrow(membersCount), settings = settings.sdk(), + state = state.sdk() ) } \ No newline at end of file diff --git a/sdk/build.gradle.kts b/sdk/build.gradle.kts index bdad811..8c72269 100644 --- a/sdk/build.gradle.kts +++ b/sdk/build.gradle.kts @@ -33,4 +33,8 @@ deployLibrary { version = System.getenv("TIMEMATES_SDK_VERSION") } +} + +tasks.withType { + useJUnitPlatform() } \ No newline at end of file