Переглянути джерело

Add credentials error notification

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 1 рік тому
батько
коміт
6bf72f4a99

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

@@ -120,7 +120,7 @@ class DownloadNotificationManager(
         }, 2000)
     }
 
-    private fun updateNotificationText(text: String) {
+    fun updateNotificationText(text: String) {
         notificationBuilder.run {
             setContentText(text)
             notificationManager.notify(id, this.build())

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

@@ -151,9 +151,9 @@ class FileDownloadWorker(
     override fun onStopped() {
         Log_OC.e(TAG, "FilesDownloadWorker stopped")
 
-        removePendingDownload(currentDownload?.user?.accountName)
-        cancelAllDownloads()
         notificationManager.dismissNotification()
+        cancelAllDownloads()
+        removePendingDownload(currentDownload?.user?.accountName)
         setIdleWorkerState()
 
         super.onStopped()
@@ -419,6 +419,7 @@ class FileDownloadWorker(
             prepareForResult()
 
             if (needsToUpdateCredentials) {
+                updateNotificationText(context.getString(R.string.downloader_download_failed_credentials_error))
                 setContentIntent(
                     intents.credentialContentIntent(download.user),
                     PendingIntent.FLAG_ONE_SHOT or PendingIntent.FLAG_IMMUTABLE