Эх сурвалжийг харах

Menu item with no action shouldn't be selectable

Signed-off-by: Philippe Weidmann <philippe.weidmann@infomaniak.com>
Philippe Weidmann 5 жил өмнө
parent
commit
16da57be68

+ 7 - 2
iOSClient/Main/Menu/CCFavorites+Menu.swift

@@ -41,8 +41,13 @@ extension CCFavorites {
             }
             }
         }
         }
 
 
-        actions.append(NCMenuAction(title: metadata.fileNameView, icon: iconHeader, action: { menuAction in
-        }))
+        actions.append(
+            NCMenuAction(
+                title: metadata.fileNameView,
+                icon: iconHeader,
+                action: nil
+            )
+        )
 
 
         if(self.serverUrl == nil) {
         if(self.serverUrl == nil) {
             actions.append(
             actions.append(

+ 3 - 5
iOSClient/Main/Menu/CCMain+Menu.swift

@@ -220,8 +220,7 @@ extension CCMain {
                 NCMenuAction(
                 NCMenuAction(
                     title: metadata.fileNameView,
                     title: metadata.fileNameView,
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement),
                     icon: CCGraphics.changeThemingColorImage(UIImage(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement),
-                    action: { menuAction in
-                    }
+                    action: nil
                 )
                 )
             )
             )
 
 
@@ -373,9 +372,8 @@ extension CCMain {
             actions.append(
             actions.append(
                 NCMenuAction(
                 NCMenuAction(
                     title: metadata.fileNameView,
                     title: metadata.fileNameView,
-                    icon: iconHeader, action: { menuAction in
-
-                    }
+                    icon: iconHeader,
+                    action: nil
                 )
                 )
             )
             )
 
 

+ 8 - 2
iOSClient/Main/Menu/NCMainMenuTableViewController.swift

@@ -37,8 +37,10 @@ class NCMainMenuTableViewController: UITableViewController {
 
 
     override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
     override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         let menuAction = actions[indexPath.row]
         let menuAction = actions[indexPath.row]
-        self.dismiss(animated: true, completion: nil)
-        menuAction.action?(menuAction)
+        if let action = menuAction.action {
+            self.dismiss(animated: true, completion: nil)
+            action(menuAction)
+        }
     }
     }
 
 
     // MARK: - Table view data source
     // MARK: - Table view data source
@@ -58,6 +60,10 @@ class NCMainMenuTableViewController: UITableViewController {
         let actionIconView = cell.viewWithTag(1) as! UIImageView
         let actionIconView = cell.viewWithTag(1) as! UIImageView
         let actionNameLabel = cell.viewWithTag(2) as! UILabel
         let actionNameLabel = cell.viewWithTag(2) as! UILabel
 
 
+        if action.action == nil {
+            cell.selectionStyle = .none
+        }
+
         if (action.isOn) {
         if (action.isOn) {
             actionIconView.image = action.onIcon
             actionIconView.image = action.onIcon
             actionNameLabel.text = action.onTitle
             actionNameLabel.text = action.onTitle