From 40a0094ec0fa69309f904937360edf6f7983fbb9 Mon Sep 17 00:00:00 2001 From: Pavka Date: Fri, 8 May 2020 00:03:21 +0300 Subject: [PATCH] Fix shikimori auth. Change await to withContext(Dispatchers.IO) (#354) Co-authored-by: Pavel Mosein --- .../kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt index 37aa9a26ad..378ac7dc4b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt @@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.model.TrackSearch import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.POST -import eu.kanade.tachiyomi.network.await import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import okhttp3.FormBody @@ -130,9 +129,10 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter } suspend fun getCurrentUser(): Int { - val response = authClient.newCall(GET("$apiUrl/users/whoami")).await() - val user = response.body?.string() - return JsonParser.parseString(user).obj["id"].asInt + return withContext(Dispatchers.IO) { + val user = authClient.newCall(GET("$apiUrl/users/whoami")).execute().body?.string() + JsonParser.parseString(user).obj["id"].asInt + } } suspend fun accessToken(code: String): OAuth {