Browse Source

dev select

Marino Faggiana 6 years ago
parent
commit
2061619f0e
2 changed files with 32 additions and 18 deletions
  1. 9 9
      iOSClient/Select/NCSelect.storyboard
  2. 23 9
      iOSClient/Select/NCSelect.swift

+ 9 - 9
iOSClient/Select/NCSelect.storyboard

@@ -36,15 +36,15 @@
                             <toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2ha-lH-BXy">
                                 <rect key="frame" x="0.0" y="623" width="375" height="44"/>
                                 <items>
-                                    <barButtonItem title="Left" id="CIy-cf-IQn">
+                                    <barButtonItem title="Create Folder" id="CIy-cf-IQn">
                                         <connections>
-                                            <action selector="actionToolbarButtonLeft:" destination="VYq-xA-D35" id="kgc-Ce-adE"/>
+                                            <action selector="actionCreateFolder:" destination="VYq-xA-D35" id="zc8-7d-P1H"/>
                                         </connections>
                                     </barButtonItem>
                                     <barButtonItem style="plain" systemItem="flexibleSpace" id="mLU-GT-QAB"/>
-                                    <barButtonItem title="Right" id="tL8-Fx-8pT">
+                                    <barButtonItem title="Done" id="tL8-Fx-8pT">
                                         <connections>
-                                            <action selector="actioToolbarButtonRight:" destination="VYq-xA-D35" id="zcv-wE-Noj"/>
+                                            <action selector="actionDone:" destination="VYq-xA-D35" id="W2N-PO-qPY"/>
                                         </connections>
                                     </barButtonItem>
                                 </items>
@@ -63,17 +63,17 @@
                         <viewLayoutGuide key="safeArea" id="vaA-85-uNN"/>
                     </view>
                     <navigationItem key="navigationItem" id="N5K-De-4CP">
-                        <barButtonItem key="rightBarButtonItem" title="Right" id="qHj-AF-EN7">
+                        <barButtonItem key="rightBarButtonItem" title="Cancel" id="qHj-AF-EN7">
                             <connections>
-                                <action selector="actionNavigationButtonRight:" destination="VYq-xA-D35" id="H7V-FR-TAf"/>
+                                <action selector="actionCancel:" destination="VYq-xA-D35" id="LRW-H2-pbh"/>
                             </connections>
                         </barButtonItem>
                     </navigationItem>
                     <connections>
+                        <outlet property="buttonCancel" destination="qHj-AF-EN7" id="Fky-XJ-BxL"/>
+                        <outlet property="buttonCreateFolder" destination="CIy-cf-IQn" id="hwe-th-X6G"/>
+                        <outlet property="buttonDone" destination="tL8-Fx-8pT" id="423-ev-cSf"/>
                         <outlet property="collectionView" destination="0HI-k1-SD0" id="xme-mG-bnz"/>
-                        <outlet property="navigationButtonRight" destination="qHj-AF-EN7" id="ijb-ca-mcN"/>
-                        <outlet property="toolbarButtonLeft" destination="CIy-cf-IQn" id="t5v-Og-7hE"/>
-                        <outlet property="toolbarButtonRight" destination="tL8-Fx-8pT" id="LcJ-Ni-K2m"/>
                     </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="vH8-UY-9MN" userLabel="First Responder" sceneMemberID="firstResponder"/>

+ 23 - 9
iOSClient/Select/NCSelect.swift

@@ -23,19 +23,21 @@
 
 import Foundation
 
-class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate  {
+class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
     
     @IBOutlet fileprivate weak var collectionView: UICollectionView!
     
-    @IBOutlet fileprivate weak var navigationButtonRight: UIBarButtonItem!
-
-    @IBOutlet fileprivate weak var toolbarButtonLeft: UIBarButtonItem!
-    @IBOutlet fileprivate weak var toolbarButtonRight: UIBarButtonItem!
+    @IBOutlet fileprivate weak var buttonCancel: UIBarButtonItem!
+    @IBOutlet fileprivate weak var buttonCreateFolder: UIBarButtonItem!
+    @IBOutlet fileprivate weak var buttonDone: UIBarButtonItem!
 
     var titleCurrentFolder = NSLocalizedString("_select_", comment: "")
     var serverUrl = ""
     var directoryID = ""
     
+    var includeDirectoryE2EEncryption = false
+    var includeImages = false
+    
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     
     private var isEditMode = false
@@ -149,16 +151,15 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
         return true
     }
     
-    
     // MARK: ACTION
     
-    @IBAction func actionNavigationButtonRight(_ sender: Any) {
+    @IBAction func actionCancel(_ sender: Any) {
     }
     
-    @IBAction func actioToolbarButtonRight(_ sender: Any) {
+    @IBAction func actionDone(_ sender: Any) {
     }
     
-    @IBAction func actionToolbarButtonLeft(_ sender: Any) {
+    @IBAction func actionCreateFolder(_ sender: Any) {
     }
     
     // MARK: TAP EVENT
@@ -387,6 +388,17 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
     
     // MARK: NC API
     
+    func createFolder(with fileName: String) {
+        
+        let ocNetworking = OCnetworking.init(delegate: self, metadataNet: nil, withUser: appDelegate.activeUser, withUserID: appDelegate.activeUserID, withPassword: appDelegate.activePassword, withUrl: appDelegate.activeUrl)
+
+        ocNetworking?.createFolder(fileName, serverUrl: serverUrl, account: appDelegate.activeAccount, success: { (fileID, date) in
+            self.loadDatasource(withLoadFolder: true)
+        }, failure: { (message, errorCode) in
+            self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+        })
+    }
+    
     func downloadThumbnail(with metadata: tableMetadata, indexPath: IndexPath) {
         
         let width = NCUtility.sharedInstance.getScreenWidthForPreview()
@@ -693,6 +705,8 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
             
             nc.directoryID = directoryIDPush
             nc.serverUrl = serverUrlPush
+            nc.includeDirectoryE2EEncryption = includeDirectoryE2EEncryption
+            nc.includeImages = includeImages
             nc.titleCurrentFolder = metadata.fileNameView
             
             self.navigationController?.pushViewController(nc, animated: true)