mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Migrate to kotlinx.serialization for extensions and update fetching
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package eu.kanade.tachiyomi.data.updater.github
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import eu.kanade.tachiyomi.data.updater.Release
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* Release object.
|
||||
@@ -11,10 +12,11 @@ import eu.kanade.tachiyomi.data.updater.Release
|
||||
* @param info log of latest release.
|
||||
* @param assets assets of latest release.
|
||||
*/
|
||||
@Serializable
|
||||
class GithubRelease(
|
||||
@SerializedName("tag_name") val version: String,
|
||||
@SerializedName("body") override val info: String,
|
||||
@SerializedName("assets") private val assets: List<Assets>
|
||||
@SerialName("tag_name") val version: String,
|
||||
@SerialName("body") override val info: String,
|
||||
@SerialName("assets") private val assets: List<Assets>
|
||||
) : Release {
|
||||
|
||||
/**
|
||||
@@ -28,5 +30,6 @@ class GithubRelease(
|
||||
* Assets class containing download url.
|
||||
* @param downloadLink download url.
|
||||
*/
|
||||
class Assets(@SerializedName("browser_download_url") val downloadLink: String)
|
||||
@Serializable
|
||||
class Assets(@SerialName("browser_download_url") val downloadLink: String)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package eu.kanade.tachiyomi.data.updater.github
|
||||
|
||||
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Path
|
||||
import uy.kohesive.injekt.Injekt
|
||||
@@ -17,7 +19,7 @@ interface GithubService {
|
||||
fun create(): GithubService {
|
||||
val restAdapter = Retrofit.Builder()
|
||||
.baseUrl("https://api.github.com")
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(Json { ignoreUnknownKeys = true }.asConverterFactory("application/json".toMediaType()))
|
||||
.client(Injekt.get<NetworkHelper>().client)
|
||||
.build()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user