marinofaggiana 4 жил өмнө
parent
commit
f00aeacaa6

+ 8 - 0
iOSClient/Networking/NCOperationQueue.swift

@@ -64,6 +64,14 @@ import NCCommunication
     @objc func downloadCount() -> Int {
     @objc func downloadCount() -> Int {
         return downloadQueue.operationCount
         return downloadQueue.operationCount
     }
     }
+    @objc func downloadExists(metadata: tableMetadata) -> Bool {
+        for operation in downloadQueue.operations as! [NCOperationDownload]  {
+            if operation.metadata.ocId == metadata.ocId {
+                return true
+            }
+        }
+        return false
+    }
     
     
     // Delete file
     // Delete file
     
     

+ 5 - 1
iOSClient/Viewer/NCViewerImage/NCViewerImagePageContainer.swift

@@ -234,9 +234,13 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
         
         
         navigationItem.title = metadata.fileNameView
         navigationItem.title = metadata.fileNameView
         
         
+        if !NCOperationQueue.shared.downloadExists(metadata: metadata) {
+            self.progressView.progress = 0
+        }
+        
         let ext = CCUtility.getExtension(metadata.fileNameView)
         let ext = CCUtility.getExtension(metadata.fileNameView)
         if ((metadata.contentType == "image/heic" &&  metadata.hasPreview == false) || ext == "GIF" || ext == "SVG") && metadata.session == "" && CCUtility.fileProviderStorageSize(metadata.ocId, fileNameView: metadata.fileNameView) == 0 {
         if ((metadata.contentType == "image/heic" &&  metadata.hasPreview == false) || ext == "GIF" || ext == "SVG") && metadata.session == "" && CCUtility.fileProviderStorageSize(metadata.ocId, fileNameView: metadata.fileNameView) == 0 {
-            NCNetworking.shared.download(metadata: metadata, selector: "") { (_) in }
+            NCOperationQueue.shared.download(metadata: metadata, selector: "", setFavorite: false)
         }
         }
         
         
         if !CCUtility.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) && metadata.hasPreview {
         if !CCUtility.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) && metadata.hasPreview {