Browse Source

restore menu: select folder Media

marinofaggiana 4 years ago
parent
commit
21b093fd06

+ 1 - 1
iOSClient/CCGlobal.h

@@ -85,7 +85,7 @@
 
 // Database Realm
 #define k_databaseDefault                               @"nextcloud.realm"
-#define k_databaseSchemaVersion                         132
+#define k_databaseSchemaVersion                         133
 
 // Intro selector
 #define k_intro_login                                   0

+ 1 - 0
iOSClient/Database/NCDatabase.swift

@@ -54,6 +54,7 @@ class tableAccount: Object {
     @objc dynamic var language = ""
     @objc dynamic var lastLogin: Double = 0
     @objc dynamic var locale = ""
+    @objc dynamic var mediaPath = ""
     @objc dynamic var password = ""
     @objc dynamic var phone = ""
     @objc dynamic var quota: Double = 0

+ 14 - 0
iOSClient/Database/NCManageDatabase.swift

@@ -673,6 +673,20 @@ class NCManageDatabase: NSObject {
     #endif
     */
     
+    @objc func setAccountMediaPath(_ path: String, account: String) {
+           
+        let realm = try! Realm()
+        do {
+            try realm.write {
+                if let result = realm.objects(tableAccount.self).filter("account == %@", account).first {
+                    result.mediaPath = path
+                }
+            }
+        } catch let error {
+            print("[LOG] Could not write to database: ", error)
+        }
+    }
+    
     //MARK: -
     //MARK: Table Activity
 

+ 57 - 56
iOSClient/Media/NCMedia.swift

@@ -50,6 +50,7 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
     private var newInProgress = false
     
     private var lastContentOffsetY: CGFloat = 0
+    private var mediaPath = ""
     
     struct cacheImages {
         static var cellPlayImage = UIImage()
@@ -230,7 +231,6 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
                 )
             )
             
-            /*
             actions.append(
                 NCMenuAction(
                     title: NSLocalizedString("_select_media_folder_", comment: ""),
@@ -247,18 +247,19 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
                         viewController.selectFile = false
                         viewController.titleButtonDone = NSLocalizedString("_select_", comment: "")
                         viewController.type = "mediaFolder"
+                        viewController.heightToolBarTop = 50
                         
                         navigationController.modalPresentationStyle = UIModalPresentationStyle.fullScreen
                         self.present(navigationController, animated: true, completion: nil)
                     }
                 )
             )
-            */
+            
         } else {
            
             actions.append(
                 NCMenuAction(
-                    title: NSLocalizedString("_deselect_", comment: ""),
+                    title: NSLocalizedString("_cancel_", comment: ""),
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "cancel"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
                     action: { menuAction in
                         self.isEditMode = false
@@ -297,20 +298,13 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
     // MARK: Select Path
     
     func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, buttonType: String, overwrite: Bool) {
-        /*
-        let oldStartDirectoryMediaTabView = NCManageDatabase.sharedInstance.getAccountStartDirectoryMediaTabView(CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl))
-        
-        if serverUrl != nil && serverUrl != oldStartDirectoryMediaTabView {
-            
-            // Save Start Directory
-            NCManageDatabase.sharedInstance.setAccountStartDirectoryMediaTabView(serverUrl!)
-            //
-            NCManageDatabase.sharedInstance.clearTable(tableMedia.self, account: appDelegate.activeAccount)
-            self.sectionDatasource = CCSectionDataSourceMetadata()
-            //
-            //loadNetworkDatasource()
+        if serverUrl != nil {
+            let path = CCUtility.returnPathfromServerUrl(serverUrl, activeUrl: appDelegate.activeUrl) ?? ""
+            NCManageDatabase.sharedInstance.setAccountMediaPath(path, account: appDelegate.activeAccount)
+            reloadDataSourceWithCompletion {
+                self.searchNewPhotoVideo()
+            }
         }
-        */
     }
     
     //MARK: - NotificationCenter
@@ -589,13 +583,18 @@ extension NCMedia {
     private func reloadDataSourceWithCompletion(_ completion: @escaping () -> Void) {
         
         if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) { return }
-                
+         
+        if let tableAccount = NCManageDatabase.sharedInstance.getAccountActive() {
+            self.mediaPath = tableAccount.mediaPath
+        }
+        let startServerUrl = CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl) + mediaPath
+        
         if filterTypeFileImage {
-            predicate = NSPredicate(format: "account == %@ AND typeFile == %@ AND NOT (session CONTAINS[c] 'upload')", appDelegate.activeAccount, k_metadataTypeFile_video)
+            predicate = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND typeFile == %@ AND NOT (session CONTAINS[c] 'upload')", appDelegate.activeAccount, startServerUrl, k_metadataTypeFile_video)
         } else if filterTypeFileVideo {
-            predicate = NSPredicate(format: "account == %@ AND typeFile == %@ AND NOT (session CONTAINS[c] 'upload')", appDelegate.activeAccount, k_metadataTypeFile_image)
+            predicate = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND typeFile == %@ AND NOT (session CONTAINS[c] 'upload')", appDelegate.activeAccount, startServerUrl, k_metadataTypeFile_image)
         } else {
-            predicate = NSPredicate(format: "account == %@ AND (typeFile == %@ OR typeFile == %@) AND NOT (session CONTAINS[c] 'upload')", appDelegate.activeAccount, k_metadataTypeFile_image, k_metadataTypeFile_video)
+            predicate = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND (typeFile == %@ OR typeFile == %@) AND NOT (session CONTAINS[c] 'upload')", appDelegate.activeAccount, startServerUrl, k_metadataTypeFile_image, k_metadataTypeFile_video)
         }
                 
         NCManageDatabase.sharedInstance.getMetadatasMedia(predicate: predicate!) { (metadatas) in
@@ -615,7 +614,8 @@ extension NCMedia {
     func updateMediaControlVisibility() {
         if self.metadatas.count == 0 {
             if !self.filterTypeFileImage && !self.filterTypeFileVideo {
-                self.mediaCommandView?.isHidden = true
+                self.mediaCommandView?.toggleEmptyView(isEmpty: true)
+                self.mediaCommandView?.isHidden = false
             } else {
                 self.mediaCommandView?.toggleEmptyView(isEmpty: true)
                 self.mediaCommandView?.isHidden = false
@@ -648,7 +648,7 @@ extension NCMedia {
         let height = self.tabBarController?.tabBar.frame.size.height ?? 0
         NCUtility.sharedInstance.startActivityIndicator(view: self.view, bottom: height + 50)
 
-        NCCommunication.shared.searchMedia(path: "", lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/" ,showHiddenFiles: CCUtility.getShowHiddenFiles(), user: appDelegate.activeUser) { (account, files, errorCode, errorDescription) in
+        NCCommunication.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/" ,showHiddenFiles: CCUtility.getShowHiddenFiles(), user: appDelegate.activeUser) { (account, files, errorCode, errorDescription) in
             
             self.oldInProgress = false
             NCUtility.sharedInstance.stopActivityIndicator()
@@ -679,51 +679,52 @@ extension NCMedia {
         guard var lessDate = Calendar.current.date(byAdding: .second, value: 1, to: Date()) else { return }
         guard var greaterDate = Calendar.current.date(byAdding: .day, value: -30, to: Date()) else { return }
         
-        if let visibleCells = self.collectionView?.indexPathsForVisibleItems.sorted(by: { $0.row < $1.row }).compactMap({ self.collectionView?.cellForItem(at: $0) }) {
-            if let cell = visibleCells.first as? NCGridMediaCell {
-                if cell.date != nil {
-                    if cell.date != metadatas.first?.date as Date? {
-                        lessDate = Calendar.current.date(byAdding: .second, value: 1, to: cell.date!)!
+        newInProgress = true
+        reloadDataThenPerform {
+            if let visibleCells = self.collectionView?.indexPathsForVisibleItems.sorted(by: { $0.row < $1.row }).compactMap({ self.collectionView?.cellForItem(at: $0) }) {
+                if let cell = visibleCells.first as? NCGridMediaCell {
+                    if cell.date != nil {
+                        if cell.date != self.metadatas.first?.date as Date? {
+                            lessDate = Calendar.current.date(byAdding: .second, value: 1, to: cell.date!)!
+                        }
                     }
                 }
-            }
-            if let cell = visibleCells.last as? NCGridMediaCell {
-                if cell.date != nil {
-                    greaterDate = Calendar.current.date(byAdding: .second, value: -1, to: cell.date!)!
+                if let cell = visibleCells.last as? NCGridMediaCell {
+                    if cell.date != nil {
+                        greaterDate = Calendar.current.date(byAdding: .second, value: -1, to: cell.date!)!
+                    }
                 }
             }
-        }
-        
-        newInProgress = true
-        collectionView.reloadData()
         
-        NCCommunication.shared.searchMedia(path: "", lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/" ,showHiddenFiles: CCUtility.getShowHiddenFiles(), user: appDelegate.activeUser) { (account, files, errorCode, errorDescription) in
-            
-            self.newInProgress = false
-            
-            if errorCode == 0 && account == self.appDelegate.activeAccount && files?.count ?? 0 > 0 {
-               DispatchQueue.global().async {
+
+            NCCommunication.shared.searchMedia(path: self.mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/" ,showHiddenFiles: CCUtility.getShowHiddenFiles(), user: self.appDelegate.activeUser) { (account, files, errorCode, errorDescription) in
                 
-                    let predicate = NSPredicate(format: "date > %@ AND date < %@", greaterDate as NSDate, lessDate as NSDate)
-                    let newPredicate = NSCompoundPredicate.init(andPredicateWithSubpredicates:[predicate, self.predicate!])
+                self.newInProgress = false
                 
-                    if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: newPredicate, sorted: nil, ascending: false){
-                        let etagsMetadatas = Array(metadatas.map { $0.etag })
-                        let etagsFiles = Array(files!.map { $0.etag })
-                        for etag in etagsFiles {
-                            if !etagsMetadatas.contains(etag) {
-                                NCManageDatabase.sharedInstance.addMetadatas(files: files, account: self.appDelegate.activeAccount)
-                                self.reloadDataSource()
-                                break;
+                if errorCode == 0 && account == self.appDelegate.activeAccount && files?.count ?? 0 > 0 {
+                   DispatchQueue.global().async {
+                    
+                        let predicate = NSPredicate(format: "date > %@ AND date < %@", greaterDate as NSDate, lessDate as NSDate)
+                        let newPredicate = NSCompoundPredicate.init(andPredicateWithSubpredicates:[predicate, self.predicate!])
+                    
+                        if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: newPredicate, sorted: nil, ascending: false){
+                            let etagsMetadatas = Array(metadatas.map { $0.etag })
+                            let etagsFiles = Array(files!.map { $0.etag })
+                            for etag in etagsFiles {
+                                if !etagsMetadatas.contains(etag) {
+                                    NCManageDatabase.sharedInstance.addMetadatas(files: files, account: self.appDelegate.activeAccount)
+                                    self.reloadDataSource()
+                                    break;
+                                }
                             }
+                        } else {
+                            NCManageDatabase.sharedInstance.addMetadatas(files: files, account: self.appDelegate.activeAccount)
+                            self.reloadDataSource()
                         }
-                    } else {
-                        NCManageDatabase.sharedInstance.addMetadatas(files: files, account: self.appDelegate.activeAccount)
-                        self.reloadDataSource()
                     }
+                } else if errorCode == 0 && files?.count ?? 0 == 0 && self.metadatas.count == 0 {
+                    self.searchOldPhotoVideo()
                 }
-            } else if errorCode == 0 && files?.count ?? 0 == 0 && self.metadatas.count == 0 {
-                self.searchOldPhotoVideo()
             }
         }
     }

+ 15 - 14
iOSClient/Select/NCSelect.storyboard

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EAU-PF-EEd">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="EAU-PF-EEd">
     <device id="retina4_7" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -17,7 +17,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="44" width="375" height="543"/>
+                                <rect key="frame" x="0.0" y="44" width="375" height="523"/>
                                 <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="D7P-75-aB1">
                                     <size key="itemSize" width="0.0" height="0.0"/>
                                     <size key="headerReferenceSize" width="0.0" height="0.0"/>
@@ -31,10 +31,10 @@
                                 </connections>
                             </collectionView>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="un8-Xf-9Fb">
-                                <rect key="frame" x="0.0" y="587" width="375" height="80"/>
+                                <rect key="frame" x="0.0" y="567" width="375" height="100"/>
                                 <subviews>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QFB-w0-4Kc">
-                                        <rect key="frame" x="16" y="16" width="120" height="30"/>
+                                        <rect key="frame" x="16" y="12" width="120" height="30"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="30" id="E2W-Hd-QqN"/>
                                             <constraint firstAttribute="width" constant="120" id="Nyx-sm-Sr7"/>
@@ -45,7 +45,7 @@
                                         </connections>
                                     </button>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gUK-Yw-aVP">
-                                        <rect key="frame" x="239" y="62" width="120" height="30"/>
+                                        <rect key="frame" x="239" y="58" width="120" height="30"/>
                                         <constraints>
                                             <constraint firstAttribute="width" constant="120" id="fDv-lp-fXV"/>
                                             <constraint firstAttribute="height" constant="30" id="jeT-Z9-lQr"/>
@@ -56,7 +56,7 @@
                                         </connections>
                                     </button>
                                     <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kze-s7-kTI">
-                                        <rect key="frame" x="239" y="16" width="120" height="30"/>
+                                        <rect key="frame" x="239" y="12" width="120" height="30"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="30" id="Hfn-8s-27i"/>
                                             <constraint firstAttribute="width" constant="120" id="S9y-Wh-wjq"/>
@@ -67,7 +67,7 @@
                                         </connections>
                                     </button>
                                     <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bvU-cp-GX3">
-                                        <rect key="frame" x="16" y="62" width="150" height="31"/>
+                                        <rect key="frame" x="16" y="57" width="150" height="31"/>
                                         <subviews>
                                             <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="obN-5M-keH">
                                                 <rect key="frame" x="0.0" y="0.0" width="51" height="31"/>
@@ -76,7 +76,7 @@
                                                 </connections>
                                             </switch>
                                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Overwrite" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SQc-p3-dhj">
-                                                <rect key="frame" x="57" y="7.6666666666666288" width="93" height="16"/>
+                                                <rect key="frame" x="57" y="7.5" width="93" height="16"/>
                                                 <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                                 <nil key="textColor"/>
                                                 <nil key="highlightedColor"/>
@@ -96,14 +96,14 @@
                                 </subviews>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
                                 <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="gUK-Yw-aVP" secondAttribute="bottom" constant="12" id="0oU-sV-Pxt"/>
                                     <constraint firstAttribute="trailing" secondItem="kze-s7-kTI" secondAttribute="trailing" constant="16" id="1PN-2z-evj"/>
                                     <constraint firstItem="QFB-w0-4Kc" firstAttribute="leading" secondItem="un8-Xf-9Fb" secondAttribute="leading" constant="16" id="4ve-BO-5Xm"/>
-                                    <constraint firstItem="kze-s7-kTI" firstAttribute="top" secondItem="un8-Xf-9Fb" secondAttribute="top" constant="16" id="67e-lX-huM"/>
+                                    <constraint firstItem="kze-s7-kTI" firstAttribute="top" secondItem="un8-Xf-9Fb" secondAttribute="top" constant="12" id="67e-lX-huM"/>
+                                    <constraint firstAttribute="bottom" secondItem="obN-5M-keH" secondAttribute="bottom" constant="12" id="6Gp-in-K9y"/>
                                     <constraint firstItem="bvU-cp-GX3" firstAttribute="leading" secondItem="un8-Xf-9Fb" secondAttribute="leading" constant="16" id="BA5-HU-7IK"/>
-                                    <constraint firstItem="QFB-w0-4Kc" firstAttribute="top" secondItem="un8-Xf-9Fb" secondAttribute="top" constant="16" id="LgR-ub-5qr"/>
+                                    <constraint firstItem="QFB-w0-4Kc" firstAttribute="top" secondItem="un8-Xf-9Fb" secondAttribute="top" constant="12" id="LgR-ub-5qr"/>
                                     <constraint firstAttribute="trailing" secondItem="gUK-Yw-aVP" secondAttribute="trailing" constant="16" id="OEt-Jd-Y4n"/>
-                                    <constraint firstItem="bvU-cp-GX3" firstAttribute="top" secondItem="QFB-w0-4Kc" secondAttribute="bottom" constant="16" id="OYR-Da-UOi"/>
-                                    <constraint firstItem="gUK-Yw-aVP" firstAttribute="top" secondItem="kze-s7-kTI" secondAttribute="bottom" constant="16" id="lt2-CV-1xW"/>
                                 </constraints>
                             </view>
                         </subviews>
@@ -135,6 +135,7 @@
                         <outlet property="overwriteLabel" destination="SQc-p3-dhj" id="Hk3-6G-ZaD"/>
                         <outlet property="overwriteSwitch" destination="obN-5M-keH" id="5LA-Lu-tto"/>
                         <outlet property="overwriteView" destination="bvU-cp-GX3" id="Wh1-Xr-CSQ"/>
+                        <outlet property="toolBarTop" destination="0IO-sX-tU0" id="zei-4d-kOF"/>
                         <outlet property="toolbar" destination="un8-Xf-9Fb" id="RhD-n3-mlq"/>
                     </connections>
                 </viewController>
@@ -148,7 +149,7 @@
                 <navigationController automaticallyAdjustsScrollViewInsets="NO" id="EAU-PF-EEd" sceneMemberID="viewController">
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="OMR-Ah-U1w">
-                        <rect key="frame" x="0.0" y="44" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     <nil name="viewControllers"/>

+ 8 - 4
iOSClient/Select/NCSelect.swift

@@ -41,6 +41,8 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
     
     @IBOutlet fileprivate weak var overwriteSwitch: UISwitch!
     @IBOutlet fileprivate weak var overwriteLabel: UILabel!
+    
+    @IBOutlet fileprivate weak var toolBarTop: NSLayoutConstraint!
 
     // ------ external settings ------------------------------------
     @objc var delegate: NCSelectDelegate?
@@ -55,6 +57,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
     @objc var isButtonDone1Hide = true
     @objc var isOverwriteHide = true
     @objc var layoutViewSelect = k_layout_view_move
+    @objc var heightToolBarTop: CGFloat = 100
     
     var titleCurrentFolder = NCBrandOptions.sharedInstance.brand
     var serverUrl = ""
@@ -155,6 +158,8 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
         
         self.navigationItem.title = titleCurrentFolder
         
+        toolBarTop.constant = -heightToolBarTop
+        
         buttonDone.setTitle(titleButtonDone, for: .normal)
         buttonDone1.setTitle(titleButtonDone1, for: .normal)
         buttonDone1.isHidden = isButtonDone1Hide
@@ -162,13 +167,11 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, NCListCellDelegat
         overwriteView.isHidden = isOverwriteHide
         
         if selectFile {
-            buttonDone.isEnabled = false
-            buttonDone.tintColor = UIColor.clear
+            buttonDone.isHidden = true
         }
         
         if hideButtonCreateFolder {
-            buttonCreateFolder.isEnabled = false
-            buttonCreateFolder.tintColor = UIColor.clear
+            buttonCreateFolder.isHidden = true
         }
         
         (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop) = NCUtility.sharedInstance.getLayoutForView(key: layoutViewSelect)
@@ -503,6 +506,7 @@ extension NCSelect: UICollectionViewDelegate {
             visualController.isButtonDone1Hide = isButtonDone1Hide
             visualController.isOverwriteHide = isOverwriteHide
             visualController.overwrite = overwrite
+            visualController.heightToolBarTop = heightToolBarTop
                 
             visualController.titleCurrentFolder = metadataPush!.fileNameView
             visualController.serverUrl = serverUrlPush