Don't allow swiping away app update install notification

Also show the new version number in the notifications.
This commit is contained in:
arkon
2022-05-07 11:04:55 -04:00
parent 39c0b74250
commit 85ef40d0ff
4 changed files with 8 additions and 3 deletions

View File

@@ -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(

View File

@@ -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)