Skip to content

Commit

Permalink
IOS support was added for :NetworkDispatcherKtor module
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohdan-Kim committed Sep 27, 2024
1 parent 66d6396 commit 5638112
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 5 additions & 1 deletion NetworkDispatcherKtor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ kotlin {
}
}

iosX64()
iosArm64()
iosSimulatorArm64()

val ktorVersion = "2.1.2"
sourceSets {
val commonMain by getting {
Expand All @@ -31,7 +35,7 @@ kotlin {
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")

implementation("io.growthbook.sdk:Core:1.0.1")
implementation("io.growthbook.sdk:Core:1.0.2")
}
}
val androidMain by getting {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.sdk.growthbook.network

import java.net.UnknownHostException
import java.util.concurrent.TimeoutException
import com.sdk.growthbook.utils.Resource
import kotlinx.coroutines.Job
import io.ktor.client.HttpClient
Expand All @@ -27,7 +25,6 @@ import io.ktor.http.ContentType
import io.ktor.http.contentType
import io.ktor.client.request.HttpRequestBuilder
import io.ktor.utils.io.errors.IOException
import javax.net.ssl.SSLHandshakeException

internal fun createDefaultHttpClient(): HttpClient =
HttpClient {
Expand Down Expand Up @@ -68,16 +65,10 @@ class GBNetworkDispatcherKtor(
} catch (exception: Exception) {
onError(exception)
}
} catch (unknownHostException: UnknownHostException) {
onError(unknownHostException)
} catch (clientRequestException: ClientRequestException) {
onError(clientRequestException)
} catch (serverResponseException: ServerResponseException) {
onError(serverResponseException)
} catch (timeoutException: TimeoutException) {
onError(timeoutException)
} catch (sslHandshakeException: SSLHandshakeException) {
onError(sslHandshakeException)
} catch (ioException: IOException) {
onError(ioException)
} catch (exception: Exception) { // for the case if something was missed
Expand Down

0 comments on commit 5638112

Please sign in to comment.