marinofaggiana 4 jaren geleden
bovenliggende
commit
51cece6f70

+ 9 - 0
iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift

@@ -281,6 +281,15 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
             guard let metadataAlreadyExists = NCUtility.sharedInstance.getMetadataConflict(account: metadataNewFile.account, serverUrl: metadataNewFile.serverUrl, fileName: metadataNewFile.fileNameView) else { return UITableViewCell() }
             if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView)) {
                 cell.imageAlreadyExistingFile.image =  UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView))
+            } else if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView)) && metadataAlreadyExists.contentType == "application/pdf" {
+            
+                let url = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView))
+                if let image = NCUtility.sharedInstance.pdfThumbnail(url: url) {
+                    cell.imageAlreadyExistingFile.image = image
+                } else {
+                    cell.imageAlreadyExistingFile.image = UIImage.init(named: metadataAlreadyExists.iconName)
+                }
+            
             } else {
                 if metadataAlreadyExists.iconName.count > 0 {
                     cell.imageAlreadyExistingFile.image = UIImage.init(named: metadataAlreadyExists.iconName)

+ 5 - 0
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -24,6 +24,7 @@
 
 import Foundation
 import WeScan
+import NCCommunication
 
 #if GOOGLEMOBILEVISION
 import GoogleMobileVision
@@ -418,6 +419,10 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
         metadataForUpload.session = k_upload_session
         metadataForUpload.sessionSelector = selectorUploadFile
         metadataForUpload.status = Int(k_metadataStatusWaitUpload)
+        let results = NCCommunicationCommon.sharedInstance.getInternalContenType(fileName: fileNameSave, contentType: "", directory: false)
+        metadataForUpload.contentType = results.contentType
+        metadataForUpload.iconName = results.iconName
+        metadataForUpload.typeFile = results.typeFile
                 
         if NCUtility.sharedInstance.getMetadataConflict(account: appDelegate.activeAccount, serverUrl: serverUrl, fileName: fileNameSave) != nil {