瀏覽代碼

remove unused code

marinofaggiana 4 年之前
父節點
當前提交
a814bc1f00

+ 1 - 1
Cartfile.resolved

@@ -20,7 +20,7 @@ github "marinofaggiana/AFNetworking" "2967678c3e0e98c9b8d7e06222ad12d1f49c26f2"
 github "marinofaggiana/KTVHTTPCache" "2.0.2"
 github "marinofaggiana/TOPasscodeViewController" "0.0.6"
 github "marinofaggiana/XLForm" "eb9381ad8129f60402bf412250fb31b95a628a08"
-github "nextcloud/ios-communication-library" "8a7508ded6e0943b72c7837a77dbb78d0b1b58ea"
+github "nextcloud/ios-communication-library" "baa27749b901aad2c95d5ecae7a3a1304e7b605e"
 github "realm/realm-cocoa" "v4.4.1"
 github "rechsteiner/Parchment" "v1.7.0"
 github "scenee/FloatingPanel" "v1.7.5"

+ 0 - 4
Nextcloud.xcodeproj/project.pbxproj

@@ -145,7 +145,6 @@
 		F7381EE1218218C9000B1560 /* NCOffline.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7381EDA218218C9000B1560 /* NCOffline.swift */; };
 		F7381EE5218218C9000B1560 /* NCOffline.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7381EDE218218C9000B1560 /* NCOffline.storyboard */; };
 		F738E8421F90FFD100F95C8E /* NCManageEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F738E8411F90FFD100F95C8E /* NCManageEndToEndEncryption.m */; };
-		F739513A221B127F00D986C8 /* NCSectionMediaHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7395139221B127F00D986C8 /* NCSectionMediaHeader.xib */; };
 		F73B422B2476764F00A30FD3 /* NCNotification.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F73B42292476764F00A30FD3 /* NCNotification.storyboard */; };
 		F73B422C2476764F00A30FD3 /* NCNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73B422A2476764F00A30FD3 /* NCNotification.swift */; };
 		F73CB3B222E072A000AD728E /* NCShareHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F73CB3B122E072A000AD728E /* NCShareHeaderView.xib */; };
@@ -554,7 +553,6 @@
 		F7381EDE218218C9000B1560 /* NCOffline.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCOffline.storyboard; sourceTree = "<group>"; };
 		F738E8401F90FFD100F95C8E /* NCManageEndToEndEncryption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCManageEndToEndEncryption.h; sourceTree = "<group>"; };
 		F738E8411F90FFD100F95C8E /* NCManageEndToEndEncryption.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCManageEndToEndEncryption.m; sourceTree = "<group>"; };
-		F7395139221B127F00D986C8 /* NCSectionMediaHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCSectionMediaHeader.xib; sourceTree = "<group>"; };
 		F73B42292476764F00A30FD3 /* NCNotification.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = NCNotification.storyboard; path = Notification/NCNotification.storyboard; sourceTree = "<group>"; };
 		F73B422A2476764F00A30FD3 /* NCNotification.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NCNotification.swift; path = Notification/NCNotification.swift; sourceTree = "<group>"; };
 		F73CB3B122E072A000AD728E /* NCShareHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCShareHeaderView.xib; sourceTree = "<group>"; };
@@ -1258,7 +1256,6 @@
 			isa = PBXGroup;
 			children = (
 				F78ACD51219046DC0088454D /* NCSectionHeaderFooter.swift */,
-				F7395139221B127F00D986C8 /* NCSectionMediaHeader.xib */,
 				F78ACD55219047E90088454D /* NCSectionHeader.xib */,
 				F78ACD57219048040088454D /* NCSectionHeaderMenu.xib */,
 				F78ACD53219047D40088454D /* NCSectionFooter.xib */,
@@ -2011,7 +2008,6 @@
 				F7169A1E1EE590930086BD69 /* NCSharesCell.xib in Resources */,
 				F7226EDC1EE4089300EBECB1 /* Main.storyboard in Resources */,
 				F7632FBF21832F8700721B71 /* NCTrashSectionHeaderMenu.xib in Resources */,
-				F739513A221B127F00D986C8 /* NCSectionMediaHeader.xib in Resources */,
 				3704EB2A23D5A58400455C5B /* NCMenu.storyboard in Resources */,
 				F7E0E1DE22327DBA006B0911 /* NCAudioRecorderViewController.storyboard in Resources */,
 				F7F1E54C2492369A00E42386 /* NCMediaCommandView.xib in Resources */,

+ 0 - 29
iOSClient/Main/Section/NCSectionHeaderFooter.swift

@@ -162,35 +162,6 @@ class NCSectionHeader: UICollectionReusableView {
     }
 }
 
-class NCSectionMediaHeader: UICollectionReusableView {
-    
-    @IBOutlet weak var labelSection: UILabel!
-    @IBOutlet weak var labelLeadingConstraint: NSLayoutConstraint!
-    @IBOutlet weak var labelHeightConstraint: NSLayoutConstraint!
-    @IBOutlet weak var labelWidthConstraint: NSLayoutConstraint!
-    
-    override func awakeFromNib() {
-        super.awakeFromNib()
-    }
-    
-    func setTitleLabel(sectionDatasource: CCSectionDataSourceMetadata, section: Int) {
-        
-        var title = ""
-        
-        if sectionDatasource.sections.count > section {
-            if sectionDatasource.sections.object(at: section) is String {
-                title = sectionDatasource.sections.object(at: section) as! String
-            }
-            if sectionDatasource.sections.object(at: section) is Date {
-                let titleDate = sectionDatasource.sections.object(at: section) as! Date
-                title = CCUtility.getTitleSectionDate(titleDate)
-            }
-        }
-        
-        labelSection.text = NSLocalizedString(title, comment: "")
-    }
-}
-
 class NCSectionFooter: UICollectionReusableView {
     
     @IBOutlet weak var labelSection: UILabel!

+ 0 - 44
iOSClient/Main/Section/NCSectionMediaHeader.xib

@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
-    <device id="retina4_7" orientation="portrait">
-        <adaptation id="fullscreen"/>
-    </device>
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
-        <capability name="Safe area layout guides" minToolsVersion="9.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"/>
-        <collectionReusableView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="sectionHeader" id="Vin-9E-7nW" customClass="NCSectionMediaHeader" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="377" height="50"/>
-            <autoresizingMask key="autoresizingMask"/>
-            <subviews>
-                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LabelSectionHeader" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gzy-cT-Gjn" userLabel="Label Section">
-                    <rect key="frame" x="109" y="14" width="158" height="22"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="22" id="fSy-kX-khX"/>
-                        <constraint firstAttribute="width" constant="158" id="q8E-Aw-w6I"/>
-                    </constraints>
-                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                    <nil key="textColor"/>
-                    <nil key="highlightedColor"/>
-                </label>
-            </subviews>
-            <constraints>
-                <constraint firstItem="gzy-cT-Gjn" firstAttribute="centerY" secondItem="EFn-SN-cxu" secondAttribute="centerY" id="1Ld-Nt-Kpm"/>
-                <constraint firstItem="gzy-cT-Gjn" firstAttribute="leading" secondItem="EFn-SN-cxu" secondAttribute="leading" constant="109" id="lwa-IO-uij"/>
-            </constraints>
-            <viewLayoutGuide key="safeArea" id="EFn-SN-cxu"/>
-            <connections>
-                <outlet property="labelHeightConstraint" destination="fSy-kX-khX" id="I8c-I3-WSP"/>
-                <outlet property="labelLeadingConstraint" destination="lwa-IO-uij" id="V9f-rn-jae"/>
-                <outlet property="labelSection" destination="gzy-cT-Gjn" id="yG6-wJ-CmI"/>
-                <outlet property="labelWidthConstraint" destination="q8E-Aw-w6I" id="3kq-Fd-E9d"/>
-            </connections>
-            <point key="canvasLocation" x="42.399999999999999" y="45.877061469265371"/>
-        </collectionReusableView>
-    </objects>
-</document>

+ 139 - 210
iOSClient/Media/NCMedia.swift

@@ -29,45 +29,32 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
     @IBOutlet weak var collectionView : UICollectionView!
     
     private var mediaCommandView: NCMediaCommandView?
-    
-    //Grid control buttons
-    private var plusButton: UIBarButtonItem!
-    private var separatorButton: UIBarButtonItem!
-    private var minusButton: UIBarButtonItem!
-    private var gridButton: UIBarButtonItem!
-    
+    private var gridLayout: NCGridMediaLayout!
+
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    
     public var metadatas: [tableMetadata] = []
-
     private var metadataPush: tableMetadata?
+    
     private var isEditMode = false
     private var selectocId: [String] = []
     
     private var filterTypeFileImage = false;
     private var filterTypeFileVideo = false;
-        
-    private var autoUploadFileName = ""
-    private var autoUploadDirectory = ""
-    
-    private var gridLayout: NCGridMediaLayout!
-        
-    private let sectionHeaderHeight: CGFloat = 10
-    private let footerHeight: CGFloat = 50
-    
+            
     private var stepImageWidth: CGFloat = 10
     private let kMaxImageGrid: CGFloat = 5
     
-    private var isDistantPast = false
-
     private var oldInProgress = false
     private var newInProgress = false
-
     
     struct cacheImages {
         static var cellPlayImage = UIImage()
         static var cellFavouriteImage = UIImage()
     }
 
+    // MARK: - View Life Cycle
+    
     required init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
 
@@ -79,15 +66,8 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
     override func viewDidLoad() {
         super.viewDidLoad()
         
-        // Cell
         collectionView.register(UINib.init(nibName: "NCGridMediaCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
         
-        // Header
-        collectionView.register(UINib.init(nibName: "NCSectionMediaHeader", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeader")
-        
-        // Footer
-        collectionView.register(UINib.init(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter")
-        
         collectionView.alwaysBounceVertical = true
         collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 50, right: 0);
                 
@@ -111,9 +91,7 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: k_notificationCenter_changeTheming), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_renameFile), object: nil)
-    
-        self.navigationItem.leftBarButtonItem = gridButton
-        
+            
         mediaCommandView = Bundle.main.loadNibNamed("NCMediaCommandView", owner: self, options: nil)?.first as? NCMediaCommandView
         self.view.addSubview(mediaCommandView!)
         mediaCommandView?.mediaView = self
@@ -132,6 +110,40 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         changeTheming()
     }
     
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+    }
+    
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        
+        mediaCommandTitle()
+        removeDeletedFile()
+        searchNewPhotoVideo()
+    }
+    
+    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
+        super.viewWillTransition(to: size, with: coordinator)
+        
+        coordinator.animate(alongsideTransition: nil) { _ in
+            self.reloadDataThenPerform { }
+        }
+    }
+    
+    override var preferredStatusBarStyle: UIStatusBarStyle {
+        return .lightContent
+    }
+    
+    //MARK: - Command
+    
+    func mediaCommandTitle() {
+        if let cell = collectionView?.visibleCells.first as? NCGridMediaCell {
+            if cell.date != nil {
+                mediaCommandView!.title.text = CCUtility.getTitleSectionDate(cell.date)
+            }
+        }
+    }
+    
     @objc func zoomOutGrid() {
         UIView.animate(withDuration: 0.0, animations: {
             if(self.gridLayout.itemPerLine + 1 < self.kMaxImageGrid) {
@@ -162,23 +174,105 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         })
     }
     
-    override func viewWillAppear(_ animated: Bool) {
-        super.viewWillAppear(animated)
-    }
-    
-    override func viewDidAppear(_ animated: Bool) {
-        super.viewDidAppear(animated)
-        
-        mediaCommandTitle()
-        searchNewPhotoVideo()
+    @objc func touchUpInsideMenuButtonSwitch(_ sender: Any) {
+                
+        UIView.animate(withDuration: 0.0, animations: {
+            if(self.gridLayout.itemPerLine + 1 < self.kMaxImageGrid && self.gridLayout.increasing) {
+                self.gridLayout.itemPerLine+=1
+            } else {
+                self.gridLayout.increasing = false
+                self.gridLayout.itemPerLine-=1
+            }
+            if(self.gridLayout.itemPerLine == 0) {
+                self.gridLayout.increasing = true
+                self.gridLayout.itemPerLine = 2
+            }
+            
+            self.collectionView.collectionViewLayout.invalidateLayout()
+            CCUtility.setMediaWidthImage(Int(self.gridLayout.itemPerLine))
+        })
     }
     
-    override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
-        super.viewWillTransition(to: size, with: coordinator)
-        
-        coordinator.animate(alongsideTransition: nil) { _ in
-            self.reloadDataThenPerform { }
+    @objc func touchUpInsideMenuButtonMore(_ sender: Any) {
+        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
+        var actions: [NCMenuAction] = []
+
+        if !isEditMode {
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString("_select_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "selectFull"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        self.isEditMode = true
+                    }
+                )
+            )
+
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString(filterTypeFileImage ? "_media_viewimage_show_" : "_media_viewimage_hide_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: filterTypeFileImage ? "imageno" : "imageyes"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        self.filterTypeFileImage = !self.filterTypeFileImage
+                        self.reloadDataSource()
+                    }
+                )
+            )
+
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString(filterTypeFileVideo ? "_media_viewvideo_show_" : "_media_viewvideo_hide_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: filterTypeFileVideo ? "videono" : "videoyes"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        self.filterTypeFileVideo = !self.filterTypeFileVideo
+                        self.reloadDataSource()
+                    }
+                )
+            )
+
+        } else {
+           
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString("_deselect_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "cancel"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
+                    action: { menuAction in
+                        self.isEditMode = false
+                        self.selectocId.removeAll()
+                        self.reloadDataThenPerform { }
+                    }
+                )
+            )
+            
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString("_delete_", comment: ""),
+                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "trash"), width: 50, height: 50, color: .red),
+                    action: { menuAction in
+                        self.isEditMode = false                        
+                        // copy in arrayDeleteMetadata
+                        for ocId in self.selectocId {
+                            if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", ocId)) {
+                                self.appDelegate.arrayDeleteMetadata.add(metadata)
+                            }
+                        }
+                        if let metadata = self.appDelegate.arrayDeleteMetadata.firstObject {
+                            self.appDelegate.arrayDeleteMetadata.removeObject(at: 0)
+                            NCNetworking.shared.deleteMetadata(metadata as! tableMetadata, account: self.appDelegate.activeAccount, url: self.appDelegate.activeUrl) { (errorCode, errorDescription) in }
+                        }
+                    }
+                )
+            )
         }
+
+        mainMenuViewController.actions = actions
+        let menuPanelController = NCMenuPanelController()
+        menuPanelController.parentPresenter = self
+        menuPanelController.delegate = mainMenuViewController
+        menuPanelController.set(contentViewController: mainMenuViewController)
+        menuPanelController.track(scrollView: mainMenuViewController.tableView)
+
+        self.present(menuPanelController, animated: true, completion: nil)
     }
     
     //MARK: - NotificationCenter
@@ -191,10 +285,6 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         
         self.navigationController?.setNavigationBarHidden(true, animated: false)
     }
-    
-    override var preferredStatusBarStyle: UIStatusBarStyle {
-        return .lightContent
-    }
 
     @objc func deleteFile(_ notification: NSNotification) {
         if let userInfo = notification.userInfo as NSDictionary? {
@@ -278,100 +368,6 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         return true
     }
     
-    // MARK: IBAction
-    
-    @objc func touchUpInsideMenuButtonSwitch(_ sender: Any) {
-                
-        UIView.animate(withDuration: 0.0, animations: {
-            if(self.gridLayout.itemPerLine + 1 < self.kMaxImageGrid && self.gridLayout.increasing) {
-                self.gridLayout.itemPerLine+=1
-            } else {
-                self.gridLayout.increasing = false
-                self.gridLayout.itemPerLine-=1
-            }
-            if(self.gridLayout.itemPerLine == 0) {
-                self.gridLayout.increasing = true
-                self.gridLayout.itemPerLine = 2
-            }
-            
-            self.collectionView.collectionViewLayout.invalidateLayout()
-            CCUtility.setMediaWidthImage(Int(self.gridLayout.itemPerLine))
-        })
-    }
-    
-    @objc func touchUpInsideMenuButtonMore(_ sender: Any) {
-        let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
-        var actions: [NCMenuAction] = []
-
-        if !isEditMode {
-            actions.append(
-                NCMenuAction(
-                    title: NSLocalizedString("_select_", comment: ""),
-                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "selectFull"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                    action: { menuAction in
-                        self.isEditMode = true
-                    }
-                )
-            )
-
-            actions.append(
-                NCMenuAction(
-                    title: NSLocalizedString(filterTypeFileImage ? "_media_viewimage_show_" : "_media_viewimage_hide_", comment: ""),
-                    icon: CCGraphics.changeThemingColorImage(UIImage(named: filterTypeFileImage ? "imageno" : "imageyes"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                    action: { menuAction in
-                        self.filterTypeFileImage = !self.filterTypeFileImage
-                        self.reloadDataSource()
-                    }
-                )
-            )
-
-            actions.append(
-                NCMenuAction(
-                    title: NSLocalizedString(filterTypeFileVideo ? "_media_viewvideo_show_" : "_media_viewvideo_hide_", comment: ""),
-                    icon: CCGraphics.changeThemingColorImage(UIImage(named: filterTypeFileVideo ? "videono" : "videoyes"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                    action: { menuAction in
-                        self.filterTypeFileVideo = !self.filterTypeFileVideo
-                        self.reloadDataSource()
-                    }
-                )
-            )
-
-        } else {
-           
-            actions.append(
-                NCMenuAction(
-                    title: NSLocalizedString("_deselect_", comment: ""),
-                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "cancel"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
-                    action: { menuAction in
-                        self.isEditMode = false
-                        self.selectocId.removeAll()
-                        self.reloadDataThenPerform {
-                        }
-                    }
-                )
-            )
-            
-            actions.append(
-                NCMenuAction(
-                    title: NSLocalizedString("_delete_", comment: ""),
-                    icon: CCGraphics.changeThemingColorImage(UIImage(named: "trash"), width: 50, height: 50, color: .red),
-                    action: { menuAction in
-                        self.deleteItems()
-                    }
-                )
-            )
-        }
-
-        mainMenuViewController.actions = actions
-        let menuPanelController = NCMenuPanelController()
-        menuPanelController.parentPresenter = self
-        menuPanelController.delegate = mainMenuViewController
-        menuPanelController.set(contentViewController: mainMenuViewController)
-        menuPanelController.track(scrollView: mainMenuViewController.tableView)
-
-        self.present(menuPanelController, animated: true, completion: nil)
-    }
-    
     // MARK: SEGUE
     
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
@@ -452,53 +448,6 @@ extension NCMedia: UICollectionViewDataSource {
         CATransaction.commit()
     }
     
-    func mediaCommandTitle() {
-        if let cell = collectionView?.visibleCells.first as? NCGridMediaCell {
-            if cell.date != nil {
-                mediaCommandView!.title.text = CCUtility.getTitleSectionDate(cell.date)
-            }
-        }
-    }
-    
-    /*
-    func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
-        
-        switch kind {
-        case UICollectionView.elementKindSectionFooter:
-            let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
-            footer.setTitleLabel(sectionDatasource: sectionDatasource)
-            return footer
-            
-        default:
-            return UICollectionReusableView()
-        }
-            /*
-      
-            let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeader", for: indexPath) as! NCSectionMediaHeader
-            
-            header.setTitleLabel(sectionDatasource: sectionDatasource, section: indexPath.section)
-            header.labelSection.textColor = .white
-            header.labelHeightConstraint.constant = 20
-            header.labelSection.layer.cornerRadius = 10
-            header.labelSection.layer.backgroundColor = UIColor(red: 152.0/255.0, green: 167.0/255.0, blue: 181.0/255.0, alpha: 0.8).cgColor
-            let width = header.labelSection.intrinsicContentSize.width + 30
-            let leading = collectionView.bounds.width / 2 - width / 2
-            header.labelWidthConstraint.constant = width
-            header.labelLeadingConstraint.constant = leading
-            
-            return header
-      
-        */
-    }
-    */
-    
-    /*
-    func numberOfSections(in collectionView: UICollectionView) -> Int {
-        let sections = sectionDatasource.sectionArrayRow.allKeys.count
-        return sections
-    }
-    */
-    
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
         
         return metadatas.count
@@ -563,7 +512,7 @@ extension NCMedia: UICollectionViewDataSource {
 extension NCMedia: UICollectionViewDelegateFlowLayout {
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
-        return CGSize(width: collectionView.frame.width, height: sectionHeaderHeight)
+        return CGSize(width: collectionView.frame.width, height: 0)
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
@@ -694,26 +643,6 @@ extension NCMedia {
         }
     }
     
-    func deleteItems() {
-        
-        self.isEditMode = false
-        
-        if (appDelegate.activeAccount == nil || appDelegate.activeAccount.count == 0 || appDelegate.maintenanceMode == true) {
-            return
-        }
-        
-        // copy in arrayDeleteMetadata
-        for ocId in selectocId {
-            if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "ocId == %@", ocId)) {
-                appDelegate.arrayDeleteMetadata.add(metadata)
-            }
-        }
-        if let metadata = appDelegate.arrayDeleteMetadata.firstObject {
-            appDelegate.arrayDeleteMetadata.removeObject(at: 0)
-            NCNetworking.shared.deleteMetadata(metadata as! tableMetadata, account: appDelegate.activeAccount, url: appDelegate.activeUrl) { (errorCode, errorDescription) in }
-        }
-    }
-    
     private func downloadThumbnail() {
         guard let collectionView = self.collectionView else { return }
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {

+ 11 - 1
iOSClient/Networking/NCOperationQueue.swift

@@ -226,7 +226,17 @@ class NCOperationRemoveDeletedFileQueue: ConcurrentOperation {
             self.finish()
         } else {
             let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
-            NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { (account, files, responseData, errorCode, errorDescription) in
+            
+            let requestBody =
+            """
+            <?xml version=\"1.0\" encoding=\"UTF-8\"?>
+            <d:propfind xmlns:d=\"DAV:\" xmlns:oc=\"http://owncloud.org/ns\" xmlns:nc=\"http://nextcloud.org/ns\">
+                <d:prop>
+                </d:prop>
+            </d:propfind>
+            """
+            
+            NCCommunication.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", requestBody: requestBody.data(using: .utf8)) { (account, files, responseData, errorCode, errorDescription) in
                 if errorCode == 404 {
                     NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", self.metadata.ocId))
                     NotificationCenter.default.post(name: Notification.Name.init(rawValue: k_notificationCenter_deleteFile), object: nil, userInfo: ["metadata": self.metadata, "errorCode": errorCode])