From d573c5ff8c42b9e1001697cdadb46ab5b3859048 Mon Sep 17 00:00:00 2001 From: YuKongA <70465933+YuKongA@users.noreply.github.com> Date: Sat, 11 Jan 2025 16:10:27 +0800 Subject: [PATCH] app: Switch to use CIO client * When ktor 3.1.0, CIO client should also be used on js/wasmjs platforms --- composeApp/build.gradle.kts | 6 +++--- composeApp/src/androidMain/kotlin/Login.android.kt | 4 ++-- composeApp/src/desktopMain/kotlin/Login.desktop.kt | 4 ++-- composeApp/src/iosMain/kotlin/Login.ios.kt | 4 ++-- gradle/libs.versions.toml | 3 +-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index d1d9502..6e82324 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -83,13 +83,13 @@ kotlin { implementation(libs.androidx.activity.compose) // Added implementation(libs.cryptography.provider.jdk) - implementation(libs.ktor.client.okhttp) + implementation(libs.ktor.client.cio) implementation(libs.hiddenapibypass) } iosMain.dependencies { // Added implementation(libs.cryptography.provider.apple) - implementation(libs.ktor.client.darwin) + implementation(libs.ktor.client.cio) } jsMain.dependencies { // Added @@ -105,7 +105,7 @@ kotlin { implementation(compose.desktop.currentOs) // Added implementation(libs.cryptography.provider.jdk) - implementation(libs.ktor.client.okhttp) + implementation(libs.ktor.client.cio) } } } diff --git a/composeApp/src/androidMain/kotlin/Login.android.kt b/composeApp/src/androidMain/kotlin/Login.android.kt index 56dbd20..ea740a8 100644 --- a/composeApp/src/androidMain/kotlin/Login.android.kt +++ b/composeApp/src/androidMain/kotlin/Login.android.kt @@ -1,8 +1,8 @@ import io.ktor.client.HttpClient -import io.ktor.client.engine.okhttp.OkHttp +import io.ktor.client.engine.cio.CIO actual fun httpClientPlatform(): HttpClient { - return HttpClient(OkHttp) + return HttpClient(CIO) } actual fun isWeb(): Boolean = false \ No newline at end of file diff --git a/composeApp/src/desktopMain/kotlin/Login.desktop.kt b/composeApp/src/desktopMain/kotlin/Login.desktop.kt index 56dbd20..ea740a8 100644 --- a/composeApp/src/desktopMain/kotlin/Login.desktop.kt +++ b/composeApp/src/desktopMain/kotlin/Login.desktop.kt @@ -1,8 +1,8 @@ import io.ktor.client.HttpClient -import io.ktor.client.engine.okhttp.OkHttp +import io.ktor.client.engine.cio.CIO actual fun httpClientPlatform(): HttpClient { - return HttpClient(OkHttp) + return HttpClient(CIO) } actual fun isWeb(): Boolean = false \ No newline at end of file diff --git a/composeApp/src/iosMain/kotlin/Login.ios.kt b/composeApp/src/iosMain/kotlin/Login.ios.kt index 200c4fa..ea740a8 100644 --- a/composeApp/src/iosMain/kotlin/Login.ios.kt +++ b/composeApp/src/iosMain/kotlin/Login.ios.kt @@ -1,8 +1,8 @@ import io.ktor.client.HttpClient -import io.ktor.client.engine.darwin.Darwin +import io.ktor.client.engine.cio.CIO actual fun httpClientPlatform(): HttpClient { - return HttpClient(Darwin) + return HttpClient(CIO) } actual fun isWeb(): Boolean = false \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 63f79a5..c6b8d02 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,9 +22,8 @@ hiddenapibypass = { module = "org.lsposed.hiddenapibypass:hiddenapibypass", vers image-loader = { module = "io.github.qdsfdhvh:image-loader", version.ref = "image-loader" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor-client" } -ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor-client" } +ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor-client" } ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor-client" } -ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor-client" } miuix = { module = "top.yukonga.miuix.kmp:miuix", version.ref = "miuix" } [plugins]