Refactor: Migrate from Retrofit to Ktor

This commit migrates the network layer from Retrofit to Ktor.

Specific changes include:

- Replaced Retrofit
 with Ktor for network requests.
- Updated dependencies to include Ktor libraries.
- Refactored network service and data classes to use Ktor's API.
- Removed Retrofit-specific code and dependencies.
- Adjusted network module to provide Ktor client and services.
- Updated PixabayImageRepository
 to use the new Ktor-based PixabayService.
This commit is contained in:
2024-08-10 19:05:20 +02:00
parent aab5f5e0de
commit 5c0a31d648
14 changed files with 114 additions and 68 deletions

View File

@ -1,7 +1,7 @@
[versions]
androidxNavigation = "2.7.7"
androidGradlePlugin = "8.1.4"
agp = "8.6.0-beta02"
agp = "8.6.0-rc01"
coilCompose = "2.6.0"
composeCompiler = "1.5.14"
kotlin = "1.9.24"
@ -15,13 +15,13 @@ androidxLifecycle = "2.8.3"
activityCompose = "1.9.0"
composeBom = "2024.06.00"
kotlinxSerializationJson = "1.6.0"
ktor = "2.3.12"
okhttpBom = "4.12.0"
pagingCompose = "3.3.0"
retrofit2KotlinxSerializationConverter = "1.0.0"
room = "2.6.1"
slf4jAndroid = "1.7.36"
timber = "5.0.1"
hilt = "2.51.1"
retrofit = "2.11.0"
ksp = "1.9.24-1.0.20"
[libraries]
@ -52,14 +52,18 @@ androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-man
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
ktor-client-android = { group = "io.ktor", name = "ktor-client-android", version.ref = "ktor" }
ktor-client-resources = { group = "io.ktor", name = "ktor-client-resources", version.ref = "ktor" }
ktor-client-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" }
ktor-client-logging = { group = "io.ktor", name = "ktor-client-logging", version.ref = "ktor" }
ktor-serialization-kotlinx-json = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" }
logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor" }
okhttp = { module = "com.squareup.okhttp3:okhttp" }
okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttpBom" }
retrofit2-kotlinx-serialization-converter = { module = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter", version.ref = "retrofit2KotlinxSerializationConverter" }
slf4j-android = { module = "org.slf4j:slf4j-android", version.ref = "slf4jAndroid" }
timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" }
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }