From a80b7b795b2b64a04c46eedae9e27cbb40acc82e Mon Sep 17 00:00:00 2001 From: Pavel Mosein Date: Sat, 2 May 2020 16:33:22 +0300 Subject: [PATCH] Fix shikimori auth --- .../kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 42d24b51c8..37aa9a26ad 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,6 +13,7 @@ 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 @@ -128,8 +129,9 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter } } - fun getCurrentUser(): Int { - val user = authClient.newCall(GET("$apiUrl/users/whoami")).execute().body?.string() + 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 }