|
@@ -71,7 +71,7 @@ extension AppDelegate {
|
|
|
NCMainCommon.sharedInstance.startAudioRecorder()
|
|
|
}))
|
|
|
|
|
|
- actions.append(MenuAction(title: NSLocalizedString("_create_folder_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement), action: { menuAction in
|
|
|
+ actions.append(MenuAction(title: NSLocalizedString("_create_folder_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
|
|
|
appDelegate.activeMain.createFolder()
|
|
|
}))
|
|
|
|
|
@@ -144,3 +144,141 @@ extension AppDelegate {
|
|
|
viewController.present(fpc, animated: true, completion: nil)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+extension CCMain {
|
|
|
+
|
|
|
+ private func initSortMenu() -> [MenuAction] {
|
|
|
+ var actions = [MenuAction]()
|
|
|
+
|
|
|
+ actions.append(MenuAction(
|
|
|
+ title: NSLocalizedString("_order_by_name_a_z_", comment: ""),
|
|
|
+ icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortFileNameAZ"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
+ onTitle: NSLocalizedString("_order_by_name_z_a_", comment: ""),
|
|
|
+ onIcon: CCGraphics.changeThemingColorImage(UIImage.init(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.getAscendingSettings()) {
|
|
|
+ CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
|
|
|
+ } else {
|
|
|
+ CCUtility.setOrderSettings("fileName")
|
|
|
+ CCUtility.setAscendingSettings(true)
|
|
|
+ }
|
|
|
+
|
|
|
+ NotificationCenter.default.post(name: Notification.Name.init(rawValue: "clearDateReadDataSource"), object: nil)
|
|
|
+ }))
|
|
|
+
|
|
|
+ actions.append(MenuAction(
|
|
|
+ title: NSLocalizedString("_order_by_date_more_recent_", comment: ""),
|
|
|
+ icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortDateMoreRecent"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
+ onTitle: NSLocalizedString("_order_by_date_less_recent_", comment: ""),
|
|
|
+ onIcon: CCGraphics.changeThemingColorImage(UIImage.init(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.getAscendingSettings()) {
|
|
|
+ CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
|
|
|
+ } else {
|
|
|
+ CCUtility.setOrderSettings("date")
|
|
|
+ CCUtility.setAscendingSettings(true)
|
|
|
+ }
|
|
|
+
|
|
|
+ NotificationCenter.default.post(name: Notification.Name.init(rawValue: "clearDateReadDataSource"), object: nil)
|
|
|
+ }))
|
|
|
+
|
|
|
+ actions.append(MenuAction(
|
|
|
+ title: NSLocalizedString("_order_by_size_smallest_", comment: ""),
|
|
|
+ icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortSmallest"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon),
|
|
|
+ onTitle: NSLocalizedString("_order_by_size_largest_", comment: ""),
|
|
|
+ onIcon: CCGraphics.changeThemingColorImage(UIImage.init(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.getAscendingSettings()) {
|
|
|
+ CCUtility.setAscendingSettings(!CCUtility.getAscendingSettings())
|
|
|
+ } else {
|
|
|
+ CCUtility.setOrderSettings("size")
|
|
|
+ CCUtility.setAscendingSettings(true)
|
|
|
+ }
|
|
|
+
|
|
|
+ NotificationCenter.default.post(name: Notification.Name.init(rawValue: "clearDateReadDataSource"), object: nil)
|
|
|
+ }))
|
|
|
+
|
|
|
+ actions.append(MenuAction(
|
|
|
+ title: NSLocalizedString("_directory_on_top_no_", comment: ""),
|
|
|
+ icon: CCGraphics.changeThemingColorImage(UIImage.init(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.post(name: Notification.Name.init(rawValue: "clearDateReadDataSource"), object: nil)
|
|
|
+ }))
|
|
|
+
|
|
|
+ return actions
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc public func toggleMenu(viewController: UIViewController) {
|
|
|
+ let mainMenuViewController = UIStoryboard.init(name: "Menu", bundle: nil).instantiateViewController(withIdentifier: "MainMenuTableViewController") as! MainMenuTableViewController
|
|
|
+ mainMenuViewController.actions = self.initSortMenu()
|
|
|
+
|
|
|
+ let fpc = FloatingPanelController()
|
|
|
+ fpc.surfaceView.grabberHandle.isHidden = true
|
|
|
+ fpc.delegate = mainMenuViewController
|
|
|
+ fpc.set(contentViewController: mainMenuViewController)
|
|
|
+ fpc.track(scrollView: mainMenuViewController.tableView)
|
|
|
+ fpc.isRemovalInteractionEnabled = true
|
|
|
+ if #available(iOS 11, *) {
|
|
|
+ fpc.surfaceView.cornerRadius = 16
|
|
|
+ } else {
|
|
|
+ fpc.surfaceView.cornerRadius = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ viewController.present(fpc, animated: true, completion: nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc public func toggleSelectMenu(viewController: UIViewController) {
|
|
|
+ let mainMenuViewController = UIStoryboard.init(name: "Menu", bundle: nil).instantiateViewController(withIdentifier: "MainMenuTableViewController") as! MainMenuTableViewController
|
|
|
+ mainMenuViewController.actions = self.initSelectMenu()
|
|
|
+
|
|
|
+ let fpc = FloatingPanelController()
|
|
|
+ fpc.surfaceView.grabberHandle.isHidden = true
|
|
|
+ fpc.delegate = mainMenuViewController
|
|
|
+ fpc.set(contentViewController: mainMenuViewController)
|
|
|
+ fpc.track(scrollView: mainMenuViewController.tableView)
|
|
|
+ fpc.isRemovalInteractionEnabled = true
|
|
|
+ if #available(iOS 11, *) {
|
|
|
+ fpc.surfaceView.cornerRadius = 16
|
|
|
+ } else {
|
|
|
+ fpc.surfaceView.cornerRadius = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ viewController.present(fpc, animated: true, completion: nil)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private func initSelectMenu() -> [MenuAction] {
|
|
|
+ var actions = [MenuAction]()
|
|
|
+
|
|
|
+ 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
|
|
|
+ self.didSelectAll()
|
|
|
+ }))
|
|
|
+
|
|
|
+ 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
|
|
|
+ self.moveOpenWindow(self.tableView.indexPathsForSelectedRows)
|
|
|
+ }))
|
|
|
+
|
|
|
+ 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
|
|
|
+ self.downloadSelectedFilesFolders()
|
|
|
+ }))
|
|
|
+
|
|
|
+ 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
|
|
|
+ self.saveSelectedFiles()
|
|
|
+ }))
|
|
|
+
|
|
|
+ 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
|
|
|
+ self.deleteFile()
|
|
|
+ }))
|
|
|
+
|
|
|
+ return actions
|
|
|
+ }
|
|
|
+}
|