Browse Source

new view image

marinofaggiana 4 years ago
parent
commit
7ae3ad0be5
1 changed files with 10 additions and 9 deletions
  1. 10 9
      iOSClient/Viewer/NCViewerImage/NCViewerImagePageContainer.swift

+ 10 - 9
iOSClient/Viewer/NCViewerImage/NCViewerImagePageContainer.swift

@@ -112,7 +112,9 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
         if let userInfo = notification.userInfo as NSDictionary? {
             if let metadata = userInfo["metadata"] as? tableMetadata, let errorCode = userInfo["errorCode"] as? Int {
                 if metadata.ocId == currentViewerImageZoom?.metadata.ocId && errorCode == 0 {
-                    currentViewerImageZoom?.image = getImageMetadata(metadata)
+                    let image = getImageMetadata(metadata)
+                    currentViewerImageZoom?.image = image
+                    currentViewerImageZoom?.imageView.image = image
                 }
                 
                 //progress(0)
@@ -199,9 +201,16 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
     //MARK: - Function
 
     func viewWillAppearImageZoom(viewerImageZoom: NCViewerImageZoom, metadata: tableMetadata) {
+        
         currentMetadata = metadata
         currentViewerImageZoom = viewerImageZoom
+        
         navigationItem.title = metadata.fileNameView
+        
+        let ext = CCUtility.getExtension(metadata.fileNameView)
+        if (ext == "GIF" || ext == "SVG") && metadata.session == "" && CCUtility.fileProviderStorageSize(metadata.ocId, fileNameView: metadata.fileNameView) == 0 {
+            NCNetworking.shared.download(metadata: metadata, selector: "") { (_) in }
+        }
     }
     
     func changeScreenMode(to: ScreenMode) {
@@ -267,14 +276,6 @@ class NCViewerImagePageContainer: UIViewController, UIGestureRecognizerDelegate
                 }
                 image = UIImage.init(contentsOfFile: imagePath)
             }
-            
-        } else {
-            
-            // AUTOMATIC DOWNLOAD FOR GIF
-            
-            if (ext == "GIF" || ext == "SVG") && metadata.session == "" {
-                NCNetworking.shared.download(metadata: metadata, selector: "") { (_) in }
-            }
         }
         
         return image