Skip to content

Commit

Permalink
Moved Ktor engine from Darwin to CIO
Browse files Browse the repository at this point in the history
  • Loading branch information
N7ghtm4r3 committed Jan 10, 2025
1 parent 2d69146 commit 5650587
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion equinox-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ kotlin {
dependencies {
implementation(libs.connectivity.device)
implementation(libs.connectivity.compose.device)
implementation(libs.ktor.client.darwin)
implementation(libs.ktor.client.cio)
}
}

Expand Down
2 changes: 1 addition & 1 deletion equinox-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ kotlin {
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
dependencies {
implementation(libs.ktor.client.darwin)
implementation(libs.ktor.client.cio)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.tecknobit.equinoxcore.network

import io.ktor.client.*
import io.ktor.client.engine.darwin.*
import platform.Foundation.NSURLCredential
import platform.Foundation.NSURLSessionAuthChallengeUseCredential
import io.ktor.client.engine.cio.*

/**
* Method to obtain a platform-based HTTP engine to execute HTTP requests.
Expand All @@ -18,17 +16,12 @@ internal actual fun obtainHttpEngine(
connectionTimeout: Long,
byPassSSLValidation: Boolean,
): HttpClient {
return HttpClient(Darwin) {
return HttpClient(CIO) {
engine {
configureRequest {
setTimeoutInterval(connectionTimeout / 1000.0)
}
if (!byPassSSLValidation) {
handleChallenge { _, _, _, completionHandler ->
completionHandler(
NSURLSessionAuthChallengeUseCredential.toInt(),
NSURLCredential()
)
requestTimeout = connectionTimeout
if (byPassSSLValidation) {
https {
serverName = null
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka"
kmprefs = { module = "io.github.n7ghtm4r3:KMPrefs", version.ref = "kmprefs" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
#equinox-compose
Expand Down

0 comments on commit 5650587

Please sign in to comment.