From 0a6f607e2266219fa793c6e785208560a916491f Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 13 Feb 2020 23:26:06 -0800 Subject: [PATCH] Fixed extensions call running on main thread (cherry picked from commit 2b85bb5fb816c531982a1878e55fd88814452a2c) --- .../eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt index ce9bf7865..d8e64edf3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt @@ -10,6 +10,8 @@ import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.NetworkHelper import eu.kanade.tachiyomi.network.await +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import okhttp3.Response import uy.kohesive.injekt.injectLazy @@ -22,7 +24,9 @@ internal class ExtensionGithubApi { suspend fun findExtensions(): List { val call = GET("$REPO_URL/index.json") - return parseResponse(network.client.newCall(call).await()) + return withContext(Dispatchers.IO) { + parseResponse(network.client.newCall(call).await()) + } } private fun parseResponse(response: Response): List {