Skip to content

Commit

Permalink
Use own notification ID for success notification
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
grote committed Feb 2, 2024
1 parent a4e5768 commit 76ddd45
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 76ddd45

Please sign in to comment.