Browse Source

fix

Signed-off-by: Marino Faggiana <96728420+MarinoFaggianaAstraIridium@users.noreply.github.com>
Marino Faggiana 2 years ago
parent
commit
4b35ec1913
1 changed files with 6 additions and 7 deletions
  1. 6 7
      iOSClient/Main/NCActionCenter.swift

+ 6 - 7
iOSClient/Main/NCActionCenter.swift

@@ -71,24 +71,23 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec
         case NCGlobal.shared.selectorLoadFileQuickLook:
             let fileNamePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
             let fileNameTemp = NSTemporaryDirectory() + metadata.fileNameView
-            var isCropEnabled: Bool = true
             if let image = UIImage(contentsOfFile: fileNamePath) {
                 if let data = image.jpegData(compressionQuality: 1) {
                     do {
                         try data.write(to: URL(fileURLWithPath: fileNameTemp))
-                        isCropEnabled = true
                     } catch {
                         return
                     }
                 }
+                let viewerQuickLook = NCViewerQuickLook(with: URL(fileURLWithPath: fileNameTemp), isEditingEnabled: true, isCropEnabled: true, metadata: metadata)
+                let navigationController = UINavigationController(rootViewController: viewerQuickLook)
+                navigationController.modalPresentationStyle = .fullScreen
+                appDelegate.window?.rootViewController?.present(navigationController, animated: true)
             } else {
                 CCUtility.copyFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView), toPath: fileNamePath)
-                isCropEnabled = false
+                let viewerQuickLook = NCViewerQuickLook(with: URL(fileURLWithPath: fileNamePath), isEditingEnabled: true, isCropEnabled: false, metadata: metadata)
+                appDelegate.window?.rootViewController?.present(viewerQuickLook, animated: true)
             }
-            let viewerQuickLook = NCViewerQuickLook(with: URL(fileURLWithPath: fileNameTemp), isEditingEnabled: true, isCropEnabled: isCropEnabled, metadata: metadata)
-            let navigationController = UINavigationController(rootViewController: viewerQuickLook)
-            navigationController.modalPresentationStyle = .fullScreen
-            appDelegate.window?.rootViewController?.present(navigationController, animated: true)
 
         case NCGlobal.shared.selectorLoadFileView:
             guard UIApplication.shared.applicationState == .active else { break }