Marino Faggiana 6 years ago
parent
commit
f7a97d8558
3 changed files with 40 additions and 30 deletions
  1. 1 0
      iOSClient/Move/CCMove.h
  2. 33 24
      iOSClient/Move/CCMove.m
  3. 6 6
      iOSClient/Move/CCMove.storyboard

+ 1 - 0
iOSClient/Move/CCMove.h

@@ -41,6 +41,7 @@
 @property BOOL includeDirectoryE2EEncryption;
 @property BOOL includeDirectoryE2EEncryption;
 @property BOOL includeImages;
 @property BOOL includeImages;
 @property BOOL hideCreateFolder;
 @property BOOL hideCreateFolder;
+@property BOOL hideMoveutton;
 
 
 @property (nonatomic, strong) NSString *serverUrl;
 @property (nonatomic, strong) NSString *serverUrl;
 @property (nonatomic, strong) tableMetadata *passMetadata;
 @property (nonatomic, strong) tableMetadata *passMetadata;

+ 33 - 24
iOSClient/Move/CCMove.m

@@ -37,6 +37,8 @@
     // Automatic Upload Folder
     // Automatic Upload Folder
     NSString *_autoUploadFileName;
     NSString *_autoUploadFileName;
     NSString *_autoUploadDirectory;
     NSString *_autoUploadDirectory;
+    
+    NSPredicate *predicateDataSource;
 }
 }
 @end
 @end
 
 
@@ -127,6 +129,11 @@
         [self.create setEnabled:NO];
         [self.create setEnabled:NO];
         [self.create setTintColor: [UIColor clearColor]];
         [self.create setTintColor: [UIColor clearColor]];
     }
     }
+    
+    if (self.hideMoveutton) {
+        [self.move setEnabled:NO];
+        [self.move setTintColor: [UIColor clearColor]];
+    }
 }
 }
 
 
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------
@@ -363,11 +370,11 @@
 {
 {
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
     if (!directoryID) return 0;
     if (!directoryID) return 0;
-    NSPredicate *predicate;
 
 
-    predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == %@", directoryID, [NSNumber numberWithBool:self.includeDirectoryE2EEncryption]];
+    if (self.includeImages) predicateDataSource = [NSPredicate predicateWithFormat:@"directoryID == %@ AND e2eEncrypted == %@ AND (directory == true OR typeFile == 'image')", directoryID, [NSNumber numberWithBool:self.includeDirectoryE2EEncryption]];
+    else predicateDataSource = [NSPredicate predicateWithFormat:@"directoryID == %@ AND e2eEncrypted == %@ AND directory == true", directoryID, [NSNumber numberWithBool:self.includeDirectoryE2EEncryption]];
     
     
-    NSArray *result = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
+    NSArray *result = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicateDataSource sorted:nil ascending:NO];
     
     
     if (result)
     if (result)
         return [result count];
         return [result count];
@@ -377,8 +384,6 @@
 
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
 {
-    NSPredicate *predicate;
-    
     static NSString *CellIdentifier = @"MyCustomCell";
     static NSString *CellIdentifier = @"MyCustomCell";
     
     
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
@@ -386,14 +391,7 @@
         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
     }
     }
     
     
-    NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
-    if (!directoryID)
-        return cell;
-    
-    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true", directoryID];
-    else predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == false", directoryID];
-    
-    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicate sorted:@"fileName" ascending:YES index:indexPath.row];
+    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicateDataSource sorted:@"fileName" ascending:YES index:indexPath.row];
     
     
     // Create Directory Provider Storage FileID
     // Create Directory Provider Storage FileID
     [CCUtility getDirectoryProviderStorageFileID:metadata.fileID];
     [CCUtility getDirectoryProviderStorageFileID:metadata.fileID];
@@ -403,13 +401,28 @@
     
     
     cell.detailTextLabel.text = @"";
     cell.detailTextLabel.text = @"";
     
     
-    if (metadata.e2eEncrypted)
-        cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderEncrypted"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
-    else if ([metadata.fileName isEqualToString:_autoUploadFileName] && [self.serverUrl isEqualToString:_autoUploadDirectory])
-        cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
-    else
-        cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+    if (metadata.directory) {
     
     
+        if (metadata.e2eEncrypted)
+            cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderEncrypted"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+        else if ([metadata.fileName isEqualToString:_autoUploadFileName] && [self.serverUrl isEqualToString:_autoUploadDirectory])
+            cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+        else
+            cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+        
+    } else {
+        
+        if ([[NSFileManager defaultManager] fileExistsAtPath:[CCUtility getDirectoryProviderStorageFileID:metadata.fileID fileNameView:metadata.fileNameView]]) {
+            cell.imageView.image = [UIImage imageWithContentsOfFile:[CCUtility getDirectoryProviderStorageFileID:metadata.fileID fileNameView:metadata.fileNameView]];
+        } else {
+            if (metadata.iconName.length > 0) {
+                cell.imageView.image = [UIImage imageNamed:metadata.iconName];
+            } else {
+                cell.imageView.image = [UIImage imageNamed:@"file"];
+            }
+        }
+    }
+
     cell.textLabel.text = metadata.fileNameView;
     cell.textLabel.text = metadata.fileNameView;
     cell.accessoryType = UITableViewCellAccessoryNone;
     cell.accessoryType = UITableViewCellAccessoryNone;
     
     
@@ -426,16 +439,12 @@
 - (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode
 - (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode
 {
 {
     NSString *nomeDir;
     NSString *nomeDir;
-    NSPredicate *predicate;
 
 
     NSIndexPath *index = [self.tableView indexPathForSelectedRow];
     NSIndexPath *index = [self.tableView indexPathForSelectedRow];
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
     if (!directoryID) return;
     if (!directoryID) return;
     
     
-    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true", directoryID];
-    else predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == false", directoryID];
-    
-    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicate sorted:@"fileName" ascending:YES index:index.row];
+    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicateDataSource sorted:@"fileName" ascending:YES index:index.row];
     
     
     // lockServerUrl
     // lockServerUrl
     NSString *lockServerUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:metadata.fileName];
     NSString *lockServerUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:metadata.fileName];

+ 6 - 6
iOSClient/Move/CCMove.storyboard

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
         <deployment identifier="iOS"/>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     </dependencies>
     <scenes>
     <scenes>
@@ -14,7 +14,7 @@
             <objects>
             <objects>
                 <tableViewController storyboardIdentifier="CCMoveVC" id="r57-Y0-NGA" customClass="CCMove" sceneMemberID="viewController">
                 <tableViewController storyboardIdentifier="CCMoveVC" id="r57-Y0-NGA" customClass="CCMove" sceneMemberID="viewController">
                     <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="50" sectionHeaderHeight="22" sectionFooterHeight="22" id="McT-Wl-5yC">
                     <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="50" sectionHeaderHeight="22" sectionFooterHeight="22" id="McT-Wl-5yC">
-                        <rect key="frame" x="0.0" y="64" width="375" height="559"/>
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="559"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <prototypes>
                         <prototypes>
@@ -22,11 +22,11 @@
                                 <rect key="frame" x="0.0" y="22" width="375" height="60"/>
                                 <rect key="frame" x="0.0" y="22" width="375" height="60"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="w3K-MH-HTI" id="o7i-Tv-3Dy">
                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="w3K-MH-HTI" id="o7i-Tv-3Dy">
-                                    <rect key="frame" x="0.0" y="0.0" width="342" height="59"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="341" height="59.5"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                     <subviews>
                                     <subviews>
                                         <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Z3y-WW-606">
                                         <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Z3y-WW-606">
-                                            <rect key="frame" x="15" y="0.0" width="325" height="59"/>
+                                            <rect key="frame" x="16" y="0.0" width="324" height="59.5"/>
                                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                             <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                             <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                             <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -78,7 +78,7 @@
                     <toolbarItems/>
                     <toolbarItems/>
                     <navigationItem key="navigationItem" id="uMb-zy-0sS"/>
                     <navigationItem key="navigationItem" id="uMb-zy-0sS"/>
                     <navigationBar key="navigationBar" alpha="0.89999997615814209" contentMode="scaleToFill" misplaced="YES" translucent="NO" id="emo-5L-Jsr">
                     <navigationBar key="navigationBar" alpha="0.89999997615814209" contentMode="scaleToFill" misplaced="YES" translucent="NO" id="emo-5L-Jsr">
-                        <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     </navigationBar>
                     <nil name="viewControllers"/>
                     <nil name="viewControllers"/>