Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaType.get(s) -> s.toMediaType() #41

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ dependencies {
implementation(libs.mavericks.compose)
implementation(libs.navigation.compose.core)
implementation(libs.navigation.compose.ktx)
implementation(libs.okhttp)
implementation(libs.retrofit.core)
implementation(libs.retrofit.serialization)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.emergetools.hackernews.network
import com.emergetools.hackernews.network.models.Item
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import kotlinx.serialization.json.Json
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaType
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.http.Path
Expand All @@ -12,7 +12,7 @@ private const val HN_BASE_URL = "https://hacker-news.firebaseio.com/v0/"

private val retrofit = Retrofit.Builder()
.baseUrl(HN_BASE_URL)
.addConverterFactory(Json.asConverterFactory(MediaType.get("application/json")))
.addConverterFactory(Json.asConverterFactory("application/json".toMediaType()))
.build()

interface HNApiService {
Expand Down
4 changes: 4 additions & 0 deletions android/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ kotlin = "1.9.10"
ksp = "1.9.10-1.0.13"
material-compose = "1.6.3"
navigation-compose = "2.7.7"
okhttp = "4.11.0"

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
Expand Down Expand Up @@ -58,5 +59,8 @@ mavericks-compose = "com.airbnb.android:mavericks-compose:2.7.0"
navigation-compose-core = { module = "androidx.navigation:navigation-compose", version.ref = "navigation-compose" }
navigation-compose-ktx = { module = "androidx.navigation:navigation-runtime-ktx", version.ref = "navigation-compose" }

okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }

retrofit-core = "com.squareup.retrofit2:retrofit:2.9.0"
retrofit-serialization = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"

Loading