Avoid using global scope where appropriate

Also fixes the crash in tracking when an exception is thrown during a refresh.
This commit is contained in:
arkon
2021-01-08 18:05:51 -05:00
parent 96b8beb9cd
commit 2ffbee3db2
14 changed files with 88 additions and 81 deletions
@@ -6,8 +6,7 @@ import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.network.await
import eu.kanade.tachiyomi.network.parseAs
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import eu.kanade.tachiyomi.util.lang.withIOContext
import uy.kohesive.injekt.injectLazy
class GithubUpdateChecker {
@@ -23,7 +22,7 @@ class GithubUpdateChecker {
}
suspend fun checkForUpdate(): UpdateResult {
return withContext(Dispatchers.IO) {
return withIOContext {
networkService.client
.newCall(GET("https://api.github.com/repos/$repo/releases/latest"))
.await()