marinofaggiana 4 years ago
parent
commit
9b713c5182

+ 1 - 1
iOSClient/Transfers/NCTransferCell.swift

@@ -30,7 +30,7 @@ class NCTransferCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCImage
     
     @IBOutlet weak var labelTitle: UILabel!
     @IBOutlet weak var labelPath: UILabel!
-
+    @IBOutlet weak var labelStatus: UILabel!
     @IBOutlet weak var labelInfo: UILabel!
 
     @IBOutlet weak var imageMore: UIImageView!

+ 24 - 14
iOSClient/Transfers/NCTransferCell.xib

@@ -11,14 +11,14 @@
         <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="transferCell" id="jxV-Pk-fPt" customClass="NCTransferCell" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="600" height="100"/>
+            <rect key="frame" x="0.0" y="0.0" width="600" height="115"/>
             <autoresizingMask key="autoresizingMask"/>
             <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
-                <rect key="frame" x="0.0" y="0.0" width="600" height="100"/>
+                <rect key="frame" x="0.0" y="0.0" width="600" height="115"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="w2m-Vw-hpd" userLabel="ImageItem">
-                        <rect key="frame" x="10" y="30" width="40" height="40"/>
+                        <rect key="frame" x="10" y="37.5" width="40" height="40"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="40" id="Dpd-Xj-z4U"/>
                             <constraint firstAttribute="width" constant="40" id="v0e-MW-EeE"/>
@@ -30,20 +30,26 @@
                         <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <nil key="highlightedColor"/>
                     </label>
-                    <label opaque="NO" userInteractionEnabled="NO" tag="102" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xC4-B0-Jx5" userLabel="labelPath">
-                        <rect key="frame" x="60" y="38" width="490" height="15"/>
+                    <label opaque="NO" userInteractionEnabled="NO" tag="102" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="headTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xC4-B0-Jx5" userLabel="labelPath">
+                        <rect key="frame" x="60" y="33" width="490" height="15"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="12"/>
+                        <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
+                        <nil key="highlightedColor"/>
+                    </label>
+                    <label opaque="NO" userInteractionEnabled="NO" tag="102" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="headTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DKc-ve-Fut" userLabel="labelStatus">
+                        <rect key="frame" x="60" y="53" width="490" height="15"/>
                         <fontDescription key="fontDescription" type="system" pointSize="12"/>
                         <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
                         <nil key="highlightedColor"/>
                     </label>
                     <label opaque="NO" userInteractionEnabled="NO" tag="102" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AXX-71-9Q6" userLabel="labelInfo">
-                        <rect key="frame" x="60" y="70" width="490" height="15"/>
+                        <rect key="frame" x="60" y="78" width="490" height="15"/>
                         <fontDescription key="fontDescription" type="system" pointSize="12"/>
                         <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
                         <nil key="highlightedColor"/>
                     </label>
                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="yhy-xd-w5C" userLabel="buttonMore">
-                        <rect key="frame" x="560" y="20" width="40" height="60"/>
+                        <rect key="frame" x="560" y="27.5" width="40" height="60"/>
                         <constraints>
                             <constraint firstAttribute="width" constant="40" id="ZgH-mI-l2k"/>
                             <constraint firstAttribute="height" constant="60" id="woC-64-Tyc"/>
@@ -53,17 +59,17 @@
                         </connections>
                     </button>
                     <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="dgL-g5-Nkc" userLabel="imageMore">
-                        <rect key="frame" x="567.5" y="37.5" width="25" height="25"/>
+                        <rect key="frame" x="567.5" y="45" width="25" height="25"/>
                         <constraints>
                             <constraint firstAttribute="width" constant="25" id="05P-NL-pd8"/>
                             <constraint firstAttribute="height" constant="25" id="Jet-eo-x1M" userLabel="height = 20"/>
                         </constraints>
                     </imageView>
                     <progressView hidden="YES" opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="m2p-oJ-j15">
-                        <rect key="frame" x="60" y="89" width="450" height="4"/>
+                        <rect key="frame" x="60" y="104" width="450" height="4"/>
                     </progressView>
                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Egg-cb-EhZ" userLabel="separator">
-                        <rect key="frame" x="50" y="99" width="550" height="1"/>
+                        <rect key="frame" x="50" y="114" width="550" height="1"/>
                         <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
@@ -74,20 +80,23 @@
             </view>
             <viewLayoutGuide key="safeArea" id="Gu8-oz-zWa"/>
             <constraints>
+                <constraint firstItem="DKc-ve-Fut" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="10" id="1Wd-fR-dPa"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="m2p-oJ-j15" secondAttribute="trailing" constant="90" id="2zI-li-v77"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="bottom" secondItem="Egg-cb-EhZ" secondAttribute="bottom" id="81D-sw-EaX"/>
                 <constraint firstItem="xC4-B0-Jx5" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="10" id="CxG-X7-UWX"/>
+                <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="DKc-ve-Fut" secondAttribute="trailing" constant="50" id="GCP-xo-1Pc"/>
                 <constraint firstItem="Egg-cb-EhZ" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" id="JCm-UU-Pxu"/>
+                <constraint firstItem="DKc-ve-Fut" firstAttribute="top" secondItem="xC4-B0-Jx5" secondAttribute="bottom" constant="5" id="Nyl-en-Yd3"/>
                 <constraint firstItem="dgL-g5-Nkc" firstAttribute="centerY" secondItem="yhy-xd-w5C" secondAttribute="centerY" id="OMy-Cu-HAx"/>
                 <constraint firstItem="UtT-L6-mgW" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="10" id="PQ8-0b-fLa"/>
-                <constraint firstItem="xC4-B0-Jx5" firstAttribute="top" secondItem="UtT-L6-mgW" secondAttribute="bottom" constant="10" id="Plx-nJ-suY"/>
+                <constraint firstItem="xC4-B0-Jx5" firstAttribute="top" secondItem="UtT-L6-mgW" secondAttribute="bottom" constant="5" id="Plx-nJ-suY"/>
                 <constraint firstItem="AXX-71-9Q6" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="10" id="Qvq-r5-AX9"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="bottom" secondItem="m2p-oJ-j15" secondAttribute="bottom" constant="7" id="SYv-gc-ahx"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="UtT-L6-mgW" secondAttribute="trailing" constant="50" id="Tq4-bB-YMV"/>
                 <constraint firstItem="dgL-g5-Nkc" firstAttribute="centerX" secondItem="yhy-xd-w5C" secondAttribute="centerX" id="VSJ-7R-Srk"/>
                 <constraint firstItem="yhy-xd-w5C" firstAttribute="centerY" secondItem="Gu8-oz-zWa" secondAttribute="centerY" id="ZO7-Ny-L3I"/>
                 <constraint firstItem="m2p-oJ-j15" firstAttribute="leading" secondItem="w2m-Vw-hpd" secondAttribute="trailing" constant="10" id="Zyr-qM-9qP"/>
-                <constraint firstItem="Gu8-oz-zWa" firstAttribute="bottom" secondItem="AXX-71-9Q6" secondAttribute="bottom" constant="15" id="d06-sn-I3Y"/>
+                <constraint firstItem="AXX-71-9Q6" firstAttribute="top" secondItem="DKc-ve-Fut" secondAttribute="bottom" constant="10" id="aNn-8t-dGA"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="Egg-cb-EhZ" secondAttribute="trailing" id="k8f-bU-D6I"/>
                 <constraint firstItem="w2m-Vw-hpd" firstAttribute="leading" secondItem="Gu8-oz-zWa" secondAttribute="leading" constant="10" id="mBb-ff-7HD"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="xC4-B0-Jx5" secondAttribute="trailing" constant="50" id="mCh-H9-d5I"/>
@@ -96,18 +105,19 @@
                 <constraint firstItem="w2m-Vw-hpd" firstAttribute="centerY" secondItem="Gu8-oz-zWa" secondAttribute="centerY" id="qKl-4Y-m5t"/>
                 <constraint firstItem="Gu8-oz-zWa" firstAttribute="trailing" secondItem="yhy-xd-w5C" secondAttribute="trailing" id="s2S-RP-cw5"/>
             </constraints>
-            <size key="customSize" width="650" height="58"/>
+            <size key="customSize" width="650" height="92"/>
             <connections>
                 <outlet property="buttonMore" destination="yhy-xd-w5C" id="agm-M9-xtq"/>
                 <outlet property="imageItem" destination="w2m-Vw-hpd" id="iY5-ed-crD"/>
                 <outlet property="imageMore" destination="dgL-g5-Nkc" id="r7x-Ib-4nz"/>
                 <outlet property="labelInfo" destination="AXX-71-9Q6" id="krb-tZ-UQ7"/>
                 <outlet property="labelPath" destination="xC4-B0-Jx5" id="Nc4-8o-hfq"/>
+                <outlet property="labelStatus" destination="DKc-ve-Fut" id="ffg-f2-2ZE"/>
                 <outlet property="labelTitle" destination="UtT-L6-mgW" id="Xv6-zM-2v1"/>
                 <outlet property="progressView" destination="m2p-oJ-j15" id="yFv-KS-nEy"/>
                 <outlet property="separator" destination="Egg-cb-EhZ" id="uhq-Nc-z8K"/>
             </connections>
-            <point key="canvasLocation" x="97.599999999999994" y="129.53523238380811"/>
+            <point key="canvasLocation" x="97.599999999999994" y="144.82758620689657"/>
         </collectionViewCell>
     </objects>
 </document>

+ 23 - 8
iOSClient/Transfers/NCTransfers.swift

@@ -43,7 +43,7 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate  {
     override func viewDidLoad() {
         super.viewDidLoad()
         
-        listLayout.itemHeight = 100
+        listLayout.itemHeight = 115
     }
     
     override func viewWillAppear(_ animated: Bool) {
@@ -229,13 +229,20 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate  {
             
         cell.objectId = metadata.ocId
         cell.indexPath = indexPath
+        
+        cell.imageItem.image = nil
+        cell.imageItem.backgroundColor = nil
+        
         cell.labelTitle.text = metadata.fileNameView
         cell.labelTitle.textColor = NCBrandColor.sharedInstance.textView
-        cell.separator.backgroundColor = NCBrandColor.sharedInstance.separator
+        
+        let serverUrlHome = NCUtility.shared.getHomeServer(urlBase: metadata.urlBase, account: metadata.account)
+        cell.labelPath.text = metadata.serverUrl.replacingOccurrences(of: serverUrlHome, with: "")
+        
         cell.setButtonMore(named: k_buttonMoreStop, image: NCCollectionCommon.images.cellButtonStop)
-        cell.imageItem.image = nil
-        cell.imageItem.backgroundColor = nil
+
         cell.progressView.progress = 0.0
+        cell.separator.backgroundColor = NCBrandColor.sharedInstance.separator
                 
         if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) {
             cell.imageItem.image =  UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
@@ -272,24 +279,32 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate  {
         // Write status on Label Info
         switch metadata.status {
         case Int(k_metadataStatusWaitDownload):
-            cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - " + NSLocalizedString("_status_wait_download_", comment: "")
+            cell.labelStatus.text = NSLocalizedString("_status_wait_download_", comment: "")
+            cell.labelInfo.text = CCUtility.transformedSize(metadata.size)
             break
         case Int(k_metadataStatusInDownload):
-            cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - " + NSLocalizedString("_status_in_download_", comment: "")
+            cell.labelStatus.text = NSLocalizedString("_status_in_download_", comment: "")
+            cell.labelInfo.text = CCUtility.transformedSize(metadata.size)
             break
         case Int(k_metadataStatusDownloading):
+            cell.labelStatus.text = NSLocalizedString("_status_downloading_", comment: "")
             cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - ↓ " + CCUtility.transformedSize(totalBytes)
             break
         case Int(k_metadataStatusWaitUpload):
-            cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - " + NSLocalizedString("_status_wait_upload_", comment: "")
+            cell.labelStatus.text = NSLocalizedString("_status_wait_upload_", comment: "")
+            cell.labelInfo.text = CCUtility.transformedSize(metadata.size)
             break
         case Int(k_metadataStatusInUpload):
-            cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - " + NSLocalizedString("_status_in_upload_", comment: "")
+            cell.labelStatus.text = NSLocalizedString("_status_in_upload_", comment: "")
+            cell.labelInfo.text = CCUtility.transformedSize(metadata.size)
             break
         case Int(k_metadataStatusUploading):
+            cell.labelStatus.text = NSLocalizedString("_status_uploading_", comment: "")
             cell.labelInfo.text = CCUtility.transformedSize(metadata.size) + " - ↑ " + CCUtility.transformedSize(totalBytes)
             break
         default:
+            cell.labelStatus.text = ""
+            cell.labelInfo.text = ""
             break
         }