mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 04:35:05 +01:00
Don't allow swiping away app update install notification
Also show the new version number in the notifications.
This commit is contained in:
parent
39c0b74250
commit
85ef40d0ff
@ -29,6 +29,7 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||
fun promptUpdate(release: GithubRelease) {
|
||||
val intent = Intent(context, AppUpdateService::class.java).apply {
|
||||
putExtra(AppUpdateService.EXTRA_DOWNLOAD_URL, release.getDownloadLink())
|
||||
putExtra(AppUpdateService.EXTRA_DOWNLOAD_TITLE, release.version)
|
||||
}
|
||||
val updateIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
|
||||
@ -116,6 +117,7 @@ internal class AppUpdateNotifier(private val context: Context) {
|
||||
setOnlyAlertOnce(false)
|
||||
setProgress(0, 0, false)
|
||||
setContentIntent(installIntent)
|
||||
setOngoing(true)
|
||||
|
||||
clearActions()
|
||||
addAction(
|
||||
|
@ -147,7 +147,7 @@ class AppUpdateService : Service() {
|
||||
* @param context the application context.
|
||||
* @param url the url to the new update.
|
||||
*/
|
||||
fun start(context: Context, url: String, title: String = context.getString(R.string.app_name)) {
|
||||
fun start(context: Context, url: String, title: String? = context.getString(R.string.app_name)) {
|
||||
if (!isRunning(context)) {
|
||||
val intent = Intent(context, AppUpdateService::class.java).apply {
|
||||
putExtra(EXTRA_DOWNLOAD_TITLE, title)
|
||||
|
@ -19,6 +19,7 @@ class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundl
|
||||
constructor(update: AppUpdateResult.NewUpdate) : this(
|
||||
bundleOf(
|
||||
BODY_KEY to update.release.info,
|
||||
VERSION_KEY to update.release.version,
|
||||
RELEASE_URL_KEY to update.release.releaseLink,
|
||||
DOWNLOAD_URL_KEY to update.release.getDownloadLink(),
|
||||
),
|
||||
@ -36,7 +37,8 @@ class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundl
|
||||
applicationContext?.let { context ->
|
||||
// Start download
|
||||
val url = args.getString(DOWNLOAD_URL_KEY)!!
|
||||
AppUpdateService.start(context, url)
|
||||
val version = args.getString(VERSION_KEY)
|
||||
AppUpdateService.start(context, url, version)
|
||||
}
|
||||
}
|
||||
.setNeutralButton(R.string.update_check_open) { _, _ ->
|
||||
@ -55,5 +57,6 @@ class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundl
|
||||
}
|
||||
|
||||
private const val BODY_KEY = "NewUpdateDialogController.body"
|
||||
private const val VERSION_KEY = "NewUpdateDialogController.version"
|
||||
private const val RELEASE_URL_KEY = "NewUpdateDialogController.release_url"
|
||||
private const val DOWNLOAD_URL_KEY = "NewUpdateDialogController.download_url"
|
||||
|
@ -777,7 +777,7 @@
|
||||
|
||||
<!--UpdateCheck Notifications-->
|
||||
<string name="update_check_notification_download_in_progress">Downloading…</string>
|
||||
<string name="update_check_notification_download_complete">Download complete</string>
|
||||
<string name="update_check_notification_download_complete">Tap to install</string>
|
||||
<string name="update_check_notification_download_error">Download error</string>
|
||||
<string name="update_check_notification_update_available">New version available!</string>
|
||||
<string name="update_check_fdroid_migration_info">A new version is available from the official releases. Tap to learn how to migrate from unofficial F-Droid releases.</string>
|
||||
|
Loading…
Reference in New Issue
Block a user