Skip to content

Commit

Permalink
Fix for http requests
Browse files Browse the repository at this point in the history
- Replaced kotlinx serializer by gson serializer due to open issue in github Kotlin/kotlinx.serialization#576
- Replaced okhttp android client by ktor android client due to issues related to kotlin. It seems that it is related to latest version of okjhttp but even compiling with jvm target 1.8 is still failing:
square/okhttp#4597
  • Loading branch information
Joaquim Puyo authored and Joaquim Puyo committed Jun 23, 2020
2 parents 9c9a394 + 2805dfa commit 5c11a0d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -8,7 +8,7 @@ constraint_version=1.1.3
recycler_version=1.2.0-alpha01
material_version=1.2.0-alpha03
glide_version=4.9.0
serialization_version=0.13.0
serialization_version=0.20.0
fragment_version=1.1.0
ktor_version=1.3.1
multiplatform_settings_version=0.5
Expand Down
5 changes: 2 additions & 3 deletions helios-rewarding-sdk/build.gradle
Expand Up @@ -47,9 +47,8 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"

implementation "com.russhwolf:multiplatform-settings:0.5"
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
implementation "io.ktor:ktor-client-json-jvm:$ktor_version"
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
implementation "io.ktor:ktor-client-android:$ktor_version"
implementation "io.ktor:ktor-client-gson:$ktor_version"
implementation "io.ktor:ktor-client-auth-jvm:$ktor_version"
implementation "io.ktor:ktor-client-logging-jvm:$ktor_version"
}
Expand Down
3 changes: 2 additions & 1 deletion helios-rewarding-sdk/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wordline.helios.rewarding.sdk">

/
<uses-permission android:name="android.permission.INTERNET" />

</manifest>
Expand Up @@ -6,9 +6,10 @@ import com.wordline.helios.rewarding.sdk.domain.model.Either
import com.wordline.helios.rewarding.sdk.domain.model.Error
import com.wordline.helios.rewarding.sdk.domain.model.Success
import io.ktor.client.HttpClient
import io.ktor.client.engine.android.Android
import io.ktor.client.features.ClientRequestException
import io.ktor.client.features.json.GsonSerializer
import io.ktor.client.features.json.JsonFeature
import io.ktor.client.features.json.serializer.KotlinxSerializer
import io.ktor.client.features.logging.LogLevel
import io.ktor.client.features.logging.Logger
import io.ktor.client.features.logging.Logging
Expand All @@ -25,7 +26,7 @@ class CommonRemoteDataSource(localDataSource: LocalDataSource) : RemoteDataSourc
private const val TOKEN_HEADER = "Authorization"
}

private val client = HttpClient {
private val client = HttpClient(Android) {
// install(Auth) {
// basic {
// username = AUTH_USER
Expand All @@ -39,7 +40,7 @@ class CommonRemoteDataSource(localDataSource: LocalDataSource) : RemoteDataSourc
}

install(JsonFeature) {
serializer = KotlinxSerializer()
serializer = GsonSerializer()
}

install(TokenFeature) {
Expand Down

0 comments on commit 5c11a0d

Please sign in to comment.