From a8f844cbbb3ae956dc807451d74e5d71163fe6a0 Mon Sep 17 00:00:00 2001 From: Bohdan Akimenko Date: Fri, 22 Nov 2024 21:26:03 +0200 Subject: [PATCH] Fixing AbstractMethodError --- .../kotlin/com/sdk/growthbook/network/NetworkDispatcher.kt | 2 -- .../commonMain/kotlin/com/sdk/growthbook/GBSDKBuilder.kt | 4 +--- .../kotlin/com/sdk/growthbook/tests/MockNetworkClient.kt | 2 -- NetworkDispatcherKtor/build.gradle.kts | 2 +- .../com/sdk/growthbook/network/GBNetworkDispatcherKtor.kt | 7 +++---- NetworkDispatcherOkHttp/build.gradle.kts | 2 +- .../sdk/growthbook/network/GBNetworkDispatcherOkHttp.kt | 7 +++---- 7 files changed, 9 insertions(+), 17 deletions(-) diff --git a/Core/src/commonMain/kotlin/com/sdk/growthbook/network/NetworkDispatcher.kt b/Core/src/commonMain/kotlin/com/sdk/growthbook/network/NetworkDispatcher.kt index 7266f1bd..8cf7f33e 100644 --- a/Core/src/commonMain/kotlin/com/sdk/growthbook/network/NetworkDispatcher.kt +++ b/Core/src/commonMain/kotlin/com/sdk/growthbook/network/NetworkDispatcher.kt @@ -25,6 +25,4 @@ interface NetworkDispatcher { onSuccess: (String) -> Unit, onError: (Throwable) -> Unit ) - - fun setLoggingEnabled(enabled: Boolean) } diff --git a/GrowthBook/src/commonMain/kotlin/com/sdk/growthbook/GBSDKBuilder.kt b/GrowthBook/src/commonMain/kotlin/com/sdk/growthbook/GBSDKBuilder.kt index c6832a3f..b65a711b 100644 --- a/GrowthBook/src/commonMain/kotlin/com/sdk/growthbook/GBSDKBuilder.kt +++ b/GrowthBook/src/commonMain/kotlin/com/sdk/growthbook/GBSDKBuilder.kt @@ -156,9 +156,7 @@ class GBSDKBuilder( return GrowthBookSDK( gbContext, refreshHandler, - networkDispatcher.apply { - setLoggingEnabled(enableLogging) - } + networkDispatcher, ) } } \ No newline at end of file diff --git a/GrowthBook/src/jvmTest/kotlin/com/sdk/growthbook/tests/MockNetworkClient.kt b/GrowthBook/src/jvmTest/kotlin/com/sdk/growthbook/tests/MockNetworkClient.kt index 1b38fe53..ebe7e120 100644 --- a/GrowthBook/src/jvmTest/kotlin/com/sdk/growthbook/tests/MockNetworkClient.kt +++ b/GrowthBook/src/jvmTest/kotlin/com/sdk/growthbook/tests/MockNetworkClient.kt @@ -49,8 +49,6 @@ class MockNetworkClient( onError(ex) } } - - override fun setLoggingEnabled(enabled: Boolean) = Unit } class MockResponse { diff --git a/NetworkDispatcherKtor/build.gradle.kts b/NetworkDispatcherKtor/build.gradle.kts index 7fd4ba9a..bd6b333c 100644 --- a/NetworkDispatcherKtor/build.gradle.kts +++ b/NetworkDispatcherKtor/build.gradle.kts @@ -9,7 +9,7 @@ plugins { } group = "io.growthbook.sdk" -version = "1.0.2" +version = "1.0.3" kotlin { android { diff --git a/NetworkDispatcherKtor/src/commonMain/kotlin/com/sdk/growthbook/network/GBNetworkDispatcherKtor.kt b/NetworkDispatcherKtor/src/commonMain/kotlin/com/sdk/growthbook/network/GBNetworkDispatcherKtor.kt index afdd6d9b..3a614154 100644 --- a/NetworkDispatcherKtor/src/commonMain/kotlin/com/sdk/growthbook/network/GBNetworkDispatcherKtor.kt +++ b/NetworkDispatcherKtor/src/commonMain/kotlin/com/sdk/growthbook/network/GBNetworkDispatcherKtor.kt @@ -49,12 +49,11 @@ class GBNetworkDispatcherKtor( /** * Ktor http client instance for sending request */ - private val client: HttpClient = createDefaultHttpClient() + private val client: HttpClient = createDefaultHttpClient(), + private var enableLogging: Boolean = false, ) : NetworkDispatcher { - private var enableLogging = false - /** * Function that execute API Call to fetch features */ @@ -161,7 +160,7 @@ class GBNetworkDispatcherKtor( } } - override fun setLoggingEnabled(enabled: Boolean) { + fun setLoggingEnabled(enabled: Boolean) { enableLogging = enabled } diff --git a/NetworkDispatcherOkHttp/build.gradle.kts b/NetworkDispatcherOkHttp/build.gradle.kts index 22e14847..19803a2d 100644 --- a/NetworkDispatcherOkHttp/build.gradle.kts +++ b/NetworkDispatcherOkHttp/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "io.growthbook.sdk" -version = "1.0.1" +version = "1.0.2" kotlin { android { diff --git a/NetworkDispatcherOkHttp/src/commonMain/kotlin/com/sdk/growthbook/network/GBNetworkDispatcherOkHttp.kt b/NetworkDispatcherOkHttp/src/commonMain/kotlin/com/sdk/growthbook/network/GBNetworkDispatcherOkHttp.kt index c7d17b67..5879406b 100644 --- a/NetworkDispatcherOkHttp/src/commonMain/kotlin/com/sdk/growthbook/network/GBNetworkDispatcherOkHttp.kt +++ b/NetworkDispatcherOkHttp/src/commonMain/kotlin/com/sdk/growthbook/network/GBNetworkDispatcherOkHttp.kt @@ -36,12 +36,11 @@ class GBNetworkDispatcherOkHttp( /** * Ktor http client instance for sending request */ - private val client: OkHttpClient = OkHttpClient() + private val client: OkHttpClient = OkHttpClient(), + private var enableLogging: Boolean = false, ) : NetworkDispatcher { - private var enableLogging = false - /** * Function that execute API Call to fetch features */ @@ -152,7 +151,7 @@ class GBNetworkDispatcherOkHttp( } } - override fun setLoggingEnabled(enabled: Boolean) { + fun setLoggingEnabled(enabled: Boolean) { enableLogging = enabled } }