Эх сурвалжийг харах

add tags

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 жил өмнө
parent
commit
dfa8d45036

+ 17 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -464,6 +464,7 @@
 		F7A0D1352591FBC5008F8A13 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extension.swift */; };
 		F7A0D1362591FBC5008F8A13 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extension.swift */; };
 		F7A0D1372591FBC5008F8A13 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extension.swift */; };
+		F7A1050E29E587AF00FFD92B /* TagListView in Frameworks */ = {isa = PBXBuildFile; productRef = F7A1050D29E587AF00FFD92B /* TagListView */; };
 		F7A321AD1E9E6AD50069AD1B /* CCAdvanced.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */; };
 		F7A48413297022E000BD1B49 /* ViewerQuickLook.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A48412297022E000BD1B49 /* ViewerQuickLook.swift */; };
 		F7A48415297028FC00BD1B49 /* Nextcloud Hub.png in Resources */ = {isa = PBXBuildFile; fileRef = F7A48414297028FC00BD1B49 /* Nextcloud Hub.png */; };
@@ -1331,6 +1332,7 @@
 				F76DA963277B760E0082465B /* Queuer in Frameworks */,
 				F72AD70D28C24B93006CB92D /* NextcloudKit in Frameworks */,
 				F70B86752642CE3B00ED5349 /* FirebaseCrashlytics in Frameworks */,
+				F7A1050E29E587AF00FFD92B /* TagListView in Frameworks */,
 				F76DA969277B77EA0082465B /* DropDown in Frameworks */,
 				F75EAED826D2552E00F4320E /* MarqueeLabel in Frameworks */,
 				F710FC7A277B7D0000AA9FBF /* Realm in Frameworks */,
@@ -2551,6 +2553,7 @@
 				F77BC3EA293E5268005F2B08 /* Swifter */,
 				F7D56B192972405500FA46C4 /* Mantis */,
 				F787AC08298BCB4A0001BB00 /* SVGKitSwift */,
+				F7A1050D29E587AF00FFD92B /* TagListView */,
 			);
 			productName = "Crypto Cloud";
 			productReference = F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */;
@@ -2709,6 +2712,7 @@
 				F77333862927A72100466E35 /* XCRemoteSwiftPackageReference "OpenSSL" */,
 				F77BC3E9293E5268005F2B08 /* XCRemoteSwiftPackageReference "swifter" */,
 				F7D56B182972405400FA46C4 /* XCRemoteSwiftPackageReference "Mantis" */,
+				F7A1050C29E587AF00FFD92B /* XCRemoteSwiftPackageReference "TagListView" */,
 			);
 			productRefGroup = F7F67B9F1A24D27800EE80DA;
 			projectDirPath = "";
@@ -4270,6 +4274,14 @@
 				minimumVersion = 1.7.1;
 			};
 		};
+		F7A1050C29E587AF00FFD92B /* XCRemoteSwiftPackageReference "TagListView" */ = {
+			isa = XCRemoteSwiftPackageReference;
+			repositoryURL = "https://github.com/ElaWorkshop/TagListView";
+			requirement = {
+				kind = upToNextMajorVersion;
+				minimumVersion = 1.0.0;
+			};
+		};
 		F7BB7E4527A18C56009B9F29 /* XCRemoteSwiftPackageReference "Parchment" */ = {
 			isa = XCRemoteSwiftPackageReference;
 			repositoryURL = "https://github.com/rechsteiner/Parchment";
@@ -4487,6 +4499,11 @@
 			package = F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */;
 			productName = MarkdownKit;
 		};
+		F7A1050D29E587AF00FFD92B /* TagListView */ = {
+			isa = XCSwiftPackageProductDependency;
+			package = F7A1050C29E587AF00FFD92B /* XCRemoteSwiftPackageReference "TagListView" */;
+			productName = TagListView;
+		};
 		F7A8D72328F1771B008BBE1C /* NextcloudKit */ = {
 			isa = XCSwiftPackageProductDependency;
 			package = F783034028B511D200B84583 /* XCRemoteSwiftPackageReference "NextcloudKit" */;

+ 37 - 4
iOSClient/Share/NCShareHeaderView.xib

@@ -4,13 +4,14 @@
     <dependencies>
         <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
+        <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"/>
         <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="NCShareHeaderView" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="474" height="137"/>
+            <rect key="frame" x="0.0" y="0.0" width="535" height="323"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
             <subviews>
                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="79H-PA-1m2">
@@ -21,7 +22,7 @@
                     </constraints>
                 </imageView>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="headTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n1G-pn-D8s" customClass="MarqueeLabel" customModule="MarqueeLabel">
-                    <rect key="frame" x="95" y="8" width="369" height="18"/>
+                    <rect key="frame" x="95" y="8" width="430" height="18"/>
                     <fontDescription key="fontDescription" type="system" pointSize="15"/>
                     <nil key="textColor"/>
                     <nil key="highlightedColor"/>
@@ -59,7 +60,7 @@
                     <nil key="highlightedColor"/>
                 </label>
                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zBQ-CU-9KH">
-                    <rect key="frame" x="414" y="33.5" width="50" height="20"/>
+                    <rect key="frame" x="475" y="33.5" width="50" height="20"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="50" id="0dv-3H-XVk"/>
                         <constraint firstAttribute="height" constant="20" id="UVW-of-LtA"/>
@@ -71,23 +72,48 @@
                         <action selector="touchUpInsideDetails:" destination="iN0-l3-epB" eventType="touchUpInside" id="6SM-Tx-oCY"/>
                     </connections>
                 </button>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Oip-s8-GXI" customClass="TagListView" customModule="TagListView">
+                    <rect key="frame" x="10" y="90" width="515" height="233"/>
+                    <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="5"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="1"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="color" keyPath="tagBackgroundColor">
+                            <color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                            <color key="value" systemColor="systemGrayColor"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="color" keyPath="textColor">
+                            <color key="value" systemColor="systemGrayColor"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
             </subviews>
             <constraints>
                 <constraint firstAttribute="trailing" secondItem="n1G-pn-D8s" secondAttribute="trailing" constant="10" id="0ss-6p-laS"/>
                 <constraint firstItem="fMu-na-A5C" firstAttribute="leading" secondItem="79H-PA-1m2" secondAttribute="trailing" constant="15" id="465-m3-yEK"/>
                 <constraint firstItem="79H-PA-1m2" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="10" id="4s8-dQ-pZc"/>
+                <constraint firstAttribute="trailing" secondItem="Oip-s8-GXI" secondAttribute="trailing" constant="10" id="5di-fM-tIx"/>
                 <constraint firstItem="79H-PA-1m2" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="8Pt-Zl-gmo"/>
                 <constraint firstItem="n1G-pn-D8s" firstAttribute="leading" secondItem="79H-PA-1m2" secondAttribute="trailing" constant="15" id="9E4-gA-8Pl"/>
                 <constraint firstItem="fMu-na-A5C" firstAttribute="top" secondItem="9Ka-tq-Zu3" secondAttribute="bottom" constant="1" id="CDG-G0-9j0"/>
                 <constraint firstItem="EaW-fI-EmD" firstAttribute="trailing" secondItem="79H-PA-1m2" secondAttribute="trailing" constant="5" id="CFN-yC-74Q"/>
+                <constraint firstAttribute="bottom" secondItem="Oip-s8-GXI" secondAttribute="bottom" id="ExB-DE-fok"/>
                 <constraint firstItem="zBQ-CU-9KH" firstAttribute="centerY" secondItem="bOQ-tC-40T" secondAttribute="centerY" id="LWk-jf-P5S"/>
                 <constraint firstAttribute="trailing" secondItem="zBQ-CU-9KH" secondAttribute="trailing" constant="10" id="PRm-kq-66J"/>
                 <constraint firstItem="9Ka-tq-Zu3" firstAttribute="top" secondItem="bOQ-tC-40T" secondAttribute="bottom" constant="5" id="RUS-Ib-asS"/>
                 <constraint firstItem="bOQ-tC-40T" firstAttribute="leading" secondItem="79H-PA-1m2" secondAttribute="trailing" constant="15" id="X9i-0r-AYA"/>
                 <constraint firstItem="9Ka-tq-Zu3" firstAttribute="leading" secondItem="79H-PA-1m2" secondAttribute="trailing" constant="15" id="boF-Gc-sBr"/>
                 <constraint firstItem="bOQ-tC-40T" firstAttribute="top" secondItem="n1G-pn-D8s" secondAttribute="bottom" constant="10" id="dgl-uw-rsa"/>
+                <constraint firstItem="Oip-s8-GXI" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="10" id="fi8-aR-NbH"/>
                 <constraint firstItem="n1G-pn-D8s" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="8" id="gf7-1r-fAJ"/>
                 <constraint firstItem="79H-PA-1m2" firstAttribute="top" secondItem="EaW-fI-EmD" secondAttribute="top" constant="5" id="nhT-z8-S6d"/>
+                <constraint firstItem="Oip-s8-GXI" firstAttribute="top" secondItem="79H-PA-1m2" secondAttribute="bottom" constant="10" id="ypK-eu-qf2"/>
             </constraints>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
@@ -97,9 +123,10 @@
                 <outlet property="imageView" destination="79H-PA-1m2" id="t6m-wr-OQ5"/>
                 <outlet property="info" destination="bOQ-tC-40T" id="N7R-YH-Xek"/>
                 <outlet property="path" destination="n1G-pn-D8s" id="ckb-qc-lqb"/>
+                <outlet property="tagListView" destination="Oip-s8-GXI" id="Dw8-uA-DCN"/>
                 <outlet property="upload" destination="fMu-na-A5C" id="Eun-KE-xTc"/>
             </connections>
-            <point key="canvasLocation" x="-12.67605633802817" y="79.6875"/>
+            <point key="canvasLocation" x="19.54225352112676" y="254.0625"/>
         </view>
     </objects>
     <designables>
@@ -109,5 +136,11 @@
     </designables>
     <resources>
         <image name="star.fill" width="512" height="512"/>
+        <systemColor name="systemBackgroundColor">
+            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
+        <systemColor name="systemGrayColor">
+            <color red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+        </systemColor>
     </resources>
 </document>

+ 15 - 2
iOSClient/Share/NCSharePaging.swift

@@ -26,6 +26,7 @@ import UIKit
 import Parchment
 import NextcloudKit
 import MarqueeLabel
+import TagListView
 
 protocol NCSharePagingContent {
     var textField: UITextField? { get }
@@ -216,7 +217,7 @@ extension NCSharePaging: PagingViewControllerDataSource {
 
     func pagingViewController(_: PagingViewController, viewControllerAt index: Int) -> UIViewController {
 
-        let height = pagingViewController.options.menuHeight + NCSharePagingView.headerHeight
+        let height = pagingViewController.options.menuHeight + NCSharePagingView.headerHeight + NCSharePagingView.tagHeaderHeight
 
         switch NCGlobal.NCSharePagingIndex(rawValue: index) {
         case .activity:
@@ -295,6 +296,7 @@ class NCShareHeaderViewController: PagingViewController {
 class NCSharePagingView: PagingView {
 
     static let headerHeight: CGFloat = 90
+    static var tagHeaderHeight: CGFloat = 0
     var metadata = tableMetadata()
 
     public var headerHeightConstraint: NSLayoutConstraint?
@@ -356,6 +358,16 @@ class NCSharePagingView: PagingView {
         headerView.details.layer.masksToBounds = true
         headerView.details.layer.backgroundColor = UIColor(red: 152.0 / 255.0, green: 167.0 / 255.0, blue: 181.0 / 255.0, alpha: 0.8).cgColor
 
+        for tag in metadata.tags {
+            headerView.tagListView.addTag(tag)
+        }
+
+        if metadata.tags.isEmpty {
+            NCSharePagingView.tagHeaderHeight = 0
+        } else {
+            NCSharePagingView.tagHeaderHeight = headerView.tagListView.intrinsicContentSize.height + 10
+        }
+
         addSubview(headerView)
 
         collectionView.translatesAutoresizingMaskIntoConstraints = false
@@ -371,7 +383,7 @@ class NCSharePagingView: PagingView {
             headerView.topAnchor.constraint(equalTo: topAnchor),
             headerView.leadingAnchor.constraint(equalTo: leadingAnchor),
             headerView.trailingAnchor.constraint(equalTo: trailingAnchor),
-            headerView.heightAnchor.constraint(equalToConstant: NCSharePagingView.headerHeight),
+            headerView.heightAnchor.constraint(equalToConstant: NCSharePagingView.headerHeight + NCSharePagingView.tagHeaderHeight),
 
             pageView.leadingAnchor.constraint(equalTo: leadingAnchor),
             pageView.trailingAnchor.constraint(equalTo: trailingAnchor),
@@ -390,6 +402,7 @@ class NCShareHeaderView: UIView {
     @IBOutlet weak var upload: UILabel!
     @IBOutlet weak var favorite: UIButton!
     @IBOutlet weak var details: UIButton!
+    @IBOutlet weak var tagListView: TagListView!
 
     var ocId = ""