Browse Source

new share extension

marinofaggiana 3 năm trước cách đây
mục cha
commit
7ef9e5b5a9
2 tập tin đã thay đổi với 22 bổ sung20 xóa
  1. 14 14
      Share/MainInterface.storyboard
  2. 8 6
      Share/NCShareExtension.swift

+ 14 - 14
Share/MainInterface.storyboard

@@ -61,7 +61,7 @@
                                                             </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="65" y="16.666666666666668" width="239" height="17.000000000000004"/>
+                                                            <rect key="frame" x="60" y="16.666666666666668" width="244" height="17.000000000000004"/>
                                                             <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                             <nil key="textColor"/>
                                                             <nil key="highlightedColor"/>
@@ -89,7 +89,7 @@
                                                         <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="rz6-pe-DB5" firstAttribute="leading" secondItem="uvl-De-S9p" secondAttribute="trailing" constant="10" id="f94-aJ-igq"/>
                                                         <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"/>
@@ -107,13 +107,13 @@
                                         <rect key="frame" x="10" y="10" width="394" height="50"/>
                                         <subviews>
                                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="create folder" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WHW-J5-8gq">
-                                                <rect key="frame" x="287.33333333333331" y="14.999999999999998" width="96.666666666666686" height="20.333333333333329"/>
-                                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                <rect key="frame" x="59.999999999999993" y="16.666666666666629" width="82.333333333333314" height="17"/>
+                                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
                                             </label>
-                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="R3X-g5-ZFs">
-                                                <rect key="frame" x="10" y="10" width="30" height="30"/>
+                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="R3X-g5-ZFs">
+                                                <rect key="frame" x="15" y="10" width="30" height="30"/>
                                                 <constraints>
                                                     <constraint firstAttribute="width" constant="30" id="9Qc-Ji-5yh"/>
                                                     <constraint firstAttribute="height" constant="30" id="UUM-06-R5m"/>
@@ -124,22 +124,22 @@
                                         <constraints>
                                             <constraint firstAttribute="height" constant="50" id="Py5-lr-dJD"/>
                                             <constraint firstItem="WHW-J5-8gq" firstAttribute="centerY" secondItem="Tbe-Jp-I8U" secondAttribute="centerY" id="ccx-II-bpQ"/>
+                                            <constraint firstItem="WHW-J5-8gq" firstAttribute="leading" secondItem="R3X-g5-ZFs" secondAttribute="trailing" constant="15" id="iOH-BT-dux"/>
                                             <constraint firstItem="R3X-g5-ZFs" firstAttribute="centerY" secondItem="Tbe-Jp-I8U" secondAttribute="centerY" id="mJt-qE-buH"/>
-                                            <constraint firstAttribute="trailing" secondItem="WHW-J5-8gq" secondAttribute="trailing" constant="10" id="oqd-Ag-7wU"/>
-                                            <constraint firstItem="R3X-g5-ZFs" firstAttribute="leading" secondItem="Tbe-Jp-I8U" secondAttribute="leading" constant="10" id="qgl-VD-5v8"/>
+                                            <constraint firstItem="R3X-g5-ZFs" firstAttribute="leading" secondItem="Tbe-Jp-I8U" secondAttribute="leading" constant="15" id="qgl-VD-5v8"/>
                                         </constraints>
                                     </view>
                                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kHU-CI-3gI">
                                         <rect key="frame" x="10" y="300" width="394" height="50"/>
                                         <subviews>
                                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="save files" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ka7-SC-ac5">
-                                                <rect key="frame" x="313.66666666666669" y="14.999999999999998" width="70.333333333333314" height="20.333333333333329"/>
-                                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                <rect key="frame" x="60" y="16.666666666666629" width="60" height="17"/>
+                                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
                                             </label>
-                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Gok-do-ydQ">
-                                                <rect key="frame" x="10" y="10" width="30" height="30"/>
+                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Gok-do-ydQ">
+                                                <rect key="frame" x="15" y="10" width="30" height="30"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="30" id="hof-u1-w4Q"/>
                                                     <constraint firstAttribute="width" constant="30" id="n6T-Di-HBC"/>
@@ -148,10 +148,10 @@
                                         </subviews>
                                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                         <constraints>
-                                            <constraint firstItem="Gok-do-ydQ" firstAttribute="leading" secondItem="kHU-CI-3gI" secondAttribute="leading" constant="10" id="3bo-Wd-s5E"/>
+                                            <constraint firstItem="Gok-do-ydQ" firstAttribute="leading" secondItem="kHU-CI-3gI" secondAttribute="leading" constant="15" id="3bo-Wd-s5E"/>
+                                            <constraint firstItem="ka7-SC-ac5" firstAttribute="leading" secondItem="Gok-do-ydQ" secondAttribute="trailing" constant="15" id="3xZ-bD-ssD"/>
                                             <constraint firstAttribute="height" constant="50" id="6xq-PW-8Ay"/>
                                             <constraint firstItem="Gok-do-ydQ" firstAttribute="centerY" secondItem="kHU-CI-3gI" secondAttribute="centerY" id="P9O-Ts-odZ"/>
-                                            <constraint firstAttribute="trailing" secondItem="ka7-SC-ac5" secondAttribute="trailing" constant="10" id="nYi-0s-5Qo"/>
                                             <constraint firstItem="ka7-SC-ac5" firstAttribute="centerY" secondItem="kHU-CI-3gI" secondAttribute="centerY" id="u7t-cL-zFA"/>
                                         </constraints>
                                     </view>

+ 8 - 6
Share/NCShareExtension.swift

@@ -60,7 +60,9 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
     private var groupBy = ""
     private var titleButton = ""
     private var itemForLine = 0
+    
     private var heightRowTableView: CGFloat = 50
+    private var heightCommandView: CGFloat = 170
     
     private var autoUploadFileName = ""
     private var autoUploadDirectory = ""
@@ -143,14 +145,14 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
 
         // Create folder
         createFolderView.layer.cornerRadius = 10
-        createFolderImage.image = UIImage(named: "folder")?.image(color: labelColor, size: 15)
+        createFolderImage.image = NCUtility.shared.loadImage(named: "folder.badge.plus", color: labelColor)
         createFolderLabel.text = NSLocalizedString("_create_folder_", comment: "")
         let createFolderGesture = UITapGestureRecognizer(target: self, action:  #selector(actionCreateFolder))
         createFolderView.addGestureRecognizer(createFolderGesture)
         
         // Upload
         uploadView.layer.cornerRadius = 10
-        uploadImage.image = UIImage(named: "folder")?.image(color: labelColor, size: 15)
+        uploadImage.image = NCUtility.shared.loadImage(named: "square.and.arrow.up", color: labelColor)
         uploadLabel.text = NSLocalizedString("_save_files_", comment: "")
         let uploadGesture = UITapGestureRecognizer(target: self, action:  #selector(actionUpload))
         uploadView.addGestureRecognizer(uploadGesture)
@@ -287,15 +289,15 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
     }
     
     func setCommandView() {
-        
+                
         if filesName.count == 0 {
             self.extensionContext?.completeRequest(returningItems: self.extensionContext?.inputItems, completionHandler: nil)
             return
         } else {
             if filesName.count < 3 {
-                self.commandViewHeightConstraint.constant = 140 + (self.heightRowTableView * CGFloat(filesName.count))
+                self.commandViewHeightConstraint.constant = heightCommandView + (self.heightRowTableView * CGFloat(filesName.count))
             } else  {
-                self.commandViewHeightConstraint.constant = 140 + (self.heightRowTableView * 3)
+                self.commandViewHeightConstraint.constant = heightCommandView + (self.heightRowTableView * 3)
             }
             if filesName.count <= 3 {
                 self.tableView.isScrollEnabled = false
@@ -660,7 +662,7 @@ extension NCShareExtension: UITableViewDataSource {
         imageCell?.layer.masksToBounds = true
 
         let fileName = filesName[indexPath.row]
-        imageCell?.image = NCUtility.shared.loadImage(named: "file")
+        imageCell?.image = NCUtility.shared.loadImage(named: "doc", color: NCBrandColor.shared.customer)
         if let image = UIImage(contentsOfFile: (NSTemporaryDirectory() + fileName)) {
             imageCell?.image = image
         }