mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Clean up OkHttp methods and parse from Okio directly (#8238)
This commit is contained in:
		| @@ -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 | ||||
|                 } | ||||
|             } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user