Don't assume backup is running when success or error notifications are shown
This commit is contained in:
parent
ef443f70a5
commit
df788ba9a4
2 changed files with 5 additions and 3 deletions
|
@ -79,6 +79,7 @@ internal class SettingsViewModel(
|
|||
}
|
||||
|
||||
internal fun backupNow() {
|
||||
// maybe replace the check below with one that checks if our transport service is running
|
||||
if (notificationManager.hasActiveBackupNotifications()) {
|
||||
Toast.makeText(app, R.string.notification_backup_already_running, LENGTH_LONG).show()
|
||||
} else {
|
||||
|
|
|
@ -207,9 +207,10 @@ internal class BackupNotificationManager(private val context: Context) {
|
|||
|
||||
fun hasActiveBackupNotifications(): Boolean {
|
||||
nm.activeNotifications.forEach {
|
||||
if (it.packageName == context.packageName &&
|
||||
(it.id == NOTIFICATION_ID_OBSERVER || it.id == NOTIFICATION_ID_BACKGROUND)
|
||||
) return true
|
||||
if (it.packageName == context.packageName) {
|
||||
if (it.id == NOTIFICATION_ID_BACKGROUND) return true
|
||||
if (it.id == NOTIFICATION_ID_OBSERVER) return it.isOngoing
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue