|
@@ -535,6 +535,69 @@ extension CCMain {
|
|
|
|
|
|
}
|
|
|
|
|
|
+extension CCFavorites {
|
|
|
+
|
|
|
+ private func initMoreMenu(indexPath: IndexPath, metadata: tableMetadata) -> [MenuAction] {
|
|
|
+ var actions = [MenuAction]()
|
|
|
+
|
|
|
+ var iconHeader: UIImage!
|
|
|
+ if let icon = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, fileNameView: metadata.fileNameView)) {
|
|
|
+ iconHeader = icon
|
|
|
+ } else {
|
|
|
+ if(metadata.directory){
|
|
|
+ iconHeader = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)
|
|
|
+ } else {
|
|
|
+ iconHeader = UIImage(named: metadata.iconName)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ actions.append(MenuAction(title: metadata.fileNameView, icon: iconHeader, action: { menuAction in
|
|
|
+ }))
|
|
|
+
|
|
|
+ if(self.serverUrl == nil) {
|
|
|
+ actions.append(MenuAction(title: NSLocalizedString("_remove_favorites_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 50, height: 50, color: NCBrandColor.sharedInstance.yellowFavorite), action: { menuAction in
|
|
|
+ self.settingFavorite(metadata, favorite: false)
|
|
|
+ }))
|
|
|
+ }
|
|
|
+
|
|
|
+ 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
|
|
|
+ NCMainCommon.sharedInstance.openShare(ViewController: self, metadata: metadata, indexPage: 0)
|
|
|
+ }))
|
|
|
+
|
|
|
+ if(!metadata.directory && !NCBrandOptions.sharedInstance.disable_openin_file) {
|
|
|
+ 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
|
|
|
+ self.tableView.setEditing(false, animated: true)
|
|
|
+ NCMainCommon.sharedInstance.downloadOpen(metadata: metadata, selector: selectorOpenIn)
|
|
|
+ }))
|
|
|
+ }
|
|
|
+
|
|
|
+ actions.append(MenuAction(title: NSLocalizedString("_delete_", comment: ""), icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon), action: { menuAction in
|
|
|
+ self.actionDelete(indexPath)
|
|
|
+ }))
|
|
|
+
|
|
|
+ return actions
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func toggleMoreMenu(viewController: UIViewController, indexPath: IndexPath, metadata: tableMetadata) {
|
|
|
+ let mainMenuViewController = UIStoryboard.init(name: "Menu", bundle: nil).instantiateViewController(withIdentifier: "MainMenuTableViewController") as! MainMenuTableViewController
|
|
|
+ mainMenuViewController.actions = self.initMoreMenu(indexPath: indexPath, metadata: metadata)
|
|
|
+
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//helper to find the current top view controller
|
|
|
extension UIViewController {
|
|
|
@objc class func topViewController(rootViewController: UIViewController?) -> UIViewController? {
|