diff options
author | marinofaggiana <marino@marinofaggiana.com> | 2021-01-14 10:13:46 +0300 |
---|---|---|
committer | marinofaggiana <marino@marinofaggiana.com> | 2021-01-14 10:13:46 +0300 |
commit | e9f3556b42589acd8ec58af6b24e38b2518b7697 (patch) | |
tree | 115bd2631fab205f1a8c9e81cfaf43fd9c915882 /iOSClient/Viewer | |
parent | f67d77dddab556672d093e995878580af2e440be (diff) |
fix
Diffstat (limited to 'iOSClient/Viewer')
-rw-r--r-- | iOSClient/Viewer/NCViewerProviderContextMenu.swift | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/iOSClient/Viewer/NCViewerProviderContextMenu.swift b/iOSClient/Viewer/NCViewerProviderContextMenu.swift index bfd9cc7c1..66f903fc9 100644 --- a/iOSClient/Viewer/NCViewerProviderContextMenu.swift +++ b/iOSClient/Viewer/NCViewerProviderContextMenu.swift @@ -49,30 +49,10 @@ class NCViewerProviderContextMenu: UIViewController { imageView.image = UIImage.init(named: metadata.iconName)?.resizeImage(size: CGSize(width: standardSizeWidth, height: standardSizeHeight), isAspectRation: true) - if metadata.hasPreview { - - if CCUtility.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) { - - if let image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)) { - imageView.image = image.resizeImage(size: CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height), isAspectRation: true) - } - - } else { - - let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, account: metadata.account)! - let fileNamePreviewLocalPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)! - let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag) - - NCCommunication.shared.downloadPreview(fileNamePathOrFileId: fileNamePath, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCBrandGlobal.shared.sizePreview, heightPreview: NCBrandGlobal.shared.sizePreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCBrandGlobal.shared.sizeIcon) { (account, imagePreview, imageIcon, errorCode, errorMessage) in - if errorCode == 0 { - if let image = imagePreview { - self.imageView.image = image.resizeImage(size: CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height), isAspectRation: true) - if let size = self.imageView.image?.size { - self.preferredContentSize = size - } - } - } - } + if metadata.hasPreview && CCUtility.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) { + + if let image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)) { + imageView.image = image } } } |