mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 11:17:48 +01:00
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.
This commit is contained in:
parent
a83a481ac8
commit
2ca6b655ad
2 changed files with 14 additions and 6 deletions
|
@ -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"
|
||||
|
|
|
@ -758,7 +758,7 @@
|
|||
|
||||
<!--UpdateCheck-->
|
||||
<string name="update_check_confirm">Download</string>
|
||||
<string name="update_check_ignore">Ignore</string>
|
||||
<string name="update_check_open">Open on GitHub</string>
|
||||
<string name="update_check_eol">This Android version is no longer supported</string>
|
||||
<string name="update_check_no_new_updates">No new updates available</string>
|
||||
<string name="update_check_look_for_updates">Searching for updates…</string>
|
||||
|
|
Loading…
Reference in a new issue