|
@@ -28,115 +28,6 @@ import NCCommunication
|
|
|
|
|
|
extension CCMain {
|
|
|
|
|
|
- // MARK: - Sort Menu
|
|
|
- /*
|
|
|
- @objc func toggleMenu(viewController: UIViewController) {
|
|
|
- let mainMenuViewController = UIStoryboard.init(name: "NCMenu", bundle: nil).instantiateViewController(withIdentifier: "NCMainMenuTableViewController") as! NCMainMenuTableViewController
|
|
|
- mainMenuViewController.actions = self.initSortMenu()
|
|
|
-
|
|
|
- let menuPanelController = NCMenuPanelController()
|
|
|
- menuPanelController.parentPresenter = viewController
|
|
|
- menuPanelController.delegate = mainMenuViewController
|
|
|
- menuPanelController.set(contentViewController: mainMenuViewController)
|
|
|
- menuPanelController.track(scrollView: mainMenuViewController.tableView)
|
|
|
-
|
|
|
- viewController.present(menuPanelController, animated: true, completion: nil)
|
|
|
- }
|
|
|
-
|
|
|
- @objc func SetSortButtonText() {
|
|
|
-
|
|
|
- switch CCUtility.getOrderSettings() {
|
|
|
- case "fileName":
|
|
|
- self.sortButton.setTitle((CCUtility.getAscendingSettings() ? NSLocalizedString("_sorted_by_name_a_z_", comment: "") : NSLocalizedString("_sorted_by_name_z_a_", comment: "")), for: .normal)
|
|
|
- case "date":
|
|
|
- self.sortButton.setTitle((CCUtility.getAscendingSettings() ? NSLocalizedString("_sorted_by_date_less_recent_", comment: "") : NSLocalizedString("_sorted_by_date_more_recent_", comment: "")), for: .normal)
|
|
|
- case "size":
|
|
|
- self.sortButton.setTitle((CCUtility.getAscendingSettings() ? NSLocalizedString("_sorted_by_size_largest_", comment: "") : NSLocalizedString("_sorted_by_size_smallest_", comment: "")), for: .normal)
|
|
|
- default:
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private func initSortMenu() -> [NCMenuAction] {
|
|
|
- var actions = [NCMenuAction]()
|
|
|
-
|
|
|
- actions.append(
|
|
|
- NCMenuAction(
|
|
|
- title: NSLocalizedString("_order_by_name_a_z_", comment: ""),
|
|
|
- icon: CCGraphics.changeThemingColorImage(UIImage(named: "sortFileNameAZ"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
- onTitle: NSLocalizedString("_order_by_name_z_a_", comment: ""),
|
|
|
- onIcon: CCGraphics.changeThemingColorImage(UIImage(named: "sortFileNameZA"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
- selected: CCUtility.getOrderSettings() == "fileName",
|
|
|
- on: CCUtility.getAscendingSettings(),
|
|
|
- action: { menuAction in
|
|
|
- if(CCUtility.getOrderSettings() == "fileName") {
|
|
|
- CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
|
|
|
- } else {
|
|
|
- CCUtility.setOrderSettings("fileName")
|
|
|
- }
|
|
|
- self.SetSortButtonText()
|
|
|
- NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["serverUrl":self.serverUrl ?? ""])
|
|
|
- }
|
|
|
- )
|
|
|
- )
|
|
|
-
|
|
|
- actions.append(
|
|
|
- NCMenuAction(
|
|
|
- title: NSLocalizedString("_order_by_date_more_recent_", comment: ""),
|
|
|
- icon: CCGraphics.changeThemingColorImage(UIImage(named: "sortDateMoreRecent"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
- onTitle: NSLocalizedString("_order_by_date_less_recent_", comment: ""),
|
|
|
- onIcon: CCGraphics.changeThemingColorImage(UIImage(named: "sortDateLessRecent"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
- selected: CCUtility.getOrderSettings() == "date",
|
|
|
- on: CCUtility.getAscendingSettings(),
|
|
|
- action: { menuAction in
|
|
|
- if(CCUtility.getOrderSettings() == "date") {
|
|
|
- CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
|
|
|
- } else {
|
|
|
- CCUtility.setOrderSettings("date")
|
|
|
- }
|
|
|
- self.SetSortButtonText()
|
|
|
- NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["serverUrl":self.serverUrl ?? ""])
|
|
|
- }
|
|
|
- )
|
|
|
- )
|
|
|
-
|
|
|
- actions.append(
|
|
|
- NCMenuAction(
|
|
|
- title: NSLocalizedString("_order_by_size_smallest_", comment: ""),
|
|
|
- icon: CCGraphics.changeThemingColorImage(UIImage(named: "sortSmallest"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
- onTitle: NSLocalizedString("_order_by_size_largest_", comment: ""),
|
|
|
- onIcon: CCGraphics.changeThemingColorImage(UIImage(named: "sortLargest"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
- selected: CCUtility.getOrderSettings() == "size",
|
|
|
- on: CCUtility.getAscendingSettings(),
|
|
|
- action: { menuAction in
|
|
|
- if(CCUtility.getOrderSettings() == "size") {
|
|
|
- CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
|
|
|
- } else {
|
|
|
- CCUtility.setOrderSettings("size")
|
|
|
- }
|
|
|
- self.SetSortButtonText()
|
|
|
- NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["serverUrl":self.serverUrl ?? ""])
|
|
|
- }
|
|
|
- )
|
|
|
- )
|
|
|
-
|
|
|
- actions.append(
|
|
|
- NCMenuAction(
|
|
|
- title: NSLocalizedString("_directory_on_top_no_", comment: ""),
|
|
|
- icon: CCGraphics.changeThemingColorImage(UIImage(named: "foldersOnTop"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
- selected: CCUtility.getDirectoryOnTop(),
|
|
|
- on: CCUtility.getDirectoryOnTop(),
|
|
|
- action: { menuAction in
|
|
|
- CCUtility.setDirectoryOnTop(!CCUtility.getDirectoryOnTop())
|
|
|
- NotificationCenter.default.postOnMainThread(name: k_notificationCenter_reloadDataSource, userInfo: ["serverUrl":self.serverUrl ?? ""])
|
|
|
- }
|
|
|
- )
|
|
|
- )
|
|
|
-
|
|
|
- return actions
|
|
|
- }
|
|
|
- */
|
|
|
-
|
|
|
// MARK: - Select Menu
|
|
|
|
|
|
@objc func toggleSelectMenu(viewController: UIViewController) {
|