fix anilist jsonnull issue (#300)

added chucker to help with debugging stuff
upped retrofit version
This commit is contained in:
Carlos 2020-05-03 13:26:47 -04:00 committed by GitHub
parent e83e67d1b5
commit 41c64b7058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -134,8 +134,13 @@ dependencies {
implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion") implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
implementation("com.squareup.okio:okio:2.6.0") implementation("com.squareup.okio:okio:2.6.0")
//Chucker
val chuckerVersion = "3.2.0"
debugImplementation ("com.github.ChuckerTeam.Chucker:library:$chuckerVersion")
releaseImplementation ("com.github.ChuckerTeam.Chucker:library-no-op:$chuckerVersion")
// REST // REST
val retrofitVersion = "2.7.1" val retrofitVersion = "2.7.2"
implementation("com.squareup.retrofit2:retrofit:$retrofitVersion") implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
implementation("com.squareup.retrofit2:converter-gson:$retrofitVersion") implementation("com.squareup.retrofit2:converter-gson:$retrofitVersion")

View File

@ -182,7 +182,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
struct["coverImage"]["large"].asString, struct["coverImage"]["large"].asString,
struct["description"].nullString.orEmpty(), struct["description"].nullString.orEmpty(),
struct["type"].asString, struct["type"].asString,
struct["status"].asString, struct["status"].nullString.orEmpty(),
date, date,
struct["chapters"].nullInt ?: 0 struct["chapters"].nullInt ?: 0
) )

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.network package eu.kanade.tachiyomi.network
import android.content.Context import android.content.Context
import com.chuckerteam.chucker.api.ChuckerInterceptor
import okhttp3.Cache import okhttp3.Cache
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import java.io.File import java.io.File
@ -16,6 +17,7 @@ class NetworkHelper(context: Context) {
val client = OkHttpClient.Builder() val client = OkHttpClient.Builder()
.cookieJar(cookieManager) .cookieJar(cookieManager)
.cache(Cache(cacheDir, cacheSize)) .cache(Cache(cacheDir, cacheSize))
.addInterceptor(ChuckerInterceptor(context))
.build() .build()
val cloudflareClient = client.newBuilder() val cloudflareClient = client.newBuilder()