|
@@ -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) {
|