Sfoglia il codice sorgente

shared icons on favorite view

Marino Faggiana 7 anni fa
parent
commit
dad9e53ae9

+ 29 - 11
iOSClient/Favorites/CCFavorites.m

@@ -593,14 +593,10 @@
     
     metadata = [_dataSource objectAtIndex:indexPath.row];
         
-    cell.file.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]];
-        
+    // favorite
     if (_serverUrl == nil)
         cell.favorite.image = [UIImage imageNamed:@"favorite"];
     
-    if (cell.file.image == nil && metadata.thumbnailExists)
-        [[CCActions sharedInstance] downloadTumbnail:metadata delegate:self];
-    
     // encrypted color
     if (metadata.cryptated) {
         cell.labelTitle.textColor = [NCBrandColor sharedInstance].cryptocloud;
@@ -608,20 +604,42 @@
         cell.labelTitle.textColor = [UIColor blackColor];
     }
     
-    // File name
+    // filename
     cell.labelTitle.text = metadata.fileNamePrint;
     cell.labelInfoFile.text = @"";
     
-    // Immagine del file, se non c'è l'anteprima mettiamo quella standard
-    if (cell.file.image == nil) {
-        
-        if (metadata.directory) {
+    // Shared
+    NSString *serverUrl = [[NCManageDatabase sharedInstance] getServerUrl:metadata.directoryID];
+    NSString *shareLink = [app.sharesLink objectForKey:[serverUrl stringByAppendingString:metadata.fileName]];
+    NSString *shareUserAndGroup = [app.sharesUserAndGroup objectForKey:[serverUrl stringByAppendingString:metadata.fileName]];
+
+    // Immage
+    if (metadata.directory) {
             
+        if ([shareLink length] > 0) {
+            cell.file.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder_public"] color:[NCBrandColor sharedInstance].brand];
+        } else if ([shareUserAndGroup length] > 0) {
+            cell.file.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder_shared_with_me"] color:[NCBrandColor sharedInstance].brand];
+        } else {
             cell.file.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:metadata.iconName] color:[NCBrandColor sharedInstance].brand];
+        }
             
-        } else {
+    } else {
+            
+        if ([shareLink length] > 0) {
+            cell.shared.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"shareLink"] color:[NCBrandColor sharedInstance].brand];
+        } else if ([shareUserAndGroup length] > 0) {
+            cell.shared.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"actionSheetShare"] color:[NCBrandColor sharedInstance].brand];
+        }
+        
+        cell.file.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]];
+        
+        if (cell.file.image == nil) {
             
             cell.file.image = [UIImage imageNamed:metadata.iconName];
+            
+            if (metadata.thumbnailExists)
+                [[CCActions sharedInstance] downloadTumbnail:metadata delegate:self];
         }
     }
     

+ 1 - 0
iOSClient/Favorites/CCFavoritesCell.h

@@ -30,6 +30,7 @@
 @property(nonatomic, weak) IBOutlet UIImageView *status;
 @property(nonatomic, weak) IBOutlet UIImageView *favorite;
 @property(nonatomic, weak) IBOutlet UIImageView *local;
+@property(nonatomic, weak) IBOutlet UIImageView *shared;
 
 @property(nonatomic, weak) IBOutlet UILabel *labelTitle;
 @property(nonatomic, weak) IBOutlet UILabel *labelInfoFile;

+ 11 - 1
iOSClient/Favorites/CCFavoritesCell.xib

@@ -16,7 +16,7 @@
             <rect key="frame" x="0.0" y="0.0" width="600" height="60"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
             <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2" id="sQq-jC-UEV">
-                <rect key="frame" x="0.0" y="0.0" width="600" height="59.5"/>
+                <rect key="frame" x="0.0" y="0.0" width="600" height="60"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QNC-8X-DAC">
@@ -59,6 +59,13 @@
                             <constraint firstAttribute="height" constant="15" id="aQq-XY-pNM"/>
                         </constraints>
                     </imageView>
+                    <imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="XQL-3O-oXy" userLabel="Shared Image View">
+                        <rect key="frame" x="558" y="0.0" width="42" height="60"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="60" id="7E9-W6-BKh"/>
+                            <constraint firstAttribute="width" constant="42" id="JBh-wn-m3z"/>
+                        </constraints>
+                    </imageView>
                 </subviews>
                 <constraints>
                     <constraint firstItem="DQR-yN-JaH" firstAttribute="top" secondItem="dhG-hb-z3n" secondAttribute="top" id="0XU-Ho-ald"/>
@@ -71,10 +78,12 @@
                     <constraint firstItem="p7I-KN-FVZ" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="10" id="K7G-0u-f8E"/>
                     <constraint firstItem="8I8-C4-IpX" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="-11" id="MeU-6N-LsY"/>
                     <constraint firstItem="QNC-8X-DAC" firstAttribute="leading" secondItem="5" secondAttribute="trailing" constant="10" id="UYc-Al-a4h"/>
+                    <constraint firstAttribute="trailingMargin" secondItem="XQL-3O-oXy" secondAttribute="trailing" constant="-8" id="XoZ-u4-Bb4"/>
                     <constraint firstItem="5" firstAttribute="top" secondItem="8I8-C4-IpX" secondAttribute="bottom" constant="-9" id="c7V-hW-ut8"/>
                     <constraint firstItem="p7I-KN-FVZ" firstAttribute="top" secondItem="QNC-8X-DAC" secondAttribute="bottom" id="cJT-LE-kot"/>
                     <constraint firstItem="dhG-hb-z3n" firstAttribute="leading" secondItem="sQq-jC-UEV" secondAttribute="leadingMargin" constant="-4" id="dNM-6x-zkx"/>
                     <constraint firstItem="p7I-KN-FVZ" firstAttribute="trailing" secondItem="sQq-jC-UEV" secondAttribute="trailingMargin" constant="-59" id="kaB-WS-bDl"/>
+                    <constraint firstItem="XQL-3O-oXy" firstAttribute="centerY" secondItem="sQq-jC-UEV" secondAttribute="centerY" id="nbe-Zs-K8w"/>
                 </constraints>
             </tableViewCellContentView>
             <connections>
@@ -83,6 +92,7 @@
                 <outlet property="labelInfoFile" destination="p7I-KN-FVZ" id="5Yb-hH-k73"/>
                 <outlet property="labelTitle" destination="QNC-8X-DAC" id="dFX-Cb-8IE"/>
                 <outlet property="local" destination="DQR-yN-JaH" id="Gbe-QU-cMb"/>
+                <outlet property="shared" destination="XQL-3O-oXy" id="TpF-AH-duD"/>
                 <outlet property="status" destination="dhG-hb-z3n" id="Jxk-qM-eWu"/>
             </connections>
             <point key="canvasLocation" x="256" y="19"/>