mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-14 13:08:56 +01:00
Refactor response parsing helper function
This commit is contained in:
@@ -5,7 +5,7 @@ import eu.kanade.tachiyomi.data.updater.UpdateResult
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.network.await
|
||||
import eu.kanade.tachiyomi.network.withResponse
|
||||
import eu.kanade.tachiyomi.network.parseAs
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
@@ -27,7 +27,8 @@ class GithubUpdateChecker {
|
||||
networkService.client
|
||||
.newCall(GET("https://api.github.com/repos/$repo/releases/latest"))
|
||||
.await()
|
||||
.withResponse<GithubRelease, UpdateResult> {
|
||||
.parseAs<GithubRelease>()
|
||||
.let {
|
||||
// Check if latest version is different from current version
|
||||
if (isNewVersion(it.version)) {
|
||||
GithubUpdateResult.NewUpdate(it)
|
||||
|
||||
Reference in New Issue
Block a user