CCMain+Menu.swift 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. //
  2. // CCMain+Menu.swift
  3. // Nextcloud
  4. //
  5. // Created by Philippe Weidmann on 24.01.20.
  6. // Copyright © 2020 TWS. All rights reserved.
  7. //
  8. import FloatingPanel
  9. extension CCMain {
  10. private func initSortMenu() -> [MenuAction] {
  11. var actions = [MenuAction]()
  12. actions.append(MenuAction(
  13. title: NSLocalizedString("_order_by_name_a_z_", comment: ""),
  14. icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortFileNameAZ"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
  15. onTitle: NSLocalizedString("_order_by_name_z_a_", comment: ""),
  16. onIcon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortFileNameZA"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
  17. selected: CCUtility.getOrderSettings() == "fileName",
  18. on: CCUtility.getAscendingSettings(),
  19. action: { menuAction in
  20. if(CCUtility.getOrderSettings() == "fileName" && CCUtility.getAscendingSettings()) {
  21. CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
  22. } else {
  23. CCUtility.setOrderSettings("fileName")
  24. CCUtility.setAscendingSettings(true)
  25. }
  26. NotificationCenter.default.post(name: Notification.Name.init(rawValue: "clearDateReadDataSource"), object: nil)
  27. }))
  28. actions.append(MenuAction(
  29. title: NSLocalizedString("_order_by_date_more_recent_", comment: ""),
  30. icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortDateMoreRecent"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
  31. onTitle: NSLocalizedString("_order_by_date_less_recent_", comment: ""),
  32. onIcon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortDateLessRecent"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
  33. selected: CCUtility.getOrderSettings() == "date",
  34. on: CCUtility.getAscendingSettings(),
  35. action: { menuAction in
  36. if(CCUtility.getOrderSettings() == "date" && CCUtility.getAscendingSettings()) {
  37. CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
  38. } else {
  39. CCUtility.setOrderSettings("date")
  40. CCUtility.setAscendingSettings(true)
  41. }
  42. NotificationCenter.default.post(name: Notification.Name.init(rawValue: "clearDateReadDataSource"), object: nil)
  43. }))
  44. actions.append(MenuAction(
  45. title: NSLocalizedString("_order_by_size_smallest_", comment: ""),
  46. icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortSmallest"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
  47. onTitle: NSLocalizedString("_order_by_size_largest_", comment: ""),
  48. onIcon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortLargest"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
  49. selected: CCUtility.getOrderSettings() == "size",
  50. on: CCUtility.getAscendingSettings(),
  51. action: { menuAction in
  52. if(CCUtility.getOrderSettings() == "size" && CCUtility.getAscendingSettings()) {
  53. CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
  54. } else {
  55. CCUtility.setOrderSettings("size")
  56. CCUtility.setAscendingSettings(true)
  57. }
  58. NotificationCenter.default.post(name: Notification.Name.init(rawValue: "clearDateReadDataSource"), object: nil)
  59. }))
  60. actions.append(MenuAction(
  61. title: NSLocalizedString("_directory_on_top_no_", comment: ""),
  62. icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "foldersOnTop"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
  63. selected: CCUtility.getDirectoryOnTop(),
  64. on: CCUtility.getDirectoryOnTop(),
  65. action: { menuAction in
  66. CCUtility.setDirectoryOnTop(!CCUtility.getDirectoryOnTop())
  67. NotificationCenter.default.post(name: Notification.Name.init(rawValue: "clearDateReadDataSource"), object: nil)
  68. }))
  69. return actions
  70. }
  71. @objc func toggleMenu(viewController: UIViewController) {
  72. let mainMenuViewController = UIStoryboard.init(name: "Menu", bundle: nil).instantiateViewController(withIdentifier: "MainMenuTableViewController") as! MainMenuTableViewController
  73. mainMenuViewController.actions = self.initSortMenu()
  74. let menuPanelController = MenuPanelController()
  75. menuPanelController.panelWidth = Int(viewController.view.frame.width)
  76. menuPanelController.delegate = mainMenuViewController
  77. menuPanelController.set(contentViewController: mainMenuViewController)
  78. menuPanelController.track(scrollView: mainMenuViewController.tableView)
  79. viewController.present(menuPanelController, animated: true, completion: nil)
  80. }
  81. @objc func toggleSelectMenu(viewController: UIViewController) {
  82. let mainMenuViewController = UIStoryboard.init(name: "Menu", bundle: nil).instantiateViewController(withIdentifier: "MainMenuTableViewController") as! MainMenuTableViewController
  83. mainMenuViewController.actions = self.initSelectMenu()
  84. let menuPanelController = MenuPanelController()
  85. menuPanelController.panelWidth = Int(viewController.view.frame.width)
  86. menuPanelController.delegate = mainMenuViewController
  87. menuPanelController.set(contentViewController: mainMenuViewController)
  88. menuPanelController.track(scrollView: mainMenuViewController.tableView)
  89. viewController.present(menuPanelController, animated: true, completion: nil)
  90. }
  91. private func initSelectMenu() -> [MenuAction] {
  92. var actions = [MenuAction]()
  93. actions.append(MenuAction(title: NSLocalizedString("_select_all_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "selectFull"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  94. self.didSelectAll()
  95. }))
  96. actions.append(MenuAction(title: NSLocalizedString("_move_selected_files_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "move"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  97. self.moveOpenWindow(self.tableView.indexPathsForSelectedRows)
  98. }))
  99. actions.append(MenuAction(title: NSLocalizedString("_download_selected_files_folders_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "downloadSelectedFiles"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  100. self.downloadSelectedFilesFolders()
  101. }))
  102. actions.append(MenuAction(title: NSLocalizedString("_save_selected_files_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "saveSelectedFiles"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  103. self.saveSelectedFiles()
  104. }))
  105. actions.append(MenuAction(title: NSLocalizedString("_delete_selected_files_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  106. self.deleteFile()
  107. }))
  108. return actions
  109. }
  110. private func initMoreMenu(indexPath: IndexPath, metadata: tableMetadata, metadataFolder: tableMetadata) -> [MenuAction] {
  111. let appDelegate = UIApplication.shared.delegate as! AppDelegate
  112. let autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
  113. let autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(appDelegate.activeUrl)
  114. var actions = [MenuAction]()
  115. if (metadata.directory) {
  116. var lockDirectory = false
  117. var isOffline = false
  118. let isFolderEncrypted = CCUtility.isFolderEncrypted("\(self.serverUrl ?? "")/\(metadata.fileName)", account: appDelegate.activeAccount)
  119. var passcodeTitle = NSLocalizedString("_protect_passcode_", comment: "")
  120. let dirServerUrl = CCUtility.stringAppendServerUrl(self.metadata.serverUrl, addFileName: metadata.fileName)!
  121. if let directory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, dirServerUrl)) {
  122. if (CCUtility.getBlockCode() != nil && appDelegate.sessionePasscodeLock == nil) {
  123. lockDirectory = true
  124. }
  125. if (directory.lock) {
  126. passcodeTitle = NSLocalizedString("_protect_passcode_", comment: "")
  127. }
  128. isOffline = directory.offline
  129. }
  130. actions.append(MenuAction(title: metadata.fileNameView, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement), action: { menuAction in
  131. }))
  132. actions.append(MenuAction(title: metadata.favorite ? NSLocalizedString("_remove_favorites_", comment: "") : NSLocalizedString("_add_favorites_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 50, height: 50, color: NCBrandColor.sharedInstance.yellowFavorite), action: { menuAction in
  133. self.settingFavorite(metadata, favorite: !metadata.favorite)
  134. }))
  135. if (!lockDirectory && !isFolderEncrypted) {
  136. actions.append(MenuAction(title: NSLocalizedString("_details_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  137. NCMainCommon.sharedInstance.openShare(ViewController: self, metadata: metadata, indexPage: 0)
  138. }))
  139. }
  140. if(!(metadata.fileName == autoUploadFileName && metadata.serverUrl == autoUploadDirectory) && !lockDirectory && !metadata.e2eEncrypted) {
  141. actions.append(MenuAction(title: NSLocalizedString("_rename_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "rename"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  142. let alertController = UIAlertController(title: NSLocalizedString("_rename_", comment: ""), message: nil, preferredStyle: .alert)
  143. alertController.addTextField { (textField) in
  144. textField.text = metadata.fileNameView
  145. textField.delegate = self as? UITextFieldDelegate
  146. textField.addTarget(self, action: #selector(self.minCharTextFieldDidChange(_:)
  147. ), for: UIControl.Event.editingChanged)
  148. }
  149. let cancelAction = UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: nil)
  150. let okAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { action in
  151. let fileName = alertController.textFields![0].text
  152. self.perform(#selector(self.renameFile(_:)), on: .main, with: [metadata, fileName!], waitUntilDone: false)
  153. })
  154. okAction.isEnabled = false
  155. alertController.addAction(cancelAction)
  156. alertController.addAction(okAction)
  157. self.present(alertController, animated: true, completion: nil)
  158. }))
  159. }
  160. if (!(metadata.fileName == autoUploadFileName && metadata.serverUrl == autoUploadDirectory) && !lockDirectory && !isFolderEncrypted) {
  161. actions.append(MenuAction(title: NSLocalizedString("_move_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "move"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  162. self.moveOpenWindow([indexPath])
  163. }))
  164. }
  165. if (!isFolderEncrypted) {
  166. actions.append(MenuAction(title: isOffline ? NSLocalizedString("_remove_available_offline_", comment: "") : NSLocalizedString("_set_available_offline_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "offline"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  167. NCManageDatabase.sharedInstance.setDirectory(serverUrl: dirServerUrl, offline: !isOffline, account: appDelegate.activeAccount)
  168. if(isOffline) {
  169. CCSynchronize.shared()?.readFolder(dirServerUrl, selector: selectorReadFolderWithDownload, account: appDelegate.activeAccount)
  170. }
  171. DispatchQueue.main.async {
  172. self.tableView.reloadRows(at: [indexPath], with: .none)
  173. }
  174. }))
  175. }
  176. actions.append(MenuAction(title: passcodeTitle, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "settingsPasscodeYES"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  177. self.perform(#selector(self.comandoLockPassword))
  178. }))
  179. if (!metadata.e2eEncrypted && CCUtility.isEnd(toEndEnabled: appDelegate.activeAccount)) {
  180. actions.append(MenuAction(title: NSLocalizedString("_remove_available_offline_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "lock"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  181. DispatchQueue.global(qos: .userInitiated).async {
  182. let error = NCNetworkingEndToEnd.sharedManager()?.markFolderEncrypted(onServerUrl: "\(self.serverUrl ?? "")/\(metadata.fileName)", ocId: metadata.ocId, user: appDelegate.activeUser, userID: appDelegate.activeUserID, password: appDelegate.activePassword, url: appDelegate.activeUrl)
  183. DispatchQueue.main.async {
  184. if(error != nil) {
  185. NCContentPresenter.shared.messageNotification(NSLocalizedString("_e2e_error_mark_folder_", comment: ""), description: error?.localizedDescription, delay: TimeInterval(k_dismissAfterSecond), type: .error, errorCode: (error! as NSError).code)
  186. } else {
  187. NCManageDatabase.sharedInstance.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, "\(self.serverUrl ?? "")/\(metadata.fileName)"))
  188. self.readFolder(self.serverUrl)
  189. }
  190. }
  191. }
  192. }))
  193. }
  194. if (metadata.e2eEncrypted && !metadataFolder.e2eEncrypted && CCUtility.isEnd(toEndEnabled: appDelegate.activeAccount)) {
  195. actions.append(MenuAction(title: NSLocalizedString("_e2e_remove_folder_encrypted_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "lock"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  196. DispatchQueue.global(qos: .userInitiated).async {
  197. let error = NCNetworkingEndToEnd.sharedManager()?.deletemarkEndToEndFolderEncrypted(onServerUrl: "\(self.serverUrl ?? "")/\(metadata.fileName)", ocId: metadata.ocId, user: appDelegate.activeUser, userID: appDelegate.activeUserID, password: appDelegate.activePassword, url: appDelegate.activeUrl)
  198. DispatchQueue.main.async {
  199. if(error != nil) {
  200. NCContentPresenter.shared.messageNotification(NSLocalizedString("_e2e_error_delete_mark_folder_", comment: ""), description: error?.localizedDescription, delay: TimeInterval(k_dismissAfterSecond), type: .error, errorCode: (error! as NSError).code)
  201. } else {
  202. NCManageDatabase.sharedInstance.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, "\(self.serverUrl ?? "")/\(metadata.fileName)"))
  203. self.readFolder(self.serverUrl)
  204. }
  205. }
  206. }
  207. }))
  208. }
  209. } else {
  210. var iconHeader: UIImage!
  211. if let icon = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, fileNameView: metadata.fileNameView)) {
  212. iconHeader = icon
  213. } else {
  214. iconHeader = UIImage(named: metadata.iconName)
  215. }
  216. actions.append(MenuAction(title: metadata.fileNameView, icon: iconHeader, action: { menuAction in
  217. }))
  218. actions.append(MenuAction(title: metadata.favorite ? NSLocalizedString("_remove_favorites_", comment: "") : NSLocalizedString("_add_favorites_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 50, height: 50, color: NCBrandColor.sharedInstance.yellowFavorite), action: { menuAction in
  219. self.settingFavorite(metadata, favorite: !metadata.favorite)
  220. }))
  221. if (!metadataFolder.e2eEncrypted) {
  222. actions.append(MenuAction(title: NSLocalizedString("_details_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "details"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  223. NCMainCommon.sharedInstance.openShare(ViewController: self, metadata: metadata, indexPage: 0)
  224. }))
  225. }
  226. if(!NCBrandOptions.sharedInstance.disable_openin_file) {
  227. actions.append(MenuAction(title: NSLocalizedString("_open_in_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "openFile"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  228. self.perform(#selector(self.openinFile(_:)))
  229. }))
  230. }
  231. actions.append(MenuAction(title: NSLocalizedString("_rename_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "rename"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  232. let alertController = UIAlertController(title: NSLocalizedString("_rename_", comment: ""), message: nil, preferredStyle: .alert)
  233. alertController.addTextField { (textField) in
  234. textField.text = metadata.fileNameView
  235. textField.delegate = self as? UITextFieldDelegate
  236. textField.addTarget(self, action: #selector(self.minCharTextFieldDidChange(_:)
  237. ), for: UIControl.Event.editingChanged)
  238. }
  239. let cancelAction = UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: nil)
  240. let okAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { action in
  241. let fileName = alertController.textFields![0].text
  242. self.perform(#selector(self.renameFile(_:)), on: .main, with: [metadata, fileName!], waitUntilDone: false)
  243. })
  244. okAction.isEnabled = false
  245. alertController.addAction(cancelAction)
  246. alertController.addAction(okAction)
  247. self.present(alertController, animated: true, completion: nil)
  248. }))
  249. if (!metadataFolder.e2eEncrypted) {
  250. actions.append(MenuAction(title: NSLocalizedString("_move_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "move"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  251. self.moveOpenWindow([indexPath])
  252. }))
  253. }
  254. if(NCUtility.sharedInstance.isEditImage(metadata.fileNameView as NSString) != nil && !metadataFolder.e2eEncrypted && metadata.status == k_metadataStatusNormal) {
  255. actions.append(MenuAction(title: NSLocalizedString("_modify_photo_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "modifyPhoto"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  256. metadata.session = k_download_session
  257. metadata.sessionError = ""
  258. metadata.sessionSelector = selectorDownloadEditPhoto
  259. metadata.status = Int(k_metadataStatusWaitDownload)
  260. _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
  261. appDelegate.startLoadAutoDownloadUpload()
  262. }))
  263. }
  264. if (!metadataFolder.e2eEncrypted) {
  265. let localFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
  266. var title: String!
  267. if (localFile == nil || localFile!.offline == false) {
  268. title = NSLocalizedString("_set_available_offline_", comment: "")
  269. } else {
  270. title = NSLocalizedString("_remove_available_offline_", comment: "");
  271. }
  272. actions.append(MenuAction(title: title, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "offline"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
  273. if (localFile == nil || !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView)) {
  274. metadata.session = k_download_session
  275. metadata.sessionError = ""
  276. metadata.sessionSelector = selectorLoadOffline
  277. metadata.status = Int(k_metadataStatusWaitDownload)
  278. _ = NCManageDatabase.sharedInstance.addMetadata(metadata)
  279. NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, ocId: metadata.ocId, action: k_action_MOD)
  280. appDelegate.startLoadAutoDownloadUpload()
  281. } else {
  282. NCManageDatabase.sharedInstance.setLocalFile(ocId: metadata.ocId, offline: !localFile!.offline)
  283. DispatchQueue.main.async {
  284. self.tableView.reloadRows(at: [indexPath], with: .none)
  285. }
  286. }
  287. }))
  288. }
  289. }
  290. actions.append(MenuAction(title: NSLocalizedString("_delete_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), width: 50, height: 50, color: .red), action: { menuAction in
  291. self.actionDelete(indexPath)
  292. }))
  293. return actions
  294. }
  295. @objc func toggleMoreMenu(viewController: UIViewController, indexPath: IndexPath, metadata: tableMetadata, metadataFolder: tableMetadata) {
  296. let mainMenuViewController = UIStoryboard.init(name: "Menu", bundle: nil).instantiateViewController(withIdentifier: "MainMenuTableViewController") as! MainMenuTableViewController
  297. mainMenuViewController.actions = self.initMoreMenu(indexPath: indexPath, metadata: metadata, metadataFolder: metadataFolder)
  298. let menuPanelController = MenuPanelController()
  299. menuPanelController.panelWidth = Int(viewController.view.frame.width)
  300. menuPanelController.delegate = mainMenuViewController
  301. menuPanelController.set(contentViewController: mainMenuViewController)
  302. menuPanelController.track(scrollView: mainMenuViewController.tableView)
  303. viewController.present(menuPanelController, animated: true, completion: nil)
  304. }
  305. }