summaryrefslogtreecommitdiff
path: root/sw-client
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-08-20 16:05:20 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-08-31 15:47:51 +0200
commitdf83c7cb14ee46d73743c1fd053d47a9b0e79e2a (patch)
tree84d73d348f05892248f7d531c49fb1a0f276dba1 /sw-client
parentUpgrade ktlint and re-enable import order check (diff)
downloadseven-wonders-df83c7cb14ee46d73743c1fd053d47a9b0e79e2a.tar.gz
seven-wonders-df83c7cb14ee46d73743c1fd053d47a9b0e79e2a.tar.bz2
seven-wonders-df83c7cb14ee46d73743c1fd053d47a9b0e79e2a.zip
Upgrade to Kotlin 1.4 and corresponding library versions
- Kotlinx Serialization 1.0.0-RC - Coroutines 1.3.9 - Krossbow 0.30.1
Diffstat (limited to 'sw-client')
-rw-r--r--sw-client/build.gradle.kts14
-rw-r--r--sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt6
2 files changed, 7 insertions, 13 deletions
diff --git a/sw-client/build.gradle.kts b/sw-client/build.gradle.kts
index 8412c25d..8e565745 100644
--- a/sw-client/build.gradle.kts
+++ b/sw-client/build.gradle.kts
@@ -2,7 +2,7 @@ plugins {
kotlin("multiplatform")
}
-val krossbowVersion = "0.21.1"
+val krossbowVersion = "0.30.1"
kotlin {
jvm()
@@ -13,8 +13,8 @@ kotlin {
val commonMain by getting {
dependencies {
api(project(":sw-common-model"))
- implementation(kotlin("stdlib-common"))
- api("org.hildan.krossbow:krossbow-stomp-kxserialization-metadata:$krossbowVersion")
+ api("org.hildan.krossbow:krossbow-stomp-kxserialization:$krossbowVersion")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
}
}
val commonTest by getting {
@@ -23,12 +23,6 @@ kotlin {
implementation(kotlin("test-annotations-common"))
}
}
- val jvmMain by getting {
- dependencies {
- implementation(kotlin("stdlib-jdk8"))
- api("org.hildan.krossbow:krossbow-stomp-kxserialization-jvm:$krossbowVersion")
- }
- }
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
@@ -37,8 +31,6 @@ kotlin {
}
val jsMain by getting {
dependencies {
- implementation(kotlin("stdlib-js"))
- api("org.hildan.krossbow:krossbow-stomp-kxserialization-js:$krossbowVersion")
implementation(npm("text-encoding", "0.7.0")) // required by krossbow, because required by kotlinx-io
}
}
diff --git a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt
index f438e236..86831b13 100644
--- a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt
+++ b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt
@@ -4,8 +4,9 @@ import kotlinx.coroutines.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.serialization.DeserializationStrategy
+import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerializationStrategy
-import kotlinx.serialization.builtins.list
+import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.serializer
import org.hildan.krossbow.stomp.StompClient
import org.hildan.krossbow.stomp.config.HeartBeat
@@ -33,6 +34,7 @@ class SevenWondersClient {
heartBeatTolerance = HeartBeatTolerance(0, 10000) // wide margin to account for heroku cold start
}
+ @OptIn(ExperimentalSerializationApi::class)
suspend fun connect(serverUrl: String): SevenWondersSession {
val session = stompClient.connect("$serverUrl$SEVEN_WONDERS_WS_ENDPOINT").withJsonConversions()
return SevenWondersSession(session)
@@ -71,7 +73,7 @@ class SevenWondersSession(private val stompSession: StompSessionWithKxSerializat
)
fun watchGames(): Flow<List<LobbyDTO>> =
- stompSession.subscribe("/topic/games", LobbyDTO.serializer().list)
+ stompSession.subscribe("/topic/games", ListSerializer(LobbyDTO.serializer()))
suspend fun createGame(gameName: String): LobbyDTO = stompSession.request(
sendDestination = "/app/lobby/create",
bgstack15