Marino Faggiana пре 6 година
родитељ
комит
80c37f2187

+ 5 - 3
iOSClient/Trash/NCTrash.swift

@@ -67,11 +67,11 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
     
     // MARK: tap
     
-    func tapRestoreItem(with fileID: String) {
+    func tapRestoreItem(with fileID: String, sender: Any) {
         restoreItem(with: fileID)
     }
     
-    func tapMoreItem(with fileID: String) {
+    func tapMoreItem(with fileID: String, sender: Any) {
         
         var items = [ActionSheetItem]()
         
@@ -84,7 +84,7 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
             if item is ActionSheetCancelButton { print("Cancel buttons has the value `true`") }
         }
         
-        actionSheet.present(in: self, from: self.view)
+        actionSheet.present(in: self, from: sender as! UIButton)
     }
     
     func tapSwitchHeaderMenu() {
@@ -241,6 +241,7 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
             cell.delegate = self
             
             cell.fileID = tableTrash.fileID
+            cell.indexPath = indexPath
             cell.labelTitle.text = tableTrash.trashbinFileName
             
             if tableTrash.directory {
@@ -259,6 +260,7 @@ class NCTrash: UIViewController , UICollectionViewDataSource, UICollectionViewDe
             cell.delegate = self
             
             cell.fileID = tableTrash.fileID
+            cell.indexPath = indexPath
             cell.labelTitle.text = tableTrash.trashbinFileName
             
             if tableTrash.directory {

+ 5 - 4
iOSClient/Trash/NCTrashGridCell.swift

@@ -23,6 +23,7 @@ class NCTrashGridCell: UICollectionViewCell {
     var delegate: NCTrashGridDelegate?
     
     var fileID = ""
+    var indexPath = IndexPath()
 
     override func awakeFromNib() {
         super.awakeFromNib()
@@ -32,15 +33,15 @@ class NCTrashGridCell: UICollectionViewCell {
     }
     
     @IBAction func touchUpInsideMore(_ sender: Any) {
-        delegate?.tapMoreItem(with: fileID)
+        delegate?.tapMoreItem(with: fileID, sender: sender)
     }
     
     @IBAction func touchUpInsideRestore(_ sender: Any) {
-        delegate?.tapRestoreItem(with: fileID)
+        delegate?.tapRestoreItem(with: fileID, sender: sender)
     }
 }
 
 protocol NCTrashGridDelegate {
-    func tapRestoreItem(with fileID: String)
-    func tapMoreItem(with fileID: String)
+    func tapRestoreItem(with fileID: String, sender: Any)
+    func tapMoreItem(with fileID: String, sender: Any)
 }

+ 5 - 4
iOSClient/Trash/NCTrashListCell.swift

@@ -27,6 +27,7 @@ class NCTrashListCell: UICollectionViewCell {
     var delegate: NCTrashListDelegate?
     
     var fileID = ""
+    var indexPath = IndexPath()
 
     override func awakeFromNib() {
         super.awakeFromNib()
@@ -38,15 +39,15 @@ class NCTrashListCell: UICollectionViewCell {
     }
     
     @IBAction func touchUpInsideMore(_ sender: Any) {
-        delegate?.tapMoreItem(with: fileID)
+        delegate?.tapMoreItem(with: fileID, sender: sender)
     }
     
     @IBAction func touchUpInsideRestore(_ sender: Any) {
-        delegate?.tapRestoreItem(with: fileID)
+        delegate?.tapRestoreItem(with: fileID, sender: sender)
     }
 }
 
 protocol NCTrashListDelegate {
-    func tapRestoreItem(with fileID: String)
-    func tapMoreItem(with fileID: String)
+    func tapRestoreItem(with fileID: String, sender: Any)
+    func tapMoreItem(with fileID: String, sender: Any)
 }