Browse Source

Fix cancel and isDownloading

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 1 year ago
parent
commit
2a0b754449

+ 5 - 4
app/src/main/java/com/nextcloud/client/files/downloader/FileDownloadHelper.kt

@@ -60,10 +60,11 @@ class FileDownloadHelper {
             return false
         }
 
-        return FileDownloadWorker.isDownloading(user.accountName, file.fileId) ||
-            FileDownloadWorker.isDownloading(user.accountName, file.parentId) ||
-            backgroundJobManager.isStartFileDownloadJobScheduled(user, file.fileId) ||
-            backgroundJobManager.isStartFileDownloadJobScheduled(user, file.parentId)
+        return if (file.isFolder) {
+            backgroundJobManager.isStartFileDownloadJobScheduled(user, file.fileId)
+        } else {
+            FileDownloadWorker.isDownloading(user.accountName, file.fileId)
+        }
     }
 
     fun cancelPendingOrCurrentDownloads(user: User?, files: List<OCFile>?) {