Use own notification ID for success notification
and cancel observer notification when backup is finished. This is because when the success channel is disabled by the user, the observer notification could stick around and would never get removed.
This commit is contained in:
parent
cb9d3c701b
commit
09b7cabd99
1 changed files with 7 additions and 5 deletions
|
@ -33,10 +33,11 @@ private const val CHANNEL_ID_SUCCESS = "NotificationBackupSuccess"
|
|||
private const val CHANNEL_ID_ERROR = "NotificationError"
|
||||
private const val CHANNEL_ID_RESTORE_ERROR = "NotificationRestoreError"
|
||||
private const val NOTIFICATION_ID_OBSERVER = 1
|
||||
private const val NOTIFICATION_ID_ERROR = 2
|
||||
private const val NOTIFICATION_ID_RESTORE_ERROR = 3
|
||||
private const val NOTIFICATION_ID_BACKGROUND = 4
|
||||
private const val NOTIFICATION_ID_NO_MAIN_KEY_ERROR = 5
|
||||
private const val NOTIFICATION_ID_SUCCESS = 2
|
||||
private const val NOTIFICATION_ID_ERROR = 3
|
||||
private const val NOTIFICATION_ID_RESTORE_ERROR = 4
|
||||
private const val NOTIFICATION_ID_BACKGROUND = 5
|
||||
private const val NOTIFICATION_ID_NO_MAIN_KEY_ERROR = 6
|
||||
|
||||
private val TAG = BackupNotificationManager::class.java.simpleName
|
||||
|
||||
|
@ -200,7 +201,8 @@ internal class BackupNotificationManager(private val context: Context) {
|
|||
setProgress(0, 0, false)
|
||||
priority = PRIORITY_LOW
|
||||
}.build()
|
||||
nm.notify(NOTIFICATION_ID_OBSERVER, notification)
|
||||
nm.cancel(NOTIFICATION_ID_OBSERVER)
|
||||
nm.notify(NOTIFICATION_ID_SUCCESS, notification)
|
||||
// reset number of expected apps
|
||||
expectedOptOutApps = null
|
||||
expectedApps = null
|
||||
|
|
Loading…
Reference in a new issue