diff --git a/build.gradle b/build.gradle index dd4a9b6..3cda710 100644 --- a/build.gradle +++ b/build.gradle @@ -6,8 +6,8 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21' + classpath 'com.android.tools.build:gradle:8.2.2' + classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 74f8d5a..9cd3f5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,3 +21,6 @@ android.enableJetifier=true kotlin.code.style=official -Dorg.gradle.warning.mode=all +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c68..15de902 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/lib/build.gradle b/lib/build.gradle index f94b960..ddc623b 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -6,11 +6,11 @@ plugins { } android { - compileSdk 31 + compileSdk 33 defaultConfig { minSdk 21 - targetSdk 31 + targetSdk 33 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -37,7 +37,7 @@ android { namespace 'com.telemetrydeck.sdk' } -def ktor_version = '1.6.7' +def ktor_version = '2.3.7' def logback_version = '1.2.10' def kotlinx_coroutines_version = '1.6.0' dependencies { @@ -50,8 +50,10 @@ dependencies { implementation "io.ktor:ktor-client-cio:$ktor_version" // HTTP Serialization implementation "io.ktor:ktor-client-serialization:$ktor_version" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-properties:1.3.2" - implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2" + implementation "io.ktor:ktor-client-content-negotiation:$ktor_version" + implementation "io.ktor:ktor-serialization-kotlinx-json:$ktor_version" + implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1" + implementation "org.jetbrains.kotlinx:kotlinx-serialization-properties:1.5.1" // HTTP Logging implementation "ch.qos.logback:logback-classic:$logback_version" implementation "io.ktor:ktor-client-logging:$ktor_version" diff --git a/lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt b/lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt index 4a32005..04b1f2e 100644 --- a/lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt +++ b/lib/src/main/java/com/telemetrydeck/sdk/TelemetryClient.kt @@ -2,12 +2,15 @@ package com.telemetrydeck.sdk import io.ktor.client.* import io.ktor.client.engine.cio.* -import io.ktor.client.features.* -import io.ktor.client.features.json.* -import io.ktor.client.features.logging.* +import io.ktor.client.plugins.DefaultRequest +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.client.plugins.logging.DEFAULT +import io.ktor.client.plugins.logging.LogLevel +import io.ktor.client.plugins.logging.Logger +import io.ktor.client.plugins.logging.Logging import io.ktor.client.request.* -import io.ktor.client.statement.* import io.ktor.http.* +import io.ktor.serialization.kotlinx.json.json import java.net.URL import java.util.* @@ -16,7 +19,9 @@ import java.util.* */ internal class TelemetryClient(private val telemetryAppID: UUID, private val apiBaseURL: URL, private val showDebugLogs: Boolean, private val debugLogger: DebugLogger?) { private val client: HttpClient = HttpClient(CIO) { - install(JsonFeature) + install(ContentNegotiation) { + json() + } if (showDebugLogs && debugLogger != null) { install(Logging) { logger = Logger.DEFAULT @@ -32,10 +37,8 @@ internal class TelemetryClient(private val telemetryAppID: UUID, private val api suspend fun send( signals: List ) { - val response: HttpResponse = client.request { - method = HttpMethod.Post - url(getServiceUrl()) - body = signals + val response = client.post(getServiceUrl()) { + setBody(signals) } println(response.status) client.close()