Clean up OkHttp methods and parse from Okio directly (#8238)

(cherry picked from commit 2d19729869)

# Conflicts:
#	core/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt
This commit is contained in:
stevenyomi
2022-10-19 00:09:23 +08:00
committed by Jobobby04
parent a7c45ab61e
commit a31e8282cb
4 changed files with 22 additions and 17 deletions
@@ -1,17 +1,12 @@
package eu.kanade.tachiyomi.data.track.myanimelist
import eu.kanade.tachiyomi.network.parseAs
import kotlinx.serialization.json.Json
import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.internal.closeQuietly
import uy.kohesive.injekt.injectLazy
import java.io.IOException
class MyAnimeListInterceptor(private val myanimelist: MyAnimeList, private var token: String?) : Interceptor {
private val json: Json by injectLazy()
private var oauth: OAuth? = null
override fun intercept(chain: Interceptor.Chain): Response {
@@ -31,7 +26,7 @@ class MyAnimeListInterceptor(private val myanimelist: MyAnimeList, private var t
if (oauthResponse.isSuccessful) {
oauthResponse.parseAs<OAuth>()
} else {
oauthResponse.closeQuietly()
oauthResponse.close()
null
}
}