diff --git a/app-desktop/build.gradle.kts b/app-desktop/build.gradle.kts index 4c5c098..554e715 100644 --- a/app-desktop/build.gradle.kts +++ b/app-desktop/build.gradle.kts @@ -10,12 +10,19 @@ dependencies { implementation(project(":core")) implementation(compose.desktop.currentOs) implementation(compose.material3) + + // SLF4J logging implementation + implementation(libs.slf4j.simple) } compose.desktop { application { mainClass = "llc.lookatwhataicando.codeoba.desktop.MainKt" + jvmArgs += listOf( + "--enable-native-access=ALL-UNNAMED" + ) + nativeDistributions { targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) packageName = "Codeoba" diff --git a/core/src/desktopMain/kotlin/llc/lookatwhataicando/codeoba/core/data/realtime/RealtimeClientImpl.kt b/core/src/desktopMain/kotlin/llc/lookatwhataicando/codeoba/core/data/realtime/RealtimeClientImpl.kt index 0da9a65..8025470 100644 --- a/core/src/desktopMain/kotlin/llc/lookatwhataicando/codeoba/core/data/realtime/RealtimeClientImpl.kt +++ b/core/src/desktopMain/kotlin/llc/lookatwhataicando/codeoba/core/data/realtime/RealtimeClientImpl.kt @@ -1,10 +1,14 @@ package llc.lookatwhataicando.codeoba.core.data.realtime import io.ktor.client.HttpClient +import io.ktor.client.engine.cio.CIO +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.serialization.kotlinx.json.json import kotlinx.coroutines.Job import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow +import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject import llc.lookatwhataicando.codeoba.core.domain.realtime.ConnectionState import llc.lookatwhataicando.codeoba.core.domain.realtime.RealtimeConfig @@ -47,8 +51,15 @@ actual class RealtimeClientImpl actual constructor() : RealtimeClientBase() { throwable?.printStackTrace() } - // HTTP client for Desktop (uses default engine) - override val httpClient = HttpClient() + // HTTP client for Desktop (uses CIO engine with ContentNegotiation for JSON) + override val httpClient = HttpClient(CIO) { + install(ContentNegotiation) { + json(Json { + ignoreUnknownKeys = true + isLenient = true + }) + } + } private val _audioFrames = MutableSharedFlow(replay = 0) actual override val audioFrames: Flow = _audioFrames.asSharedFlow() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d119d4a..b75efb3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,6 +11,9 @@ kotlinx-serialization-json = "1.9.0" # Networking ktor = "3.3.3" +# Logging +slf4j = "2.0.16" + # WebRTC webrtc-android = "137.7151.05" @@ -45,6 +48,9 @@ ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" } +# Logging +slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" } + # AndroidX androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" } androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle-viewmodel-compose" }