Ver Fonte

Add dismissAll notification

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk há 1 ano atrás
pai
commit
3ccec8e5fd

+ 5 - 1
app/src/main/java/com/nextcloud/client/files/downloader/DownloadNotificationManager.kt

@@ -28,6 +28,8 @@ import android.content.Context
 import android.content.Intent
 import android.graphics.BitmapFactory
 import android.os.Build
+import android.os.Handler
+import android.os.Looper
 import androidx.core.app.NotificationCompat
 import com.nextcloud.client.account.User
 import com.owncloud.android.R
@@ -197,7 +199,9 @@ class DownloadNotificationManager(private val context: Context, private val view
     }
 
     fun dismissAll() {
-        notificationManager.cancelAll()
+        Handler(Looper.getMainLooper()).postDelayed({
+            notificationManager.cancelAll()
+        }, 2000)
     }
 
     fun setCredentialContentIntent(user: User) {

+ 1 - 1
app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadWorker.kt

@@ -123,7 +123,6 @@ class FileDownloadWorker(
             notificationManager.init()
             addAccountUpdateListener()
 
-            setWorkerState(user)
             requestDownloads.forEach {
                 downloadFile(it)
             }
@@ -284,6 +283,7 @@ class FileDownloadWorker(
             return
         }
 
+        setWorkerState(user)
         Log_OC.e(TAG, "FilesDownloadWorker downloading: $downloadKey")
 
         val isAccountExist = accountManager.exists(currentDownload?.user?.toPlatformAccount())