From 2ca6b655ad7d55856d9c0723fd42d009b29c6bd5 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 18 Apr 2022 22:45:58 -0400 Subject: [PATCH] Replace ignore button in new update dialog with link to GitHub page Not enough room for 3 buttons. Users can still tap outside or back out of the dialog if they want to ignore it. --- .../ui/more/NewUpdateDialogController.kt | 18 +++++++++++++----- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/NewUpdateDialogController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/NewUpdateDialogController.kt index 0961313969..328b959f0b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/NewUpdateDialogController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/NewUpdateDialogController.kt @@ -8,16 +8,21 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.updater.AppUpdateResult import eu.kanade.tachiyomi.data.updater.AppUpdateService import eu.kanade.tachiyomi.ui.base.controller.DialogController +import eu.kanade.tachiyomi.ui.base.controller.openInBrowser import io.noties.markwon.Markwon class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundle) { constructor(update: AppUpdateResult.NewUpdate) : this( - bundleOf(BODY_KEY to update.release.info, URL_KEY to update.release.getDownloadLink()), + bundleOf( + BODY_KEY to update.release.info, + RELEASE_URL_KEY to update.release.releaseLink, + DOWNLOAD_URL_KEY to update.release.getDownloadLink(), + ), ) override fun onCreateDialog(savedViewState: Bundle?): Dialog { - val releaseBody = (args.getString(BODY_KEY) ?: "") + val releaseBody = args.getString(BODY_KEY)!! .replace("""---(\R|.)*Checksums(\R|.)*""".toRegex(), "") val info = Markwon.create(activity!!).toMarkdown(releaseBody) @@ -27,14 +32,17 @@ class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundl .setPositiveButton(R.string.update_check_confirm) { _, _ -> applicationContext?.let { context -> // Start download - val url = args.getString(URL_KEY) ?: "" + val url = args.getString(DOWNLOAD_URL_KEY)!! AppUpdateService.start(context, url) } } - .setNegativeButton(R.string.update_check_ignore, null) + .setNeutralButton(R.string.update_check_open) { _, _ -> + openInBrowser(args.getString(RELEASE_URL_KEY)!!) + } .create() } } private const val BODY_KEY = "NewUpdateDialogController.body" -private const val URL_KEY = "NewUpdateDialogController.key" +private const val RELEASE_URL_KEY = "NewUpdateDialogController.release_url" +private const val DOWNLOAD_URL_KEY = "NewUpdateDialogController.download_url" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 19fca94e60..96c5c276fc 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -758,7 +758,7 @@ Download - Ignore + Open on GitHub This Android version is no longer supported No new updates available Searching for updates…