Browse Source

new view share

marinofaggiana 5 years ago
parent
commit
581173d993

+ 1 - 0
Cartfile

@@ -15,6 +15,7 @@ github "yannickl/QRCodeReader.swift" >= 10.1.0
 github "weichsel/ZIPFoundation" == 0.9.9
 github "rechsteiner/Parchment" == 1.6.0
 github "WenchaoD/FSCalendar"
+github "AssistoLab/DropDown"
 
 github "https://github.com/marinofaggiana/FastScroll" "master"
 github "https://github.com/marinofaggiana/AFNetworking" "master"

+ 1 - 0
Cartfile.resolved

@@ -1,3 +1,4 @@
+github "AssistoLab/DropDown" "v2.3.13"
 github "ChangbaDevs/KTVHTTPCache" "2.0.1"
 github "CocoaLumberjack/CocoaLumberjack" "3.5.3"
 github "MortimerGoro/MGSwipeTableCell" "1.6.8"

+ 9 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -348,6 +348,8 @@
 		F771E3F920E239B500AFB62D /* FileProviderExtension+Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3F620E239B400AFB62D /* FileProviderExtension+Network.swift */; };
 		F771E3FF20E23C3A00AFB62D /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F70A63071D5B3467004E2AA5 /* libssl.a */; };
 		F771E40020E23C3D00AFB62D /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F70A63061D5B3467004E2AA5 /* libcrypto.a */; };
+		F774264122EB3F7300B23912 /* DropDown.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F774264022EB3F7300B23912 /* DropDown.framework */; };
+		F774264A22EB4D0000B23912 /* NCShareUserDropDownCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F774264822EB4D0000B23912 /* NCShareUserDropDownCell.xib */; };
 		F77444F522281649000D5EB0 /* NCGridMediaCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77444F322281649000D5EB0 /* NCGridMediaCell.swift */; };
 		F77444F622281649000D5EB0 /* NCGridMediaCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F77444F422281649000D5EB0 /* NCGridMediaCell.xib */; };
 		F77444F8222816D5000D5EB0 /* NCPhotosPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77444F7222816D5000D5EB0 /* NCPhotosPickerViewController.swift */; };
@@ -1139,6 +1141,8 @@
 		F771E3F620E239B400AFB62D /* FileProviderExtension+Network.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FileProviderExtension+Network.swift"; sourceTree = "<group>"; };
 		F771E3FB20E23A8700AFB62D /* File_Provider_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = File_Provider_Extension.entitlements; sourceTree = "<group>"; };
 		F771E3FC20E23A8800AFB62D /* File_Provider_Extension.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = File_Provider_Extension.plist; sourceTree = "<group>"; };
+		F774264022EB3F7300B23912 /* DropDown.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DropDown.framework; path = Carthage/Build/iOS/DropDown.framework; sourceTree = "<group>"; };
+		F774264822EB4D0000B23912 /* NCShareUserDropDownCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareUserDropDownCell.xib; sourceTree = "<group>"; };
 		F77438EB1FCD694900662C46 /* ka-GE */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ka-GE"; path = "ka-GE.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F77438F21FCD69D300662C46 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F77438F91FCD6A0D00662C46 /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/Localizable.strings"; sourceTree = "<group>"; };
@@ -1540,6 +1544,7 @@
 				F7C40BEF219994ED0004137E /* KTVCocoaHTTPServer.framework in Frameworks */,
 				F7C40BF1219994F20004137E /* KTVHTTPCache.framework in Frameworks */,
 				F7C40C102199BA5D0004137E /* Realm.framework in Frameworks */,
+				F774264122EB3F7300B23912 /* DropDown.framework in Frameworks */,
 				F7D4B69B2295666E000C2C86 /* GoogleMobileVision.framework in Frameworks */,
 				F75153242226920200323DDC /* FastScroll.framework in Frameworks */,
 				F7C40C122199BA620004137E /* RealmSwift.framework in Frameworks */,
@@ -1770,6 +1775,7 @@
 				F769453B22E9CFFF000A798A /* NCShareUserCell.xib */,
 				F7DFAA8922E22EF100FC4527 /* NCShareLinkMenuView.xib */,
 				F769453D22E9E97D000A798A /* NCShareUserMenuView.xib */,
+				F774264822EB4D0000B23912 /* NCShareUserDropDownCell.xib */,
 				F769453F22E9F077000A798A /* NCSharePaging.swift */,
 				F700510422DF6A89003A3356 /* NCShare.swift */,
 				F769454122E9F0EE000A798A /* NCShareLinkMenuView.swift */,
@@ -3001,6 +3007,7 @@
 		F7FC7D541DC1F93700BB2C6A /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				F774264022EB3F7300B23912 /* DropDown.framework */,
 				F74AFCE822E8B024003DE61F /* FSCalendar.framework */,
 				F700510222DF6897003A3356 /* Parchment.framework */,
 				F7421EAE2294044B00C4B7C1 /* Accelerate.framework */,
@@ -3374,6 +3381,7 @@
 				F7F54CEC1E5B14C700E19C62 /* ImageSelectedOn@2x.png in Resources */,
 				F73B4F151F470D9100BBEE4B /* symbols.cmake in Resources */,
 				F7F54CF21E5B14C700E19C62 /* ImageSelectedSmallOn@2x.png in Resources */,
+				F774264A22EB4D0000B23912 /* NCShareUserDropDownCell.xib in Resources */,
 				F7D4233A1F0596AC009C9782 /* Reader-Button-H@3x.png in Resources */,
 				F7D423341F0596AC009C9782 /* AppIcon-120.png in Resources */,
 				F7D4234F1F0596AC009C9782 /* Reader-Thumbs@3x.png in Resources */,
@@ -3453,6 +3461,7 @@
 				"$(SRCROOT)/Carthage/Build/iOS/ZIPFoundation.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/Parchment.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/FSCalendar.framework",
+				"$(SRCROOT)/Carthage/Build/iOS/DropDown.framework",
 			);
 			outputPaths = (
 			);

+ 7 - 2
iOSClient/Share/NCShare.swift

@@ -22,6 +22,7 @@
 //
 
 import Foundation
+import UIKit
 import Parchment
 
 class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDelegate, NCShareUserCellDelegate, NCShareNetworkingDelegate {
@@ -167,7 +168,12 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
     
     func updateShareWithError(idRemoteShared: Int) { }
     
-    func getUserAndGroup(items: [OCShareUser]?) { }
+    func getUserAndGroup(items: [OCShareUser]?) {
+        
+        guard let items = items else { return }
+        
+        NCShareCommon.sharedInstance.openDropDownUser(view: self.searchField, width: 0, height: 0, items: items)
+    }
 }
 
 // MARK: - UITableViewDelegate
@@ -302,4 +308,3 @@ protocol NCShareUserCellDelegate {
     func switchCanEdit(with tableShare: tableShare?, switch: Bool, sender: Any)
     func tapMenu(with tableShare: tableShare?, sender: Any)
 }
-

+ 27 - 0
iOSClient/Share/NCShareCommon.swift

@@ -22,6 +22,7 @@
 
 import Foundation
 import FSCalendar
+import DropDown
 
 class NCShareCommon: NSObject {
     @objc static let sharedInstance: NCShareCommon = {
@@ -147,6 +148,27 @@ class NCShareCommon: NSObject {
         return(calendarView: calendar, viewWindow: viewWindow)
     }
     
+    func openDropDownUser(view: UITextField, width: CGFloat, height: CGFloat, items: [OCShareUser]) {
+        
+        let appearance = DropDown.appearance()
+        let dropDown = DropDown()
+        
+        if #available(iOS 11.0, *) {
+            appearance.setupMaskedCorners([.layerMaxXMaxYCorner, .layerMinXMaxYCorner])
+        }
+        
+        dropDown.dataSource = items.map {$0.name}
+        dropDown.anchorView = view
+        
+        dropDown.cellNib = UINib(nibName: "NCShareUserDropDownCell", bundle: nil)
+        dropDown.customCellConfiguration = { (index: Index, item: String, cell: DropDownCell) -> Void in
+            guard let cell = cell as? NCShareUserDropDownCell else { return }
+            //cell.displayName.text = item
+        }
+
+        dropDown.show()
+    }
+    
     func copyLink(tableShare: tableShare?, viewController: UIViewController) {
         
         let appDelegate = UIApplication.shared.delegate as! AppDelegate
@@ -170,3 +192,8 @@ class NCShareCommon: NSObject {
         }
     }
 }
+
+class NCShareUserDropDownCell: DropDownCell {
+    
+    @IBOutlet weak var logoImageView: UIImageView!    
+}

+ 49 - 0
iOSClient/Share/NCShareUserDropDownCell.xib

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
+        <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="NCShareUserDropDownCell" customModule="Nextcloud" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="210" height="40"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo_0" translatesAutoresizingMaskIntoConstraints="NO" id="wwI-k5-kbU">
+                    <rect key="frame" x="8" y="12" width="16" height="16"/>
+                </imageView>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="optionLabel" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VIB-Xt-ckX">
+                    <rect key="frame" x="32" y="9" width="90" height="21"/>
+                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                    <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstAttribute="bottom" secondItem="VIB-Xt-ckX" secondAttribute="bottom" constant="10" id="0zj-tF-bzC"/>
+                <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="VIB-Xt-ckX" secondAttribute="trailing" constant="8" id="OSg-Aj-BFF"/>
+                <constraint firstItem="VIB-Xt-ckX" firstAttribute="leading" secondItem="wwI-k5-kbU" secondAttribute="trailing" constant="8" id="aUx-ZS-D4Q"/>
+                <constraint firstItem="VIB-Xt-ckX" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="9" id="fWz-fu-Ghl"/>
+                <constraint firstItem="wwI-k5-kbU" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="oNR-Ox-93x"/>
+                <constraint firstItem="wwI-k5-kbU" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="xPu-SG-9dw"/>
+            </constraints>
+            <nil key="simulatedStatusBarMetrics"/>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <connections>
+                <outlet property="logoImageView" destination="wwI-k5-kbU" id="DFj-ka-K8K"/>
+                <outlet property="optionLabel" destination="VIB-Xt-ckX" id="swX-Pi-eTf"/>
+            </connections>
+            <point key="canvasLocation" x="515" y="409"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="logo_0" width="20" height="20"/>
+    </resources>
+</document>