Browse Source

coding

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
0abc5b940c

+ 13 - 1
iOSClient/Activity/NCActivityTableViewCell.swift

@@ -75,7 +75,19 @@ class NCActivityTableViewCell: UITableViewCell, NCCellProtocol {
             user = newValue ?? ""
         }
     }
-
+    var title: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    var info: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    
     @objc func tapAvatarImage() {
         guard let fileUser = fileUser else { return }
         viewController?.showProfileMenu(userId: fileUser)

+ 5 - 0
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -594,6 +594,9 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
         let status = userInfo["status"] as? Int ?? NCGlobal.shared.metadataStatusNormal
 
         if let cell = collectionView?.cellForItem(at: indexPath) {
+            if let cell = cell as? NCCellProtocol {
+                print (cell.title)
+            }
             if cell is NCListCell {
                 let cell = cell as! NCListCell
                 if progressNumber.floatValue == 1 {
@@ -1727,6 +1730,8 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
             cell.fileUser = metadata.ownerId
             cell.labelTitle.text = metadata.fileNameView
             cell.labelTitle.textColor = NCBrandColor.shared.label
+            cell.labelInfo.text = CCUtility.dateDiff(metadata.date as Date) + " · " + CCUtility.transformedSize(metadata.size)
+            cell.labelInfo.textColor = NCBrandColor.shared.systemGray
 
             if isSearching, let literalSearch = self.literalSearch {
                 let longestWordRange = (metadata.fileName.lowercased() as NSString).range(of: literalSearch)

+ 22 - 3
iOSClient/Main/Collection Common/NCGridCell.swift

@@ -24,7 +24,6 @@
 import UIKit
 
 class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProtocol, NCTrashCell {
-    var labelInfo: UILabel?
 
     @IBOutlet weak var imageItem: UIImageView!
     @IBOutlet weak var imageSelect: UIImageView!
@@ -32,6 +31,7 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
     @IBOutlet weak var imageFavorite: UIImageView!
     @IBOutlet weak var imageLocal: UIImageView!
     @IBOutlet weak var labelTitle: UILabel!
+    @IBOutlet weak var labelInfo: UILabel!
     @IBOutlet weak var buttonMore: UIButton!
     @IBOutlet weak var imageVisualEffect: UIVisualEffectView!
     @IBOutlet weak var progressView: UIProgressView!
@@ -68,7 +68,23 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
             user = newValue ?? ""
         }
     }
-
+    var title: String? {
+        get {
+            return labelTitle.text
+        }
+        set {
+            labelTitle.text = newValue ?? ""
+        }
+    }
+    var info: String? {
+        get {
+            return labelInfo.text
+        }
+        set {
+            labelInfo.text = newValue ?? ""
+        }
+    }
+    
     override func awakeFromNib() {
         super.awakeFromNib()
 
@@ -100,6 +116,9 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
         longPressedGestureMore.delegate = self
         longPressedGestureMore.delaysTouchesBegan = true
         buttonMore.addGestureRecognizer(longPressedGestureMore)
+
+        labelTitle.text = ""
+        labelInfo.text = ""
     }
 
     override func prepareForReuse() {
@@ -189,7 +208,7 @@ extension NCGridCellDelegate {
 
 class NCGridLayout: UICollectionViewFlowLayout {
 
-    var heightLabelPlusButton: CGFloat = 45
+    var heightLabelPlusButton: CGFloat = 60
     var marginLeftRight: CGFloat = 6
     var itemForLine: CGFloat = 3
     var itemWidthDefault: CGFloat = 120

+ 33 - 19
iOSClient/Main/Collection Common/NCGridCell.xib

@@ -1,33 +1,40 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="gridCell" id="vf1-Kf-9uL" customClass="NCGridCell" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="220" height="265"/>
+            <rect key="frame" x="0.0" y="0.0" width="416" height="494"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
             <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
-                <rect key="frame" x="0.0" y="0.0" width="220" height="265"/>
+                <rect key="frame" x="0.0" y="0.0" width="416" height="494"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="5Ci-V1-hf5" userLabel="imageItem">
-                        <rect key="frame" x="0.0" y="0.0" width="220" height="220"/>
+                        <rect key="frame" x="0.0" y="0.0" width="416" height="434"/>
                     </imageView>
                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eU3-lY-fKr" userLabel="labelTitle">
-                        <rect key="frame" x="5" y="230" width="180" height="15"/>
+                        <rect key="frame" x="5" y="444" width="406" height="15"/>
                         <fontDescription key="fontDescription" type="system" pointSize="12"/>
                         <nil key="textColor"/>
                         <nil key="highlightedColor"/>
                     </label>
+                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2po-8g-XeS">
+                        <rect key="frame" x="9" y="464" width="372" height="15"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="12"/>
+                        <color key="textColor" systemColor="systemGray2Color"/>
+                        <nil key="highlightedColor"/>
+                    </label>
                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EJs-Ro-nbe" userLabel="buttonMoreGrid">
-                        <rect key="frame" x="195" y="225" width="25" height="25"/>
+                        <rect key="frame" x="391" y="459" width="25" height="25"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="25" id="4Ba-Uy-pX2"/>
                             <constraint firstAttribute="width" constant="25" id="aRK-GA-Nba"/>
@@ -38,30 +45,30 @@
                         </connections>
                     </button>
                     <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="AYs-f2-vve" userLabel="imageFavorite">
-                        <rect key="frame" x="200" y="5" width="15" height="15"/>
+                        <rect key="frame" x="396" y="5" width="15" height="15"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="15" id="ZjS-Hv-JNm"/>
                             <constraint firstAttribute="width" constant="15" id="kDr-15-VeJ"/>
                         </constraints>
                     </imageView>
                     <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="a0p-rj-jnV" userLabel="imageStatus">
-                        <rect key="frame" x="5" y="200" width="15" height="15"/>
+                        <rect key="frame" x="5" y="414" width="15" height="15"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="15" id="gq1-0a-eLC"/>
                             <constraint firstAttribute="width" constant="15" id="uJE-4b-Qt7"/>
                         </constraints>
                     </imageView>
                     <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="81G-wH-fjN" userLabel="imageLocal">
-                        <rect key="frame" x="200" y="200" width="15" height="15"/>
+                        <rect key="frame" x="396" y="414" width="15" height="15"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="15" id="NTa-Gi-uzY"/>
                             <constraint firstAttribute="width" constant="15" id="xLe-lb-N1p"/>
                         </constraints>
                     </imageView>
                     <visualEffectView hidden="YES" opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="W0L-HY-al1">
-                        <rect key="frame" x="0.0" y="0.0" width="220" height="220"/>
+                        <rect key="frame" x="0.0" y="0.0" width="416" height="434"/>
                         <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="0m6-A2-SwD">
-                            <rect key="frame" x="0.0" y="0.0" width="220" height="220"/>
+                            <rect key="frame" x="0.0" y="0.0" width="416" height="434"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         </view>
                         <blurEffect style="extraLight"/>
@@ -74,7 +81,7 @@
                         </constraints>
                     </imageView>
                     <progressView hidden="YES" opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="JQo-Vc-Ejk">
-                        <rect key="frame" x="5" y="256" width="210" height="4"/>
+                        <rect key="frame" x="5" y="485" width="406" height="4"/>
                     </progressView>
                 </subviews>
             </view>
@@ -83,8 +90,11 @@
                 <constraint firstItem="DHy-Up-3Bh" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="5" id="1T3-8p-uIW"/>
                 <constraint firstItem="AYs-f2-vve" firstAttribute="leading" secondItem="5Ci-V1-hf5" secondAttribute="trailing" constant="-20" id="3e3-0A-NSl"/>
                 <constraint firstItem="eU3-lY-fKr" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="10" id="4Yq-Nh-z1l"/>
+                <constraint firstItem="2po-8g-XeS" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="9" id="5dp-1s-MQi"/>
+                <constraint firstItem="2po-8g-XeS" firstAttribute="top" secondItem="eU3-lY-fKr" secondAttribute="bottom" constant="5" id="5wo-Td-XeT"/>
                 <constraint firstItem="W0L-HY-al1" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" id="6tC-PK-fYX"/>
-                <constraint firstItem="EJs-Ro-nbe" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="5" id="89Q-77-ulE"/>
+                <constraint firstItem="EJs-Ro-nbe" firstAttribute="centerY" secondItem="2po-8g-XeS" secondAttribute="centerY" id="8qW-SF-u1h"/>
+                <constraint firstItem="EJs-Ro-nbe" firstAttribute="leading" secondItem="2po-8g-XeS" secondAttribute="trailing" constant="10" id="ABr-PB-TZg"/>
                 <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="JQo-Vc-Ejk" secondAttribute="trailing" constant="5" id="E03-Dk-iZ5"/>
                 <constraint firstItem="DHy-Up-3Bh" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" constant="5" id="ESV-qE-tbO"/>
                 <constraint firstItem="5Ci-V1-hf5" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" id="Ouj-ZD-UFm"/>
@@ -94,10 +104,10 @@
                 <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="W0L-HY-al1" secondAttribute="trailing" id="VMW-0Y-aOH"/>
                 <constraint firstItem="81G-wH-fjN" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="-20" id="aEb-vq-8sk"/>
                 <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="5Ci-V1-hf5" secondAttribute="trailing" id="cHT-cP-NN6"/>
-                <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="45" id="eEC-eB-alE"/>
+                <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="eU3-lY-fKr" secondAttribute="trailing" constant="5" id="csl-Ny-rdF"/>
+                <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="60" id="eEC-eB-alE"/>
                 <constraint firstItem="eU3-lY-fKr" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="5" id="gZe-FC-8XQ"/>
-                <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="W0L-HY-al1" secondAttribute="bottom" constant="45" id="jI9-M1-Nl8"/>
-                <constraint firstItem="EJs-Ro-nbe" firstAttribute="leading" secondItem="eU3-lY-fKr" secondAttribute="trailing" constant="10" id="mhP-9c-PC9"/>
+                <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="W0L-HY-al1" secondAttribute="bottom" constant="60" id="jI9-M1-Nl8"/>
                 <constraint firstItem="81G-wH-fjN" firstAttribute="leading" secondItem="5Ci-V1-hf5" secondAttribute="trailing" constant="-20" id="nFH-Pc-end"/>
                 <constraint firstItem="5Ci-V1-hf5" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" id="qT3-WD-iTV"/>
                 <constraint firstItem="5Ci-V1-hf5" firstAttribute="top" secondItem="AYs-f2-vve" secondAttribute="bottom" constant="-20" id="rLL-6g-ypv"/>
@@ -105,7 +115,7 @@
                 <constraint firstItem="JQo-Vc-Ejk" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="5" id="wiV-1m-wt8"/>
                 <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="JQo-Vc-Ejk" secondAttribute="bottom" constant="5" id="zV9-iQ-Zm5"/>
             </constraints>
-            <size key="customSize" width="220" height="260"/>
+            <size key="customSize" width="416" height="489"/>
             <connections>
                 <outlet property="buttonMore" destination="EJs-Ro-nbe" id="BdI-ay-LuX"/>
                 <outlet property="imageFavorite" destination="AYs-f2-vve" id="UeH-R7-bZr"/>
@@ -114,13 +124,17 @@
                 <outlet property="imageSelect" destination="DHy-Up-3Bh" id="mo9-rP-P4I"/>
                 <outlet property="imageStatus" destination="a0p-rj-jnV" id="6Dg-tf-evd"/>
                 <outlet property="imageVisualEffect" destination="W0L-HY-al1" id="WDW-2d-Npa"/>
+                <outlet property="labelInfo" destination="2po-8g-XeS" id="FJ4-wI-9cW"/>
                 <outlet property="labelTitle" destination="eU3-lY-fKr" id="0P7-yM-Asb"/>
                 <outlet property="progressView" destination="JQo-Vc-Ejk" id="cdf-7W-tao"/>
             </connections>
-            <point key="canvasLocation" x="88" y="141.67916041979012"/>
+            <point key="canvasLocation" x="244.80000000000001" y="244.6776611694153"/>
         </collectionViewCell>
     </objects>
     <resources>
         <image name="more" width="425" height="425"/>
+        <systemColor name="systemGray2Color">
+            <color red="0.68235294117647061" green="0.68235294117647061" blue="0.69803921568627447" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+        </systemColor>
     </resources>
 </document>

+ 16 - 0
iOSClient/Main/Collection Common/NCListCell.swift

@@ -76,6 +76,22 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
             user = newValue ?? ""
         }
     }
+    var title: String? {
+        get {
+            return labelTitle.text
+        }
+        set {
+            labelTitle.text = newValue ?? ""
+        }
+    }
+    var info: String? {
+        get {
+            return labelInfo.text
+        }
+        set {
+            labelInfo.text = newValue ?? ""
+        }
+    }
 
     override func awakeFromNib() {
         super.awakeFromNib()

+ 2 - 0
iOSClient/Main/NCCellProtocol.swift

@@ -28,4 +28,6 @@ protocol NCCellProtocol {
     var fileObjectId: String? { get }
     var filePreviewImageView: UIImageView? { get }
     var fileUser: String? { get }
+    var title: String? { get set }
+    var info: String? { get set }
 }

+ 13 - 1
iOSClient/Media/Cell/NCGridMediaCell.swift

@@ -61,7 +61,19 @@ class NCGridMediaCell: UICollectionViewCell, NCCellProtocol {
             user = newValue ?? ""
         }
     }
-
+    var title: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    var info: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    
     override func awakeFromNib() {
         super.awakeFromNib()
         initCell()

+ 13 - 1
iOSClient/Notification/NCNotification.swift

@@ -346,7 +346,19 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol {
             user = newValue ?? ""
         }
     }
-
+    var title: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    var info: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    
     override func awakeFromNib() {
         super.awakeFromNib()
     }

+ 12 - 0
iOSClient/Share/NCShareCommentsCell.swift

@@ -49,6 +49,18 @@ class NCShareCommentsCell: UITableViewCell, NCCellProtocol {
     var fileUser: String? {
         return tableComments?.actorId
     }
+    var title: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    var info: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
 
     override func awakeFromNib() {
         super.awakeFromNib()

+ 30 - 1
iOSClient/Share/NCShareUserCell.swift

@@ -43,6 +43,23 @@ class NCShareUserCell: UITableViewCell, NCCellProtocol {
     var filePreviewImageView: UIImageView? { return nil }
     var fileUser: String? { return tableShare?.shareWith }
 
+    var title: String? {
+        get {
+            return labelTitle.text
+        }
+        set {
+            labelTitle.text = newValue ?? ""
+        }
+    }
+    var info: String? {
+        get {
+            return status.text
+        }
+        set {
+            status.text = newValue ?? ""
+        }
+    }
+    
     func setupCellUI(userId: String) {
         guard let tableShare = tableShare else {
             return
@@ -141,7 +158,19 @@ class NCSearchUserDropDownCell: DropDownCell, NCCellProtocol {
             user = newValue ?? ""
         }
     }
-
+    var title: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    var info: String? {
+        get {
+            return nil
+        }
+        set { }
+    }
+    
     func setupCell(sharee: NCCommunicationSharee, baseUrl: NCUserBaseUrl) {
         imageItem.image = NCShareCommon.shared.getImageShareType(shareType: sharee.shareType)
         imageShareeType.image = NCShareCommon.shared.getImageShareType(shareType: sharee.shareType)

+ 17 - 1
iOSClient/Transfers/NCTransferCell.swift

@@ -69,7 +69,23 @@ class NCTransferCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellP
             user = newValue ?? ""
         }
     }
-
+    var title: String? {
+        get {
+            return labelTitle.text
+        }
+        set {
+            labelTitle.text = newValue ?? ""
+        }
+    }
+    var info: String? {
+        get {
+            return labelInfo.text
+        }
+        set {
+            labelInfo.text = newValue ?? ""
+        }
+    }
+    
     override func awakeFromNib() {
         super.awakeFromNib()
 

+ 2 - 2
iOSClient/Trash/Cell/NCTrashListCell.swift

@@ -32,7 +32,7 @@ class NCTrashListCell: UICollectionViewCell, NCTrashCell {
     @IBOutlet weak var imageSelect: UIImageView!
 
     @IBOutlet weak var labelTitle: UILabel!
-    @IBOutlet weak var labelInfo: UILabel?
+    @IBOutlet weak var labelInfo: UILabel!
 
     @IBOutlet weak var imageRestore: UIImageView!
     @IBOutlet weak var imageMore: UIImageView!
@@ -127,7 +127,7 @@ protocol NCTrashListCellDelegate: AnyObject {
 protocol NCTrashCell {
     var objectId: String { get set }
     var labelTitle: UILabel! { get set }
-    var labelInfo: UILabel? { get set }
+    var labelInfo: UILabel! { get set }
     var imageItem: UIImageView! { get set }
 
     func selectMode(_ status: Bool)