From be332e7565c219068c92bf8878250fa85692cb99 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 5 Jan 2024 11:33:23 +0100 Subject: [PATCH] Add dismissAll notification Signed-off-by: alperozturk --- .../client/files/downloader/DownloadNotificationManager.kt | 6 +++++- .../nextcloud/client/files/downloader/FileDownloadWorker.kt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/DownloadNotificationManager.kt b/app/src/main/java/com/nextcloud/client/files/downloader/DownloadNotificationManager.kt index 176bd9ac719f..83917d883a37 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/DownloadNotificationManager.kt +++ b/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) { diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadWorker.kt b/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadWorker.kt index f38273488f55..297d465c2bab 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadWorker.kt +++ b/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())