marinofaggiana 3 years ago
parent
commit
e8ef90d905

+ 7 - 3
Nextcloud.xcodeproj/xcshareddata/xcschemes/Share.xcscheme

@@ -66,8 +66,12 @@
       debugServiceExtension = "internal"
       allowLocationSimulation = "YES"
       launchAutomaticallySubstyle = "2">
-      <BuildableProductRunnable
-         runnableDebuggingMode = "0">
+      <RemoteRunnable
+         runnableDebuggingMode = "1"
+         BundleIdentifier = "it.twsweb.Nextcloud"
+         RemotePath = "/Users/marinofaggiana/Library/Developer/CoreSimulator/Devices/4DBB1715-4E24-4CE7-B67C-CA327B95130C/data/Containers/Bundle/Application/F427D7FF-1632-4BB9-ADEA-A094898BB6C7/Nextcloud.app">
+      </RemoteRunnable>
+      <MacroExpansion>
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
@@ -75,7 +79,7 @@
             BlueprintName = "Nextcloud"
             ReferencedContainer = "container:Nextcloud.xcodeproj">
          </BuildableReference>
-      </BuildableProductRunnable>
+      </MacroExpansion>
    </LaunchAction>
    <ProfileAction
       buildConfiguration = "Release"

+ 31 - 9
Share/MainInterface.storyboard

@@ -18,7 +18,7 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="0HI-k1-SD0">
-                                <rect key="frame" x="0.0" y="88" width="414" height="618"/>
+                                <rect key="frame" x="0.0" y="88" width="414" height="418"/>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                 <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="D7P-75-aB1">
                                     <size key="itemSize" width="0.0" height="0.0"/>
@@ -33,7 +33,7 @@
                                 </connections>
                             </collectionView>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FaV-kz-PEs">
-                                <rect key="frame" x="0.0" y="706" width="414" height="190"/>
+                                <rect key="frame" x="0.0" y="506" width="414" height="390"/>
                                 <subviews>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LAs-iQ-u1X">
                                         <rect key="frame" x="0.0" y="0.0" width="414" height="1"/>
@@ -43,7 +43,7 @@
                                         </constraints>
                                     </view>
                                     <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="eU0-LW-AnG">
-                                        <rect key="frame" x="10" y="71" width="394" height="49"/>
+                                        <rect key="frame" x="10" y="71" width="394" height="249"/>
                                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                         <prototypes>
                                             <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" rowHeight="50" id="6Kt-n0-i8J">
@@ -54,25 +54,45 @@
                                                     <autoresizingMask key="autoresizingMask"/>
                                                     <subviews>
                                                         <imageView clipsSubviews="YES" userInteractionEnabled="NO" tag="10" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="uvl-De-S9p">
-                                                            <rect key="frame" x="15" y="5" width="40" height="40"/>
+                                                            <rect key="frame" x="10" y="5" width="40" height="40"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="width" constant="40" id="Vpb-6e-ta9"/>
                                                                 <constraint firstAttribute="height" constant="40" id="wvf-Ey-woY"/>
                                                             </constraints>
                                                         </imageView>
                                                         <label opaque="NO" userInteractionEnabled="NO" tag="20" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rz6-pe-DB5">
-                                                            <rect key="frame" x="70" y="16.666666666666668" width="309" height="17.000000000000004"/>
+                                                            <rect key="frame" x="65" y="16.666666666666668" width="239" height="17.000000000000004"/>
                                                             <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                             <nil key="textColor"/>
                                                             <nil key="highlightedColor"/>
                                                         </label>
+                                                        <button opaque="NO" tag="40" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IuC-L6-qiR" customClass="NCShareExtensionButtonWithIndexPath" customModule="Share" customModuleProvider="target">
+                                                            <rect key="frame" x="354" y="10" width="30" height="30"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="30" id="3XV-qh-jr1"/>
+                                                                <constraint firstAttribute="width" constant="30" id="m0B-4w-DHZ"/>
+                                                            </constraints>
+                                                            <state key="normal" image="trash"/>
+                                                        </button>
+                                                        <button opaque="NO" tag="30" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OGY-95-ZYi" customClass="NCShareExtensionButtonWithIndexPath" customModule="Share" customModuleProvider="target">
+                                                            <rect key="frame" x="314" y="10" width="30" height="30"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="30" id="QqR-Uw-RnV"/>
+                                                                <constraint firstAttribute="width" constant="30" id="bpm-t5-3HA"/>
+                                                            </constraints>
+                                                            <state key="normal" image="pencil"/>
+                                                        </button>
                                                     </subviews>
                                                     <constraints>
                                                         <constraint firstItem="rz6-pe-DB5" firstAttribute="centerY" secondItem="WGN-Zn-lR8" secondAttribute="centerY" id="Ag7-Ow-Ifk"/>
+                                                        <constraint firstItem="IuC-L6-qiR" firstAttribute="centerY" secondItem="WGN-Zn-lR8" secondAttribute="centerY" id="AxC-3a-bqV"/>
+                                                        <constraint firstItem="OGY-95-ZYi" firstAttribute="centerY" secondItem="WGN-Zn-lR8" secondAttribute="centerY" id="Mgu-E2-kgA"/>
                                                         <constraint firstItem="uvl-De-S9p" firstAttribute="centerY" secondItem="WGN-Zn-lR8" secondAttribute="centerY" id="bFC-cS-ePy"/>
+                                                        <constraint firstItem="IuC-L6-qiR" firstAttribute="leading" secondItem="OGY-95-ZYi" secondAttribute="trailing" constant="10" id="bxW-xG-SAD"/>
                                                         <constraint firstItem="rz6-pe-DB5" firstAttribute="leading" secondItem="uvl-De-S9p" secondAttribute="trailing" constant="15" id="f94-aJ-igq"/>
-                                                        <constraint firstItem="uvl-De-S9p" firstAttribute="leading" secondItem="WGN-Zn-lR8" secondAttribute="leading" constant="15" id="ko0-iM-oWa"/>
-                                                        <constraint firstAttribute="trailing" secondItem="rz6-pe-DB5" secondAttribute="trailing" constant="15" id="mZN-du-84X"/>
+                                                        <constraint firstItem="uvl-De-S9p" firstAttribute="leading" secondItem="WGN-Zn-lR8" secondAttribute="leading" constant="10" id="ko0-iM-oWa"/>
+                                                        <constraint firstAttribute="trailing" secondItem="IuC-L6-qiR" secondAttribute="trailing" constant="10" id="uqY-rn-Ol1"/>
+                                                        <constraint firstItem="OGY-95-ZYi" firstAttribute="leading" secondItem="rz6-pe-DB5" secondAttribute="trailing" constant="10" id="vCb-2c-vWa"/>
                                                     </constraints>
                                                 </tableViewCellContentView>
                                                 <inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
@@ -90,7 +110,7 @@
                                         <nil key="highlightedColor"/>
                                     </label>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1xT-vl-sQp">
-                                        <rect key="frame" x="175" y="130" width="64" height="30"/>
+                                        <rect key="frame" x="175" y="330" width="64" height="30"/>
                                         <state key="normal" title="save files"/>
                                         <connections>
                                             <action selector="actionUpload:" destination="VYq-xA-D35" eventType="touchUpInside" id="ENy-P1-SDo"/>
@@ -111,7 +131,7 @@
                                 <color key="backgroundColor" systemColor="systemGray6Color"/>
                                 <constraints>
                                     <constraint firstItem="eU0-LW-AnG" firstAttribute="top" secondItem="LAs-iQ-u1X" secondAttribute="bottom" constant="70" id="14j-96-VwG"/>
-                                    <constraint firstAttribute="height" constant="190" id="50u-lA-AUo"/>
+                                    <constraint firstAttribute="height" constant="390" id="50u-lA-AUo"/>
                                     <constraint firstAttribute="bottom" secondItem="1xT-vl-sQp" secondAttribute="bottom" constant="30" id="7vg-42-5oO"/>
                                     <constraint firstItem="eU0-LW-AnG" firstAttribute="leading" secondItem="FaV-kz-PEs" secondAttribute="leading" constant="10" id="E40-Ul-MEV"/>
                                     <constraint firstItem="WHW-J5-8gq" firstAttribute="leading" secondItem="FaV-kz-PEs" secondAttribute="leading" constant="10" id="FQu-Xp-l7a"/>
@@ -183,6 +203,8 @@
     </scenes>
     <resources>
         <image name="folder" width="300" height="300"/>
+        <image name="pencil" width="16" height="16"/>
+        <image name="trash" width="512" height="512"/>
         <systemColor name="separatorColor">
             <color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.28999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>

+ 56 - 13
Share/NCShareExtension.swift

@@ -64,6 +64,30 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
     private let refreshControl = UIRefreshControl()
     private var activeAccount: tableAccount!
         
+    // COLOR
+    
+    var labelColor: UIColor {
+        get {
+            if #available(iOS 13, *) {
+                return .label
+            } else {
+                return .black
+            }
+        }
+    }
+    
+    var separatorColor: UIColor {
+        get {
+            if #available(iOS 13, *) {
+                return .separator
+            } else {
+                return UIColor(hex: "#3C3C434A")!
+            }
+        }
+    }
+   
+    // MARK: - Life Cycle
+
     override func viewDidLoad() {
         super.viewDidLoad()
         
@@ -81,10 +105,10 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
         
         // Empty
         emptyDataSet = NCEmptyDataSet.init(view: collectionView, offset: -50, delegate: self)
-        separatorView.backgroundColor = NCBrandColor.shared.separator
-        tableView.separatorColor = .red //NCBrandColor.shared.separator
-        tableView.layer.borderColor = NCBrandColor.shared.separator.cgColor
-        tableView.layer.borderWidth = 1.0
+        separatorView.backgroundColor = separatorColor
+        tableView.separatorColor = separatorColor
+        //tableView.layer.borderColor = separatorColor.cgColor
+        tableView.layer.borderWidth = 0
         tableView.layer.cornerRadius = 10.0
         tableView.tableFooterView = UIView(frame: CGRect(origin: .zero, size: CGSize(width: 0, height: 1)))
         createFolderLabel.text = NSLocalizedString("_create_folder_", comment: "")
@@ -167,11 +191,8 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
     override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
         super.traitCollectionDidChange(previousTraitCollection)
         
-        if traitCollection.userInterfaceStyle == .dark {
-            
-        } else {
-            
-        }
+        collectionView.reloadData()
+        tableView.reloadData()
     }
     
     // MARK: -
@@ -297,10 +318,17 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
         setNavigationBar()
     }
     
-    @objc func profileButtonTapped(sender: Any) {
+    @objc func renameButtonPressed(sender: NCShareExtensionButtonWithIndexPath) {
         
     }
     
+    @objc func deleteButtonPressed(sender: NCShareExtensionButtonWithIndexPath) {
+        
+    }
+    
+    @objc func profileButtonTapped(sender: Any) {
+    }
+    
     func tapShareListItem(with objectId: String, sender: Any) {
     }
     
@@ -370,8 +398,9 @@ extension NCShareExtension: UICollectionViewDataSource {
         cell.objectId = metadata.ocId
         cell.indexPath = indexPath
         cell.labelTitle.text = metadata.fileNameView
-        cell.labelTitle.textColor = NCBrandColor.shared.textView
-        cell.separator.backgroundColor = NCBrandColor.shared.separator
+        cell.labelTitle.textColor = labelColor
+        cell.separator.backgroundColor = separatorColor
+        cell.separatorHeight(size: 0.5)
         
         cell.imageSelect.image = nil
         cell.imageStatus.image = nil
@@ -513,7 +542,9 @@ extension NCShareExtension: UITableViewDataSource {
        
         let imageCell = cell.viewWithTag(10) as? UIImageView
         let fileNameCell = cell.viewWithTag(20) as? UILabel
-        
+        let renameButton = cell.viewWithTag(30) as? NCShareExtensionButtonWithIndexPath
+        let deleteButton = cell.viewWithTag(40) as? NCShareExtensionButtonWithIndexPath
+
         imageCell?.layer.cornerRadius = 6
         imageCell?.layer.masksToBounds = true
 
@@ -525,6 +556,14 @@ extension NCShareExtension: UITableViewDataSource {
         
         fileNameCell?.text = fileName
         
+        renameButton?.setImage(NCUtility.shared.loadImage(named: "pencil").image(color: labelColor, size: 15), for: .normal)
+        renameButton?.indexPath = indexPath
+        renameButton?.addTarget(self, action:#selector(renameButtonPressed(sender:)), for: .touchUpInside)
+
+        deleteButton?.setImage(NCUtility.shared.loadImage(named: "trash").image(color: .red, size: 15), for: .normal)
+        deleteButton?.indexPath = indexPath
+        deleteButton?.addTarget(self, action:#selector(deleteButtonPressed(sender:)), for: .touchUpInside)
+        
         return cell
     }
 }
@@ -744,3 +783,7 @@ extension NCShareExtension {
         }
     }
 }
+
+class NCShareExtensionButtonWithIndexPath: UIButton {
+    var indexPath:IndexPath?
+}

+ 6 - 1
iOSClient/Main/Collection Common/NCListCell.swift

@@ -47,7 +47,8 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCImageCell
     @IBOutlet weak var progressView: UIProgressView!
     
     @IBOutlet weak var separator: UIView!
-    
+    @IBOutlet weak var separatorHeightConstraint: NSLayoutConstraint!
+
     var filePreviewImageView : UIImageView {
         get{
          return imageItem
@@ -147,6 +148,10 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCImageCell
             separator.isHidden = false
         }
     }
+    
+    func separatorHeight(size: CGFloat) {
+        separatorHeightConstraint.constant = size
+    }
 }
 
 protocol NCListCellDelegate {

+ 1 - 0
iOSClient/Main/Collection Common/NCListCell.xib

@@ -161,6 +161,7 @@
                 <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"/>
+                <outlet property="separatorHeightConstraint" destination="G5S-67-boG" id="B6g-qe-MTb"/>
             </connections>
             <point key="canvasLocation" x="97.599999999999994" y="129.53523238380811"/>
         </collectionViewCell>