marinofaggiana 4 years ago
parent
commit
41af49dcde
2 changed files with 11 additions and 0 deletions
  1. 10 0
      iOSClient/Networking/NCOperationQueue.swift
  2. 1 0
      iOSClient/Settings/CCAdvanced.m

+ 10 - 0
iOSClient/Networking/NCOperationQueue.swift

@@ -37,6 +37,13 @@ import NCCommunication
     private let downloadThumbnailQueue = Queuer(name: "downloadThumbnailQueue", maxConcurrentOperationCount: 10, qualityOfService: .default)
     private let removeDeletedFileQueue = Queuer(name: "removeDeletedFileQueue", maxConcurrentOperationCount: 10, qualityOfService: .default)
 
+    @objc func cancelAllQueue() {
+        downloadCancelAll()
+        readFolderSyncCancelAll()
+        downloadThumbnailCancelAll()
+        removeDeletedFileCancelAll()
+    }
+    
     // Download file
     @objc func download(metadata: tableMetadata, selector: String, setFavorite: Bool) {
         downloadQueue.addOperation(NCOperationDownload.init(metadata: metadata, selector: selector, setFavorite: setFavorite))
@@ -78,6 +85,9 @@ import NCCommunication
         }
         removeDeletedFileQueue.addOperation(NCOperationRemoveDeletedFileQueue.init(metadata: metadata))
     }
+    @objc func removeDeletedFileCancelAll() {
+        removeDeletedFileQueue.cancelAll()
+    }
 }
 
 //MARK: -

+ 1 - 0
iOSClient/Settings/CCAdvanced.m

@@ -231,6 +231,7 @@
     [appDelegate maintenanceMode:YES];
     
     [[NCMainCommon sharedInstance] cancelAllTransfer];
+    [[NCOperationQueue shared] cancelAllQueue];
 
     [[NSURLCache sharedURLCache] setMemoryCapacity:0];
     [[NSURLCache sharedURLCache] setDiskCapacity:0];