marinofaggiana 3 жил өмнө
parent
commit
e27f7b1f77

+ 25 - 16
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1453,7 +1453,18 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             cell.imageItem.image = nil
             cell.imageItem.backgroundColor = nil
             
-            cell.progressView.progress = 0.0
+            // Progress
+            var progress: Float = 0.0
+            var totalBytes: Int64 = 0
+            if let progressType = appDelegate.listProgress[metadata.ocId] {
+                progress = progressType.progress
+                totalBytes = progressType.totalBytes
+                cell.progressView.progress = progress
+                cell.progressView.isHidden = false
+            } else {
+                cell.progressView.progress = 0.0
+                cell.progressView.isHidden = true
+            }
             
             if metadata.directory {
                 
@@ -1511,20 +1522,10 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             if appDelegate.account != metadata.account {
                 cell.imageShared.image = NCBrandColor.cacheImages.shared
             }
-                        
-            // Transfer
-            var progress: Float = 0.0
-            var totalBytes: Int64 = 0
-            if let progressType = appDelegate.listProgress[metadata.ocId] {
-                progress = progressType.progress
-                totalBytes = progressType.totalBytes
-            }
+            
             if metadata.status == NCGlobal.shared.metadataStatusInDownload || metadata.status == NCGlobal.shared.metadataStatusDownloading ||  metadata.status >= NCGlobal.shared.metadataStatusTypeUpload {
-                cell.progressView.isHidden = false
                 cell.setButtonMore(named: NCGlobal.shared.buttonMoreStop, image: NCBrandColor.cacheImages.buttonStop)
             } else {
-                cell.progressView.isHidden = true
-                cell.progressView.progress = progress
                 cell.setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCBrandColor.cacheImages.buttonMore)
             }
             
@@ -1619,7 +1620,18 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             cell.imageItem.image = nil
             cell.imageItem.backgroundColor = nil
             
-            cell.progressView.progress = 0.0
+            // Progress
+            var progress: Float = 0.0
+            //var totalBytes: Int64 = 0
+            if let progressType = appDelegate.listProgress[metadata.ocId] {
+                progress = progressType.progress
+                //totalBytes = progressType.totalBytes
+                cell.progressView.progress = progress
+                cell.progressView.isHidden = false
+            } else {
+                cell.progressView.progress = 0.0
+                cell.progressView.isHidden = true
+            }
 
             if metadata.directory {
                 
@@ -1666,11 +1678,8 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             
             // Transfer
             if metadata.status == NCGlobal.shared.metadataStatusInDownload || metadata.status == NCGlobal.shared.metadataStatusDownloading ||  metadata.status >= NCGlobal.shared.metadataStatusTypeUpload {
-                cell.progressView.isHidden = false
                 cell.setButtonMore(named: NCGlobal.shared.buttonMoreStop, image: NCBrandColor.cacheImages.buttonStop)
             } else {
-                cell.progressView.isHidden = true
-                cell.progressView.progress = 0.0
                 cell.setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCBrandColor.cacheImages.buttonMore)
             }
             

+ 1 - 1
iOSClient/Transfers/NCTransfers.swift

@@ -212,10 +212,10 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate  {
         
         if metadata.status == NCGlobal.shared.metadataStatusInDownload || metadata.status == NCGlobal.shared.metadataStatusDownloading ||  metadata.status >= NCGlobal.shared.metadataStatusTypeUpload {
             cell.progressView.isHidden = false
+            cell.progressView.progress = progress
         } else {
             cell.progressView.isHidden = true
         }
-        cell.progressView.progress = progress
         
         // Write status on Label Info
         switch metadata.status {