NCShare.swift 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. //
  2. // NCShare.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 17/07/2019.
  6. // Copyright © 2019 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  9. // Author Henrik Storch <henrik.storch@nextcloud.com>
  10. //
  11. // This program is free software: you can redistribute it and/or modify
  12. // it under the terms of the GNU General Public License as published by
  13. // the Free Software Foundation, either version 3 of the License, or
  14. // (at your option) any later version.
  15. //
  16. // This program is distributed in the hope that it will be useful,
  17. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. // GNU General Public License for more details.
  20. //
  21. // You should have received a copy of the GNU General Public License
  22. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. //
  24. import UIKit
  25. import Parchment
  26. import DropDown
  27. import NCCommunication
  28. import MarqueeLabel
  29. class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareNetworkingDelegate {
  30. @IBOutlet weak var viewContainerConstraint: NSLayoutConstraint!
  31. @IBOutlet weak var sharedWithYouByView: UIView!
  32. @IBOutlet weak var sharedWithYouByImage: UIImageView!
  33. @IBOutlet weak var sharedWithYouByLabel: UILabel!
  34. @IBOutlet weak var sharedWithYouByNoteImage: UIImageView!
  35. @IBOutlet weak var sharedWithYouByNote: MarqueeLabel!
  36. @IBOutlet weak var searchFieldTopConstraint: NSLayoutConstraint!
  37. @IBOutlet weak var searchField: UITextField!
  38. @IBOutlet weak var shareLinkImage: UIImageView!
  39. @IBOutlet weak var shareLinkLabel: UILabel!
  40. @IBOutlet weak var shareInternalLinkImage: UIImageView!
  41. @IBOutlet weak var shareInternalLinkLabel: UILabel!
  42. @IBOutlet weak var shareInternalLinkDescription: UILabel!
  43. @IBOutlet weak var buttonInternalCopy: UIButton!
  44. @IBOutlet weak var buttonCopy: UIButton!
  45. @IBOutlet weak var buttonMenu: UIButton!
  46. @IBOutlet weak var tableView: UITableView!
  47. private let appDelegate = UIApplication.shared.delegate as! AppDelegate
  48. public var metadata: tableMetadata?
  49. public var sharingEnabled = true
  50. public var height: CGFloat = 0
  51. private var shareLinkMenuView: NCShareLinkMenuView?
  52. private var shareUserMenuView: NCShareUserMenuView?
  53. private var shareMenuViewWindow: UIView?
  54. private var dropDown = DropDown()
  55. private var networking: NCShareNetworking?
  56. // MARK: - View Life Cycle
  57. override func viewDidLoad() {
  58. super.viewDidLoad()
  59. view.backgroundColor = NCBrandColor.shared.systemBackground
  60. viewContainerConstraint.constant = height
  61. searchFieldTopConstraint.constant = 10
  62. searchField.placeholder = NSLocalizedString("_shareLinksearch_placeholder_", comment: "")
  63. shareLinkImage.image = NCShareCommon.shared.createLinkAvatar(imageName: "sharebylink", colorCircle: NCBrandColor.shared.brandElement)
  64. shareLinkLabel.text = NSLocalizedString("_share_link_", comment: "")
  65. shareLinkLabel.textColor = NCBrandColor.shared.label
  66. buttonCopy.setImage(UIImage.init(named: "shareCopy")?.image(color: .gray, size: 50), for: .normal)
  67. shareInternalLinkImage.image = NCShareCommon.shared.createLinkAvatar(imageName: "shareInternalLink", colorCircle: .gray)
  68. shareInternalLinkLabel.text = NSLocalizedString("_share_internal_link_", comment: "")
  69. shareInternalLinkDescription.text = NSLocalizedString("_share_internal_link_des_", comment: "")
  70. buttonInternalCopy.setImage(UIImage.init(named: "shareCopy")?.image(color: .gray, size: 50), for: .normal)
  71. tableView.dataSource = self
  72. tableView.delegate = self
  73. tableView.allowsSelection = false
  74. tableView.backgroundColor = NCBrandColor.shared.systemBackground
  75. tableView.register(UINib.init(nibName: "NCShareLinkCell", bundle: nil), forCellReuseIdentifier: "cellLink")
  76. tableView.register(UINib.init(nibName: "NCShareUserCell", bundle: nil), forCellReuseIdentifier: "cellUser")
  77. NotificationCenter.default.addObserver(self, selector: #selector(reloadData), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataNCShare), object: nil)
  78. // Shared with you by ...
  79. if let metadata = metadata, !metadata.ownerId.isEmpty, metadata.ownerId != self.appDelegate.userId {
  80. searchFieldTopConstraint.constant = 65
  81. sharedWithYouByView.isHidden = false
  82. sharedWithYouByLabel.text = NSLocalizedString("_shared_with_you_by_", comment: "") + " " + metadata.ownerDisplayName
  83. sharedWithYouByImage.image = NCUtility.shared.loadUserImage(
  84. for: metadata.ownerId,
  85. displayName: metadata.ownerDisplayName,
  86. userBaseUrl: appDelegate)
  87. let shareAction = UITapGestureRecognizer(target: self, action: #selector(openShareProfile))
  88. sharedWithYouByImage.addGestureRecognizer(shareAction)
  89. let shareLabelAction = UITapGestureRecognizer(target: self, action: #selector(openShareProfile))
  90. sharedWithYouByLabel.addGestureRecognizer(shareLabelAction)
  91. if metadata.note.count > 0 {
  92. searchFieldTopConstraint.constant = 95
  93. sharedWithYouByNoteImage.isHidden = false
  94. sharedWithYouByNoteImage.image = NCUtility.shared.loadImage(named: "note.text", color: .gray)
  95. sharedWithYouByNote.isHidden = false
  96. sharedWithYouByNote.text = metadata.note
  97. sharedWithYouByNote.textColor = NCBrandColor.shared.label
  98. sharedWithYouByNote.trailingBuffer = sharedWithYouByNote.frame.width
  99. } else {
  100. sharedWithYouByNoteImage.isHidden = true
  101. sharedWithYouByNote.isHidden = true
  102. }
  103. let fileName = appDelegate.userBaseUrl + "-" + metadata.ownerId + ".png"
  104. if NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) == nil {
  105. let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
  106. let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
  107. NCCommunication.shared.downloadAvatar(user: metadata.ownerId, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: etag) { (account, imageAvatar, imageOriginal, etag, errorCode, errorMessage) in
  108. if errorCode == 0, let etag = etag, let imageAvatar = imageAvatar {
  109. NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag)
  110. self.sharedWithYouByImage.image = imageAvatar
  111. } else if errorCode == NCGlobal.shared.errorNotModified, let imageAvatar = NCManageDatabase.shared.setAvatarLoaded(fileName: fileName) {
  112. self.sharedWithYouByImage.image = imageAvatar
  113. }
  114. }
  115. }
  116. }
  117. reloadData()
  118. networking = NCShareNetworking(metadata: metadata!, urlBase: appDelegate.urlBase, view: self.view, delegate: self)
  119. if sharingEnabled {
  120. let isVisible = (self.navigationController?.topViewController as? NCSharePaging)?.indexPage == .sharing
  121. networking?.readShare(showLoadingIndicator: isVisible)
  122. }
  123. // changeTheming
  124. NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
  125. NotificationCenter.default.addObserver(self, selector: #selector(changePermissions(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterShareChangePermissions), object: nil)
  126. changeTheming()
  127. }
  128. // MARK: - Notification Center
  129. @objc func openShareProfile() {
  130. guard let metadata = metadata else { return }
  131. self.showProfileMenu(userId: metadata.ownerId)
  132. }
  133. @objc func changeTheming() {
  134. tableView.reloadData()
  135. }
  136. @objc func changePermissions(_ notification: NSNotification) {
  137. if let userInfo = notification.userInfo as NSDictionary? {
  138. if let idShare = userInfo["idShare"] as? Int, let permissions = userInfo["permissions"] as? Int, let hideDownload = userInfo["hideDownload"] as? Bool {
  139. networking?.updateShare(idShare: idShare, password: nil, permissions: permissions, note: nil, label: nil, expirationDate: nil, hideDownload: hideDownload)
  140. }
  141. }
  142. }
  143. // MARK: -
  144. @objc func reloadData() {
  145. let shares = NCManageDatabase.shared.getTableShares(metadata: metadata!)
  146. if shares.firstShareLink == nil {
  147. buttonMenu.setImage(UIImage.init(named: "shareAdd")?.image(color: .gray, size: 50), for: .normal)
  148. buttonCopy.isHidden = true
  149. } else {
  150. buttonMenu.setImage(UIImage.init(named: "shareMenu")?.image(color: .gray, size: 50), for: .normal)
  151. buttonCopy.isHidden = false
  152. shareLinkLabel.text = NSLocalizedString("_share_link_", comment: "")
  153. if shares.firstShareLink?.label.count ?? 0 > 0 {
  154. if let shareLinkLabel = shareLinkLabel {
  155. if let label = shares.firstShareLink?.label {
  156. shareLinkLabel.text = NSLocalizedString("_share_link_", comment: "") + " (" + label + ")"
  157. }
  158. }
  159. }
  160. }
  161. tableView.reloadData()
  162. }
  163. // MARK: - IBAction
  164. @IBAction func searchFieldDidEndOnExit(textField: UITextField) {
  165. guard let searchString = textField.text else { return }
  166. networking?.getSharees(searchString: searchString)
  167. }
  168. @IBAction func touchUpInsideButtonCopy(_ sender: Any) {
  169. guard let metadata = self.metadata else { return }
  170. let shares = NCManageDatabase.shared.getTableShares(metadata: metadata)
  171. tapCopy(with: shares.firstShareLink, sender: sender)
  172. }
  173. @IBAction func touchUpInsideButtonCopyInernalLink(_ sender: Any) {
  174. guard let metadata = self.metadata else { return }
  175. let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
  176. NCNetworking.shared.readFile(serverUrlFileName: serverUrlFileName, account: metadata.account) { (account, metadata, errorCode, errorDescription) in
  177. if errorCode == 0 && metadata != nil {
  178. let internalLink = self.appDelegate.urlBase + "/index.php/f/" + metadata!.fileId
  179. NCShareCommon.shared.copyLink(link: internalLink, viewController: self, sender: sender)
  180. } else {
  181. NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
  182. }
  183. }
  184. }
  185. @IBAction func touchUpInsideButtonMenu(_ sender: Any) {
  186. guard let metadata = self.metadata else { return }
  187. let isFilesSharingPublicPasswordEnforced = NCManageDatabase.shared.getCapabilitiesServerBool(account: metadata.account, elements: NCElementsJSON.shared.capabilitiesFileSharingPubPasswdEnforced, exists: false)
  188. let shares = NCManageDatabase.shared.getTableShares(metadata: metadata)
  189. if isFilesSharingPublicPasswordEnforced && shares.firstShareLink == nil {
  190. let alertController = UIAlertController(title: NSLocalizedString("_enforce_password_protection_", comment: ""), message: "", preferredStyle: .alert)
  191. alertController.addTextField { (textField) in
  192. textField.isSecureTextEntry = true
  193. }
  194. alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .default) { (action:UIAlertAction) in })
  195. let okAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default) { (action:UIAlertAction) in
  196. let password = alertController.textFields?.first?.text
  197. self.networking?.createShareLink(password: password ?? "")
  198. }
  199. alertController.addAction(okAction)
  200. self.present(alertController, animated: true, completion:nil)
  201. } else if shares.firstShareLink == nil {
  202. networking?.createShareLink(password: "")
  203. } else {
  204. tapMenu(with: shares.firstShareLink!, sender: sender)
  205. }
  206. }
  207. @objc func tapLinkMenuViewWindow(gesture: UITapGestureRecognizer) {
  208. shareLinkMenuView?.unLoad()
  209. shareLinkMenuView = nil
  210. shareUserMenuView?.unLoad()
  211. shareUserMenuView = nil
  212. }
  213. func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
  214. return gestureRecognizer.view == touch.view
  215. }
  216. // MARK: - NCShareNetworkingDelegate
  217. func readShareCompleted() {
  218. NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataNCShare)
  219. }
  220. func shareCompleted() {
  221. NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataNCShare)
  222. }
  223. func unShareCompleted() { }
  224. func updateShareWithError(idShare: Int) {
  225. self.reloadData()
  226. }
  227. func getSharees(sharees: [NCCommunicationSharee]?) {
  228. guard let sharees = sharees else { return }
  229. dropDown = DropDown()
  230. let appearance = DropDown.appearance()
  231. appearance.backgroundColor = NCBrandColor.shared.systemBackground
  232. appearance.cornerRadius = 10
  233. appearance.shadowColor = UIColor(white: 0.5, alpha: 1)
  234. appearance.shadowOpacity = 0.9
  235. appearance.shadowRadius = 25
  236. appearance.animationduration = 0.25
  237. appearance.textColor = .darkGray
  238. appearance.setupMaskedCorners([.layerMaxXMaxYCorner, .layerMinXMaxYCorner])
  239. for sharee in sharees {
  240. var label = sharee.label
  241. if sharee.shareType == NCShareCommon.shared.SHARE_TYPE_CIRCLE {
  242. label = label + " (" + sharee.circleInfo + ", " + sharee.circleOwner + ")"
  243. }
  244. dropDown.dataSource.append(label)
  245. }
  246. dropDown.anchorView = searchField
  247. dropDown.bottomOffset = CGPoint(x: 0, y: searchField.bounds.height)
  248. dropDown.width = searchField.bounds.width
  249. dropDown.direction = .bottom
  250. dropDown.cellNib = UINib(nibName: "NCShareUserDropDownCell", bundle: nil)
  251. dropDown.customCellConfiguration = { (index: Index, item: String, cell: DropDownCell) -> Void in
  252. guard let cell = cell as? NCShareUserDropDownCell else { return }
  253. let sharee = sharees[index]
  254. cell.imageItem.image = NCShareCommon.shared.getImageShareType(shareType: sharee.shareType)
  255. cell.imageShareeType.image = NCShareCommon.shared.getImageShareType(shareType: sharee.shareType)
  256. let status = NCUtility.shared.getUserStatus(userIcon: sharee.userIcon, userStatus: sharee.userStatus, userMessage: sharee.userMessage)
  257. cell.imageStatus.image = status.onlineStatus
  258. cell.status.text = status.statusMessage
  259. if cell.status.text?.count ?? 0 > 0 {
  260. cell.centerTitle.constant = -5
  261. } else {
  262. cell.centerTitle.constant = 0
  263. }
  264. cell.imageItem.image = NCUtility.shared.loadUserImage(
  265. for: sharee.shareWith,
  266. displayName: nil,
  267. userBaseUrl: self.appDelegate)
  268. let fileName = self.appDelegate.userBaseUrl + "-" + sharee.shareWith + ".png"
  269. if NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) == nil {
  270. let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
  271. let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
  272. NCCommunication.shared.downloadAvatar(user: sharee.shareWith, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: etag) { (account, imageAvatar, imageOriginal, etag, errorCode, errorMessage) in
  273. if errorCode == 0, let etag = etag, let imageAvatar = imageAvatar {
  274. NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag)
  275. cell.imageItem.image = imageAvatar
  276. } else if errorCode == NCGlobal.shared.errorNotModified, let imageAvatar = NCManageDatabase.shared.setAvatarLoaded(fileName: fileName) {
  277. cell.imageItem.image = imageAvatar
  278. }
  279. }
  280. }
  281. }
  282. dropDown.selectionAction = { [weak self] (index, item) in
  283. let sharee = sharees[index]
  284. self!.networking?.createShare(shareWith: sharee.shareWith, shareType: sharee.shareType, metadata: self!.metadata!)
  285. }
  286. dropDown.show()
  287. }
  288. }
  289. // MARK: - UITableViewDelegate
  290. extension NCShare: UITableViewDelegate {
  291. func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  292. return 70
  293. }
  294. }
  295. // MARK: - UITableViewDataSource
  296. extension NCShare: UITableViewDataSource {
  297. func numberOfSections(in tableView: UITableView) -> Int {
  298. return 1
  299. }
  300. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  301. var numOfRows = 0
  302. let shares = NCManageDatabase.shared.getTableShares(metadata: metadata!)
  303. if shares.share != nil {
  304. numOfRows = shares.share!.count
  305. }
  306. return numOfRows
  307. }
  308. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  309. let shares = NCManageDatabase.shared.getTableShares(metadata: metadata!)
  310. let tableShare = shares.share![indexPath.row]
  311. // LINK
  312. if tableShare.shareType == 3 {
  313. if let cell = tableView.dequeueReusableCell(withIdentifier: "cellLink", for: indexPath) as? NCShareLinkCell {
  314. cell.tableShare = tableShare
  315. cell.delegate = self
  316. cell.labelTitle.text = NSLocalizedString("_share_link_", comment: "")
  317. if tableShare.label.count > 0 {
  318. cell.labelTitle.text = NSLocalizedString("_share_link_", comment: "") + " (" + tableShare.label + ")"
  319. }
  320. cell.labelTitle.textColor = NCBrandColor.shared.label
  321. return cell
  322. }
  323. } else {
  324. // USER
  325. if let cell = tableView.dequeueReusableCell(withIdentifier: "cellUser", for: indexPath) as? NCShareUserCell {
  326. cell.tableShare = tableShare
  327. cell.delegate = self
  328. cell.labelTitle.text = tableShare.shareWithDisplayname
  329. cell.labelTitle.textColor = NCBrandColor.shared.label
  330. cell.isUserInteractionEnabled = true
  331. cell.labelQuickStatus.isHidden = false
  332. cell.imageDownArrow.isHidden = false
  333. cell.buttonMenu.isHidden = false
  334. cell.imageItem.image = NCShareCommon.shared.getImageShareType(shareType: tableShare.shareType)
  335. let status = NCUtility.shared.getUserStatus(userIcon: tableShare.userIcon, userStatus: tableShare.userStatus, userMessage: tableShare.userMessage)
  336. cell.imageStatus.image = status.onlineStatus
  337. cell.status.text = status.statusMessage
  338. let fileName = appDelegate.userBaseUrl + "-" + tableShare.shareWith + ".png"
  339. NCOperationQueue.shared.downloadAvatar(user: tableShare.shareWith, dispalyName: tableShare.shareWithDisplayname, fileName: fileName, cell: cell, view: tableView)
  340. // If the initiator or the recipient is not the current user, show the list of sharees without any options to edit it.
  341. if tableShare.uidOwner != self.appDelegate.userId && tableShare.uidFileOwner != self.appDelegate.userId {
  342. cell.isUserInteractionEnabled = false
  343. cell.labelQuickStatus.isHidden = true
  344. cell.imageDownArrow.isHidden = true
  345. cell.buttonMenu.isHidden = true
  346. }
  347. cell.btnQuickStatus.setTitle("", for: .normal)
  348. cell.btnQuickStatus.contentHorizontalAlignment = .left
  349. if tableShare.permissions == NCGlobal.shared.permissionCreateShare {
  350. cell.labelQuickStatus.text = NSLocalizedString("_share_file_drop_", comment: "")
  351. } else {
  352. // Read Only
  353. if CCUtility.isAnyPermission(toEdit: tableShare.permissions) {
  354. cell.labelQuickStatus.text = NSLocalizedString("_share_editing_", comment: "")
  355. } else {
  356. cell.labelQuickStatus.text = NSLocalizedString("_share_read_only_", comment: "")
  357. }
  358. }
  359. return cell
  360. }
  361. }
  362. return UITableViewCell()
  363. }
  364. }
  365. // MARK: - NCCell Delegates
  366. extension NCShare: NCShareLinkCellDelegate, NCShareUserCellDelegate {
  367. func tapCopy(with tableShare: tableShare?, sender: Any) {
  368. if let link = tableShare?.url {
  369. NCShareCommon.shared.copyLink(link: link, viewController: self, sender: sender)
  370. }
  371. }
  372. func tapMenu(with tableShare: tableShare?, sender: Any) {
  373. guard let tableShare = tableShare else { return }
  374. if tableShare.shareType == 3 {
  375. let views = NCShareCommon.shared.openViewMenuShareLink(shareViewController: self, tableShare: tableShare, metadata: metadata!)
  376. shareLinkMenuView = views.shareLinkMenuView
  377. shareMenuViewWindow = views.viewWindow
  378. let tap = UITapGestureRecognizer(target: self, action: #selector(tapLinkMenuViewWindow))
  379. tap.delegate = self
  380. shareMenuViewWindow?.addGestureRecognizer(tap)
  381. } else {
  382. let views = NCShareCommon.shared.openViewMenuUser(shareViewController: self, tableShare: tableShare, metadata: metadata!)
  383. shareUserMenuView = views.shareUserMenuView
  384. shareMenuViewWindow = views.viewWindow
  385. let tap = UITapGestureRecognizer(target: self, action: #selector(tapLinkMenuViewWindow))
  386. tap.delegate = self
  387. shareMenuViewWindow?.addGestureRecognizer(tap)
  388. }
  389. }
  390. func showProfile(with tableShare: tableShare?, sender: Any) {
  391. guard let tableShare = tableShare else { return }
  392. showProfileMenu(userId: tableShare.shareWith)
  393. }
  394. func quickStatus(with tableShare: tableShare?, sender: Any) {
  395. guard let tableShare = tableShare else { return }
  396. if tableShare.shareType != NCGlobal.shared.permissionDefaultFileRemoteShareNoSupportShareOption {
  397. let quickStatusMenu = NCShareQuickStatusMenu()
  398. quickStatusMenu.toggleMenu(viewController: self, directory: metadata!.directory, tableShare: tableShare)
  399. }
  400. }
  401. }