Browse Source

Improvements downloadpreview

Marino Faggiana 6 years ago
parent
commit
6288ec300f
3 changed files with 7 additions and 7 deletions
  1. 5 2
      iOSClient/Media/CCMedia.m
  2. 0 2
      iOSClient/PeekPop/CCPeekPop.m
  3. 2 3
      iOSClient/Trash/NCTrash.swift

+ 5 - 2
iOSClient/Media/CCMedia.m

@@ -607,8 +607,11 @@
     [[OCNetworking sharedManager] downloadPreviewWithAccount:appDelegate.activeAccount metadata:metadata withWidth:width andHeight:height completion:^(NSString *account, UIImage *image, NSString *message, NSInteger errorCode) {
         
         counterThumbnail--;
-        if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount] && [[NSFileManager defaultManager] fileExistsAtPath:[CCUtility getDirectoryProviderStorageIconFileID:metadata.fileID fileNameView:metadata.fileNameView]] && [self indexPathIsValid:indexPath] && !collectionViewReloadDataInProgress) {
-            [self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
+        
+        if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
+            UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
+            UIImageView *imageView = (UIImageView *)[cell viewWithTag:100];
+            imageView.image = image;
         }
     }];
 }

+ 0 - 2
iOSClient/PeekPop/CCPeekPop.m

@@ -102,8 +102,6 @@
      
         if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
             
-            UIImage *image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", [CCUtility getDirectoryProviderStorageFileID:_metadata.fileID], _metadata.fileNameView]];
-            
             _imagePreview.image = image;
             _imagePreview.contentMode = UIViewContentModeScaleToFill;
             

+ 2 - 3
iOSClient/Trash/NCTrash.swift

@@ -556,11 +556,10 @@ class NCTrash: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
             
             if errorCode == 0 && account == self.appDelegate.activeAccount {
                 if let cell = self.collectionView.cellForItem(at: indexPath) {
-                    if self.collectionView.collectionViewLayout == self.listLayout {
+                    if cell is NCTrashListCell {
                         (cell as! NCTrashListCell).imageItem.image = image
-                    } else {
+                    } else if cell is NCGridCell {
                         (cell as! NCGridCell).imageItem.image = image
-
                     }
                 }
             }