Browse Source

IMprovements downloadpreview

Marino Faggiana 6 years ago
parent
commit
1d1c35fed5
1 changed files with 7 additions and 1 deletions
  1. 7 1
      iOSClient/Main/NCMainCommon.swift

+ 7 - 1
iOSClient/Main/NCMainCommon.swift

@@ -1230,15 +1230,21 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
     @objc func downloadThumbnail(with metadata: tableMetadata, view: Any, indexPath: IndexPath) {
         
         if metadata.hasPreview == 1 && (!CCUtility.fileProviderStorageIconExists(metadata.fileID, fileNameView: metadata.fileName) || metadata.typeFile == k_metadataTypeFile_document) {
+            
             let width = NCUtility.sharedInstance.getScreenWidthForPreview()
             let height = NCUtility.sharedInstance.getScreenHeightForPreview()
             
             OCNetworking.sharedManager().downloadPreview(withAccount: appDelegate.activeAccount, metadata: metadata, withWidth: width, andHeight: height, completion: { (account, image, message, errorCode) in
+                
                 if errorCode == 0 && account == self.appDelegate.activeAccount {
                     if CCUtility.fileProviderStorageIconExists(metadata.fileID, fileNameView: metadata.fileName) {
                         if view is UICollectionView && NCMainCommon.sharedInstance.isValidIndexPath(indexPath, view: view) {
                             if let cell = (view as! UICollectionView).cellForItem(at: indexPath) {
-                                (cell as! NCListCell).imageItem.image = image
+                                if cell is NCListCell {
+                                    (cell as! NCListCell).imageItem.image = image
+                                } else if cell is NCGridCell {
+                                    (cell as! NCGridCell).imageItem.image = image
+                                }
                             }
                         }
                         if view is UITableView && CCUtility.fileProviderStorageIconExists(metadata.fileID, fileNameView: metadata.fileName) && NCMainCommon.sharedInstance.isValidIndexPath(indexPath, view: view) {