diff --git a/pillarbox-core-business/build.gradle.kts b/pillarbox-core-business/build.gradle.kts index 5daad1dbc..ac29f6746 100644 --- a/pillarbox-core-business/build.gradle.kts +++ b/pillarbox-core-business/build.gradle.kts @@ -32,15 +32,11 @@ dependencies { api(libs.kotlinx.datetime) api(libs.kotlinx.serialization.core) implementation(libs.kotlinx.serialization.json) - implementation(libs.ktor.client.content.negotiation) api(libs.ktor.client.core) implementation(libs.ktor.client.okhttp) implementation(libs.ktor.http) - implementation(libs.ktor.serialization) implementation(libs.ktor.serialization.kotlinx.json) implementation(libs.ktor.utils) - implementation(libs.okhttp) - implementation(libs.okhttp.logging.interceptor) api(libs.tagcommander.core) testImplementation(project(":pillarbox-player-testutils")) diff --git a/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/integrationlayer/service/DefaultHttpClient.kt b/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/integrationlayer/service/DefaultHttpClient.kt deleted file mode 100644 index 115505b1f..000000000 --- a/pillarbox-core-business/src/main/java/ch/srgssr/pillarbox/core/business/integrationlayer/service/DefaultHttpClient.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) SRG SSR. All rights reserved. - * License information is available from the LICENSE file. - */ -package ch.srgssr.pillarbox.core.business.integrationlayer.service - -import ch.srgssr.pillarbox.player.network.PillarboxHttpClient -import io.ktor.client.HttpClient -import io.ktor.client.engine.okhttp.OkHttp -import io.ktor.client.plugins.cache.HttpCache -import io.ktor.client.plugins.contentnegotiation.ContentNegotiation -import io.ktor.serialization.kotlinx.json.json -import kotlinx.serialization.json.ClassDiscriminatorMode -import kotlinx.serialization.json.Json -import okhttp3.logging.HttpLoggingInterceptor - -/** - * Default Ktor [HttpClient]. - * - * This class is deprecated in favor of [PillarboxHttpClient]. - * The latter provides a similar setup as this class, with the following differences: - * - `classDiscriminatorMode` set to [ClassDiscriminatorMode.NONE]: don't include class name in the JSON output for polymorphic classes. - * - `explicitNulls` set to `false`: don't include `null` fields in the JSON output. - * - Logging is set to `BODY` in debug, and `NONE otherwise. - */ -@Deprecated( - message = "Use `PillarboxHttpClient` instead.", - replaceWith = ReplaceWith("PillarboxHttpClient", imports = ["ch.srgssr.pillarbox.player.network.PillarboxHttpClient"]), -) -object DefaultHttpClient { - internal val jsonSerializer = Json { - encodeDefaults = true - ignoreUnknownKeys = true - isLenient = true - } - - private val httpClient by lazy { - HttpClient(OkHttp) { - expectSuccess = true - engine { - addInterceptor( - HttpLoggingInterceptor().apply { - setLevel(HttpLoggingInterceptor.Level.HEADERS) - } - ) - } - install(HttpCache) - install(ContentNegotiation) { - json(jsonSerializer) - } - } - } - - /** - * Invoke - * - * @return [httpClient] - */ - operator fun invoke(): HttpClient { - return httpClient - } -} diff --git a/pillarbox-demo/build.gradle.kts b/pillarbox-demo/build.gradle.kts index 49302bbe9..bce69940c 100644 --- a/pillarbox-demo/build.gradle.kts +++ b/pillarbox-demo/build.gradle.kts @@ -89,6 +89,7 @@ dependencies { implementation(libs.guava) implementation(libs.kotlin.stdlib) implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.datetime) implementation(libs.kotlinx.serialization.core) implementation(libs.okhttp) implementation(libs.srg.data)