marinofaggiana 6 years ago
parent
commit
8f9aa02a77

+ 7 - 9
iOSClient/Main/CCMain.m

@@ -934,18 +934,16 @@
     NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:convertedLocation];
     tableMetadata *metadata = [[NCMainCommon sharedInstance] getMetadataFromSectionDataSourceIndexPath:indexPath sectionDataSource:sectionDataSource];
     
-    if (metadata.hasPreview == 1) {
-        CCCellMain *cell = [self.tableView cellForRowAtIndexPath:indexPath];
+    CCCellMain *cell = [self.tableView cellForRowAtIndexPath:indexPath];
         
-        if (cell) {
-            previewingContext.sourceRect = cell.frame;
-            CCPeekPop *vc = [[UIStoryboard storyboardWithName:@"CCPeekPop" bundle:nil] instantiateViewControllerWithIdentifier:@"PeekPopImagePreview"];
+    if (cell) {
+        previewingContext.sourceRect = cell.frame;
+        CCPeekPop *vc = [[UIStoryboard storyboardWithName:@"CCPeekPop" bundle:nil] instantiateViewControllerWithIdentifier:@"PeekPopImagePreview"];
             
-            vc.delegate = self;
-            vc.metadata = metadata;
+        vc.delegate = self;
+        vc.metadata = metadata;
             
-            return vc;
-        }
+        return vc;
     }
     
     return nil;

+ 1 - 0
iOSClient/PeekPop/CCPeekPop.h

@@ -34,6 +34,7 @@
 
 @property (nonatomic, strong) tableMetadata *metadata;
 
+@property (nonatomic, weak) IBOutlet UILabel *fileName;
 @property (nonatomic, weak) IBOutlet UIImageView *imagePreview;
 
 @end

+ 14 - 18
iOSClient/PeekPop/CCPeekPop.m

@@ -51,19 +51,17 @@
     
     NSURL *url = [[NSBundle mainBundle] URLForResource:@"loading" withExtension:@"gif"];
     
-    _imagePreview.image = [UIImage animatedImageWithAnimatedGIFURL:url];
-    
-    _imagePreview.contentMode = UIViewContentModeCenter;
+    self.imagePreview.image = [UIImage animatedImageWithAnimatedGIFURL:url];
+    self.imagePreview.contentMode = UIViewContentModeCenter;
+    self.fileName.text = self.metadata.fileNameView;
 
-    [self downloadThumbnail];
+    if (self.metadata.hasPreview) {
+        [self downloadThumbnail];
+    } else {
+        
+    }
 }
 
-// E' apparso
-
--(void) viewDidAppear:(BOOL)animated{
-    
-    [super viewDidAppear:animated];    
-}
 
 - (void)didReceiveMemoryWarning
 {
@@ -72,14 +70,12 @@
 
 - (NSArray<id<UIPreviewActionItem>> *)previewActionItems
 {
-    //__weak typeof(self) weakSelf = self;
-    
     UIPreviewAction *previewAction1 = [UIPreviewAction actionWithTitle:NSLocalizedString(@"_open_in_", nil) style:UIPreviewActionStyleDefault handler:^(UIPreviewAction *action,  UIViewController *previewViewController){
         
-        _metadata.session = k_download_session;
-        _metadata.sessionError = @"";
-        _metadata.sessionSelector = selectorOpenIn;
-        _metadata.status = k_metadataStatusWaitDownload;
+        self.metadata.session = k_download_session;
+        self.metadata.sessionError = @"";
+        self.metadata.sessionSelector = selectorOpenIn;
+        self.metadata.status = k_metadataStatusWaitDownload;
             
         // Add Metadata for Download
         (void)[[NCManageDatabase sharedInstance] addMetadata:_metadata];
@@ -102,8 +98,8 @@
      
         if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
             
-            _imagePreview.image = image;
-            _imagePreview.contentMode = UIViewContentModeScaleToFill;
+            self.imagePreview.image = image;
+            self.imagePreview.contentMode = UIViewContentModeScaleToFill;
             
             self.preferredContentSize = CGSizeMake(image.size.width, image.size.height);
             

+ 25 - 8
iOSClient/PeekPop/CCPeekPop.storyboard

@@ -1,8 +1,12 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina5_9" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
         <!--Peek Pop-->
@@ -14,29 +18,42 @@
                         <viewControllerLayoutGuide type="bottom" id="7Bs-Vb-lqH"/>
                     </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="jEt-cG-Pua">
-                        <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="e9H-uI-9UA" userLabel="ImagePreview">
-                                <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+                                <rect key="frame" x="0.0" y="104" width="375" height="674"/>
                             </imageView>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dhr-ST-vvT">
+                                <rect key="frame" x="5" y="49" width="365" height="50"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="50" id="2I2-hl-qUk"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
                         </subviews>
-                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
                             <constraint firstItem="e9H-uI-9UA" firstAttribute="bottom" secondItem="7Bs-Vb-lqH" secondAttribute="top" id="8Qt-fp-Vch"/>
+                            <constraint firstItem="e9H-uI-9UA" firstAttribute="top" secondItem="Dhr-ST-vvT" secondAttribute="bottom" constant="5" id="CKM-T4-VWH"/>
+                            <constraint firstItem="Dhr-ST-vvT" firstAttribute="top" secondItem="XUP-z1-l8k" secondAttribute="bottom" constant="5" id="Hdx-ZN-efJ"/>
                             <constraint firstItem="e9H-uI-9UA" firstAttribute="leading" secondItem="jEt-cG-Pua" secondAttribute="leading" id="Rsd-3j-a5W"/>
-                            <constraint firstItem="e9H-uI-9UA" firstAttribute="top" secondItem="XUP-z1-l8k" secondAttribute="bottom" id="Uhj-u0-hMf"/>
+                            <constraint firstAttribute="trailing" secondItem="Dhr-ST-vvT" secondAttribute="trailing" constant="5" id="Uf6-8E-ZeD"/>
                             <constraint firstAttribute="trailing" secondItem="e9H-uI-9UA" secondAttribute="trailing" id="oOm-Av-GmM"/>
+                            <constraint firstItem="Dhr-ST-vvT" firstAttribute="leading" secondItem="jEt-cG-Pua" secondAttribute="leading" constant="5" id="pJ9-JE-AEz"/>
                         </constraints>
                     </view>
                     <nil key="simulatedStatusBarMetrics"/>
                     <connections>
+                        <outlet property="fileName" destination="Dhr-ST-vvT" id="W5d-40-MAq"/>
                         <outlet property="imagePreview" destination="e9H-uI-9UA" id="Mut-gu-5wH"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="Y26-DR-wTE" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="563" y="469"/>
+            <point key="canvasLocation" x="562.39999999999998" y="468.4729064039409"/>
         </scene>
     </scenes>
 </document>