Skip to content

Commit

Permalink
app: Switch to use CIO client
Browse files Browse the repository at this point in the history
* When ktor 3.1.0, CIO client should also be used on js/wasmjs platforms
  • Loading branch information
YuKongA committed Jan 11, 2025
1 parent 0422d0b commit d573c5f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions composeApp/src/androidMain/kotlin/Login.android.kt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions composeApp/src/desktopMain/kotlin/Login.desktop.kt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions composeApp/src/iosMain/kotlin/Login.ios.kt
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit d573c5f

Please sign in to comment.