From c623278d093f4a98ad398a1d6c4b7bb89f5d12c6 Mon Sep 17 00:00:00 2001 From: PabloG02 Date: Wed, 25 Jan 2023 14:26:44 +0100 Subject: [PATCH] Remove @JvmStatic and fix formatting of the changelog --- app/src/main/java/emu/skyline/AppUpdater.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/emu/skyline/AppUpdater.kt b/app/src/main/java/emu/skyline/AppUpdater.kt index 37bf12c3..04a125dd 100644 --- a/app/src/main/java/emu/skyline/AppUpdater.kt +++ b/app/src/main/java/emu/skyline/AppUpdater.kt @@ -77,7 +77,7 @@ class AppUpdater : BroadcastReceiver() { private const val baseUrl = "https://skyline-builds.alula.gay" private const val branch = "ftx1" - @JvmStatic + fun checkForUpdates(applicationContext : Context) { val myHandler = Handler(Looper.getMainLooper()) val builder = AlertDialog.Builder(applicationContext) @@ -91,9 +91,13 @@ class AppUpdater : BroadcastReceiver() { val apkName = newestBuild.get("apkName") val uri = Uri.parse("$baseUrl/cache/${id}/${apkName}") + var changelog = "Changelog

${newestBuild.getJSONObject("commit").getString("message").substringBefore("\n")}

" + if (newestBuild.getJSONObject("commit").getString("message").contains("\n")) + changelog += "

${newestBuild.getJSONObject("commit").getString("message").substringAfter("\n")}

" + myHandler.post { builder.setTitle("New version ${newestBuild.get("runNumber")}") - .setMessage(Html.fromHtml("Changelog

${newestBuild.getJSONObject("commit").getString("message")}

", 0)) + .setMessage(Html.fromHtml(changelog, 0)) .setCancelable(true) .setPositiveButton("Update") { dialogInterface, _ -> val receiver = AppUpdater() @@ -116,7 +120,7 @@ class AppUpdater : BroadcastReceiver() { } } - @JvmStatic + @com.google.android.material.badge.ExperimentalBadgeUtils fun notifyUpdateBadge(context : Context, icon : ImageView) { CoroutineScope(Dispatchers.IO).launch { @@ -135,7 +139,7 @@ class AppUpdater : BroadcastReceiver() { } } - @JvmStatic + fun checkRemoteForUpdates() : JSONObject? { val url = URL("$baseUrl/builds") try {