Bladeren bron

cleaning

Signed-off-by: Marino Faggiana <8616947+marinofaggiana@users.noreply.github.com>
Marino Faggiana 1 jaar geleden
bovenliggende
commit
fee86eefdc

+ 3 - 1
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -1248,7 +1248,9 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
     func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
     func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
         if !collectionView.indexPathsForVisibleItems.contains(indexPath) {
         if !collectionView.indexPathsForVisibleItems.contains(indexPath) {
             guard let metadata = dataSource.cellForItemAt(indexPath: indexPath) else { return }
             guard let metadata = dataSource.cellForItemAt(indexPath: indexPath) else { return }
-            NCOperationQueue.shared.cancelDownloadThumbnail(metadata: metadata)
+            for case let operation as NCOperationDownloadThumbnail in appDelegate.downloadThumbnailQueue.operations where operation.metadata.ocId == metadata.ocId {
+                operation.cancel()
+            }
         }
         }
     }
     }
 
 

+ 3 - 1
iOSClient/Media/NCMedia.swift

@@ -387,7 +387,9 @@ extension NCMedia: UICollectionViewDataSource {
     func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
     func collectionView(_ collectionView: UICollectionView, didEndDisplaying cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
         if !collectionView.indexPathsForVisibleItems.contains(indexPath) && indexPath.row < metadatas.count {
         if !collectionView.indexPathsForVisibleItems.contains(indexPath) && indexPath.row < metadatas.count {
             let metadata = metadatas[indexPath.row]
             let metadata = metadatas[indexPath.row]
-            NCOperationQueue.shared.cancelDownloadThumbnail(metadata: metadata)
+            for case let operation as NCOperationDownloadThumbnail in appDelegate.downloadThumbnailQueue.operations where operation.metadata.ocId == metadata.ocId {
+                operation.cancel()
+            }
         }
         }
     }
     }
 
 

+ 1 - 5
iOSClient/Networking/NCOperationQueue.swift

@@ -62,11 +62,7 @@ import JGProgressHUD
         }
         }
     }
     }
 
 
-    func cancelDownloadThumbnail(metadata: tableMetadata) {
-        for case let operation as NCOperationDownloadThumbnail in appDelegate.downloadThumbnailQueue.operations where operation.metadata.ocId == metadata.ocId {
-            operation.cancel()
-        }
-    }
+    
 
 
     // MARK: - Download Thumbnail Activity
     // MARK: - Download Thumbnail Activity