From e07e043ab972ceeea2c7af28ababd9ff5aa771f2 Mon Sep 17 00:00:00 2001
From: Torsten Grote <t@grobox.de>
Date: Wed, 3 Jul 2024 11:25:03 -0300
Subject: [PATCH] Only show progress notification for successful backup

---
 .../seedvault/ui/notification/NotificationBackupObserver.kt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/notification/NotificationBackupObserver.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/notification/NotificationBackupObserver.kt
index d45dca91..0325d03b 100644
--- a/app/src/main/java/com/stevesoltys/seedvault/ui/notification/NotificationBackupObserver.kt
+++ b/app/src/main/java/com/stevesoltys/seedvault/ui/notification/NotificationBackupObserver.kt
@@ -108,8 +108,10 @@ internal class NotificationBackupObserver(
             null // To not disable apps by mistake, we reset it when getting a new non-error result.
         }
 
-        // often [onResult] gets called right away without any [onUpdate] call
-        showProgressNotification(target)
+        // Often [onResult] gets called right away without any [onUpdate] call,
+        // so we show progress notification here as well.
+        // However, only do it on success, to prevent a race causing stuck notifications
+        if (status == 0) showProgressNotification(target)
     }
 
     /**