marinofaggiana 6 жил өмнө
parent
commit
1ef008c2b5

+ 26 - 6
iOSClient/PeekPop/CCPeekPop.m

@@ -47,22 +47,43 @@
     
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     
-    self.preferredContentSize = CGSizeMake(self.view.frame.size.width - 50, self.view.frame.size.width - 50);
+    //self.preferredContentSize = CGSizeMake(self.view.frame.size.width - 50, self.view.frame.size.width - 50);
     
+    /*
     NSURL *url = [[NSBundle mainBundle] URLForResource:@"loading" withExtension:@"gif"];
-    
     self.imagePreview.image = [UIImage animatedImageWithAnimatedGIFURL:url];
+    */
+    
     self.imagePreview.contentMode = UIViewContentModeCenter;
     self.fileName.text = self.metadata.fileNameView;
-
+    
     if (self.metadata.hasPreview) {
-        [self downloadThumbnail];
+        
+        if ([CCUtility fileProviderStorageIconExists:self.metadata.fileID fileNameView:self.metadata.fileNameView]) {
+            self.imagePreview.image = [UIImage imageWithContentsOfFile:[CCUtility getDirectoryProviderStorageIconFileID:self.metadata.fileID fileNameView:self.metadata.fileNameView]];
+            self.imagePreview.contentMode = UIViewContentModeScaleToFill;
+            self.preferredContentSize = CGSizeMake(self.imagePreview.image.size.width, self.imagePreview.image.size.height);
+        } else {
+            NSURL *url = [[NSBundle mainBundle] URLForResource:@"loading" withExtension:@"gif"];
+            self.imagePreview.image = [UIImage animatedImageWithAnimatedGIFURL:url];
+            [self downloadThumbnail];
+        }
+        
     } else {
         
+        if (self.metadata.directory) {
+            self.imagePreview.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] multiplier:3 color:[NCBrandColor sharedInstance].brandElement];
+        } else {
+            if (self.metadata.iconName.length > 0) {
+                self.imagePreview.image = [UIImage imageNamed:self.metadata.iconName];
+            } else {
+                self.imagePreview.image = [UIImage imageNamed:@"file"];
+
+            }
+        }
     }
 }
 
-
 - (void)didReceiveMemoryWarning
 {
     [super didReceiveMemoryWarning];
@@ -100,7 +121,6 @@
             
             self.imagePreview.image = image;
             self.imagePreview.contentMode = UIViewContentModeScaleToFill;
-            
             self.preferredContentSize = CGSizeMake(image.size.width, image.size.height);
             
         } else {