diff --git a/app/src/main/java/com/hippo/ehviewer/ui/settings/AboutScreen.kt b/app/src/main/java/com/hippo/ehviewer/ui/settings/AboutScreen.kt index 8916e1f4c..726208cf1 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/settings/AboutScreen.kt +++ b/app/src/main/java/com/hippo/ehviewer/ui/settings/AboutScreen.kt @@ -104,15 +104,15 @@ fun AboutScreen() { val branchUrl = "$API_URL/branches/$branch" val commitSha = ehRequest(branchUrl).execute { JSONObject(body.string()).getJSONObject("commit").getString("sha") - }.take(7) - if (commitSha != curSha) launchSnackBar(commitSha) - val workflowUrl = ehRequest("$API_URL/actions/workflows").execute { - val r = JSONObject(body.string()).getJSONArray("workflows").iter().find { - it.getString("name") == "CI" + } + if (commitSha.take(7) != curSha) launchSnackBar(commitSha) + val archiveUrl = ehRequest("$API_URL/actions/artifacts").execute { + JSONObject(body.string()).getJSONArray("artifacts").iter().find { + val wf = it.getJSONObject("workflow_run") + it.getString("name").startsWith("arm64-v8a") && wf.getString("head_sha") == commitSha } - requireNotNull(r) { "No CI workflow found!!!" } - }.getString("url") - launchSnackBar(workflowUrl) + }?.getString("archive_download_url") + launchSnackBar(archiveUrl ?: "CI is still running, please wait") } else { val curVersion = BuildConfig.VERSION_NAME val releaseUrl = "$API_URL/releases" diff --git a/app/src/main/java/com/hippo/ehviewer/util/JSONUtils.kt b/app/src/main/java/com/hippo/ehviewer/util/JSONUtils.kt index 36aaee6cd..a43442d51 100644 --- a/app/src/main/java/com/hippo/ehviewer/util/JSONUtils.kt +++ b/app/src/main/java/com/hippo/ehviewer/util/JSONUtils.kt @@ -8,6 +8,6 @@ fun JSONArray.iter() = object : Iterable { override fun hasNext() = index != length() @Suppress("UNCHECKED_CAST") - override fun next() = get(index) as T + override fun next() = get(index++) as T } }