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.
diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/notification/BackupNotificationManager.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/notification/BackupNotificationManager.kt
index 7466e9b..8308fc2 100644
--- a/app/src/main/java/com/stevesoltys/seedvault/ui/notification/BackupNotificationManager.kt
+++ b/app/src/main/java/com/stevesoltys/seedvault/ui/notification/BackupNotificationManager.kt
@@ -33,10 +33,11 @@
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 @@
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