NCShare.swift 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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(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(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(nibName: "NCShareLinkCell", bundle: nil), forCellReuseIdentifier: "cellLink")
  76. tableView.register(UINib(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) { _, imageAvatar, _, etag, errorCode, _ 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(named: "shareAdd")?.image(color: .gray, size: 50), for: .normal)
  148. buttonCopy.isHidden = true
  149. } else {
  150. buttonMenu.setImage(UIImage(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, queue: .main) { _, 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. func checkEnforcedPassword(callback: @escaping (String?) -> Void) {
  186. guard let metadata = self.metadata,
  187. NCManageDatabase.shared.getCapabilitiesServerBool(account: metadata.account, elements: NCElementsJSON.shared.capabilitiesFileSharingPubPasswdEnforced, exists: false)
  188. else { return callback(nil) }
  189. let alertController = UIAlertController(title: NSLocalizedString("_enforce_password_protection_", comment: ""), message: "", preferredStyle: .alert)
  190. alertController.addTextField { textField in
  191. textField.isSecureTextEntry = true
  192. }
  193. alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .default) { _ in })
  194. let okAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default) { _ in
  195. let password = alertController.textFields?.first?.text
  196. callback(password)
  197. }
  198. alertController.addAction(okAction)
  199. self.present(alertController, animated: true, completion:nil)
  200. }
  201. @IBAction func touchUpInsideButtonMenu(_ sender: Any) {
  202. guard let metadata = self.metadata else { return }
  203. let shares = NCManageDatabase.shared.getTableShares(metadata: metadata)
  204. if shares.firstShareLink == nil {
  205. checkEnforcedPassword { password in
  206. self.networking?.createShareLink(password: password)
  207. }
  208. } else {
  209. tapMenu(with: shares.firstShareLink!, sender: sender)
  210. }
  211. }
  212. @objc func tapLinkMenuViewWindow(gesture: UITapGestureRecognizer) {
  213. shareLinkMenuView?.unLoad()
  214. shareLinkMenuView = nil
  215. shareUserMenuView?.unLoad()
  216. shareUserMenuView = nil
  217. }
  218. func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
  219. return gestureRecognizer.view == touch.view
  220. }
  221. // MARK: - NCShareNetworkingDelegate
  222. func readShareCompleted() {
  223. NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataNCShare)
  224. }
  225. func shareCompleted() {
  226. NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataNCShare)
  227. }
  228. func unShareCompleted() { }
  229. func updateShareWithError(idShare: Int) {
  230. self.reloadData()
  231. }
  232. func getSharees(sharees: [NCCommunicationSharee]?) {
  233. guard let sharees = sharees else { return }
  234. dropDown = DropDown()
  235. let appearance = DropDown.appearance()
  236. appearance.backgroundColor = NCBrandColor.shared.systemBackground
  237. appearance.cornerRadius = 10
  238. appearance.shadowColor = UIColor(white: 0.5, alpha: 1)
  239. appearance.shadowOpacity = 0.9
  240. appearance.shadowRadius = 25
  241. appearance.animationduration = 0.25
  242. appearance.textColor = .darkGray
  243. appearance.setupMaskedCorners([.layerMaxXMaxYCorner, .layerMinXMaxYCorner])
  244. for sharee in sharees {
  245. var label = sharee.label
  246. if sharee.shareType == NCShareCommon.shared.SHARE_TYPE_CIRCLE {
  247. label += " (" + sharee.circleInfo + ", " + sharee.circleOwner + ")"
  248. }
  249. dropDown.dataSource.append(label)
  250. }
  251. dropDown.anchorView = searchField
  252. dropDown.bottomOffset = CGPoint(x: 0, y: searchField.bounds.height)
  253. dropDown.width = searchField.bounds.width
  254. dropDown.direction = .bottom
  255. dropDown.cellNib = UINib(nibName: "NCShareUserDropDownCell", bundle: nil)
  256. dropDown.customCellConfiguration = { (index: Index, _: String, cell: DropDownCell) -> Void in
  257. guard let cell = cell as? NCShareUserDropDownCell else { return }
  258. let sharee = sharees[index]
  259. cell.imageItem.image = NCShareCommon.shared.getImageShareType(shareType: sharee.shareType)
  260. cell.imageShareeType.image = NCShareCommon.shared.getImageShareType(shareType: sharee.shareType)
  261. let status = NCUtility.shared.getUserStatus(userIcon: sharee.userIcon, userStatus: sharee.userStatus, userMessage: sharee.userMessage)
  262. cell.imageStatus.image = status.onlineStatus
  263. cell.status.text = status.statusMessage
  264. if cell.status.text?.count ?? 0 > 0 {
  265. cell.centerTitle.constant = -5
  266. } else {
  267. cell.centerTitle.constant = 0
  268. }
  269. cell.imageItem.image = NCUtility.shared.loadUserImage(
  270. for: sharee.shareWith,
  271. displayName: nil,
  272. userBaseUrl: self.appDelegate)
  273. let fileName = self.appDelegate.userBaseUrl + "-" + sharee.shareWith + ".png"
  274. if NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) == nil {
  275. let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
  276. let etag = NCManageDatabase.shared.getTableAvatar(fileName: fileName)?.etag
  277. NCCommunication.shared.downloadAvatar(user: sharee.shareWith, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: etag) { _, imageAvatar, _, etag, errorCode, _ in
  278. if errorCode == 0, let etag = etag, let imageAvatar = imageAvatar {
  279. NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag)
  280. cell.imageItem.image = imageAvatar
  281. } else if errorCode == NCGlobal.shared.errorNotModified, let imageAvatar = NCManageDatabase.shared.setAvatarLoaded(fileName: fileName) {
  282. cell.imageItem.image = imageAvatar
  283. }
  284. }
  285. }
  286. }
  287. dropDown.selectionAction = { (index, item) in
  288. let sharee = sharees[index]
  289. self.checkEnforcedPassword { password in
  290. self.networking?.createShare(shareWith: sharee.shareWith, shareType: sharee.shareType, password: password, metadata: self.metadata!)
  291. }
  292. }
  293. dropDown.show()
  294. }
  295. }
  296. // MARK: - UITableViewDelegate
  297. extension NCShare: UITableViewDelegate {
  298. func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  299. return 70
  300. }
  301. }
  302. // MARK: - UITableViewDataSource
  303. extension NCShare: UITableViewDataSource {
  304. func numberOfSections(in tableView: UITableView) -> Int {
  305. return 1
  306. }
  307. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  308. var numOfRows = 0
  309. let shares = NCManageDatabase.shared.getTableShares(metadata: metadata!)
  310. if shares.share != nil {
  311. numOfRows = shares.share!.count
  312. }
  313. return numOfRows
  314. }
  315. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  316. let shares = NCManageDatabase.shared.getTableShares(metadata: metadata!)
  317. let tableShare = shares.share![indexPath.row]
  318. // LINK
  319. if tableShare.shareType == 3 {
  320. if let cell = tableView.dequeueReusableCell(withIdentifier: "cellLink", for: indexPath) as? NCShareLinkCell {
  321. cell.tableShare = tableShare
  322. cell.delegate = self
  323. cell.labelTitle.text = NSLocalizedString("_share_link_", comment: "")
  324. if tableShare.label.count > 0 {
  325. cell.labelTitle.text = NSLocalizedString("_share_link_", comment: "") + " (" + tableShare.label + ")"
  326. }
  327. cell.labelTitle.textColor = NCBrandColor.shared.label
  328. return cell
  329. }
  330. } else {
  331. // USER
  332. if let cell = tableView.dequeueReusableCell(withIdentifier: "cellUser", for: indexPath) as? NCShareUserCell {
  333. cell.tableShare = tableShare
  334. cell.delegate = self
  335. cell.labelTitle.text = tableShare.shareWithDisplayname
  336. cell.labelTitle.textColor = NCBrandColor.shared.label
  337. cell.isUserInteractionEnabled = true
  338. cell.labelQuickStatus.isHidden = false
  339. cell.imageDownArrow.isHidden = false
  340. cell.buttonMenu.isHidden = false
  341. cell.imageItem.image = NCShareCommon.shared.getImageShareType(shareType: tableShare.shareType)
  342. let status = NCUtility.shared.getUserStatus(userIcon: tableShare.userIcon, userStatus: tableShare.userStatus, userMessage: tableShare.userMessage)
  343. cell.imageStatus.image = status.onlineStatus
  344. cell.status.text = status.statusMessage
  345. let fileName = appDelegate.userBaseUrl + "-" + tableShare.shareWith + ".png"
  346. NCOperationQueue.shared.downloadAvatar(user: tableShare.shareWith, dispalyName: tableShare.shareWithDisplayname, fileName: fileName, cell: cell, view: tableView)
  347. // If the initiator or the recipient is not the current user, show the list of sharees without any options to edit it.
  348. if tableShare.uidOwner != self.appDelegate.userId && tableShare.uidFileOwner != self.appDelegate.userId {
  349. cell.isUserInteractionEnabled = false
  350. cell.labelQuickStatus.isHidden = true
  351. cell.imageDownArrow.isHidden = true
  352. cell.buttonMenu.isHidden = true
  353. }
  354. cell.btnQuickStatus.setTitle("", for: .normal)
  355. cell.btnQuickStatus.contentHorizontalAlignment = .left
  356. if tableShare.permissions == NCGlobal.shared.permissionCreateShare {
  357. cell.labelQuickStatus.text = NSLocalizedString("_share_file_drop_", comment: "")
  358. } else {
  359. // Read Only
  360. if CCUtility.isAnyPermission(toEdit: tableShare.permissions) {
  361. cell.labelQuickStatus.text = NSLocalizedString("_share_editing_", comment: "")
  362. } else {
  363. cell.labelQuickStatus.text = NSLocalizedString("_share_read_only_", comment: "")
  364. }
  365. }
  366. return cell
  367. }
  368. }
  369. return UITableViewCell()
  370. }
  371. }
  372. // MARK: - NCCell Delegates
  373. extension NCShare: NCShareLinkCellDelegate, NCShareUserCellDelegate {
  374. func tapCopy(with tableShare: tableShare?, sender: Any) {
  375. if let link = tableShare?.url {
  376. NCShareCommon.shared.copyLink(link: link, viewController: self, sender: sender)
  377. }
  378. }
  379. func tapMenu(with tableShare: tableShare?, sender: Any) {
  380. guard let tableShare = tableShare else { return }
  381. if tableShare.shareType == 3 {
  382. let views = NCShareCommon.shared.openViewMenuShareLink(shareViewController: self, tableShare: tableShare, metadata: metadata!)
  383. shareLinkMenuView = views.shareLinkMenuView
  384. shareMenuViewWindow = views.viewWindow
  385. let tap = UITapGestureRecognizer(target: self, action: #selector(tapLinkMenuViewWindow))
  386. tap.delegate = self
  387. shareMenuViewWindow?.addGestureRecognizer(tap)
  388. } else {
  389. let views = NCShareCommon.shared.openViewMenuUser(shareViewController: self, tableShare: tableShare, metadata: metadata!)
  390. shareUserMenuView = views.shareUserMenuView
  391. shareMenuViewWindow = views.viewWindow
  392. let tap = UITapGestureRecognizer(target: self, action: #selector(tapLinkMenuViewWindow))
  393. tap.delegate = self
  394. shareMenuViewWindow?.addGestureRecognizer(tap)
  395. }
  396. }
  397. func showProfile(with tableShare: tableShare?, sender: Any) {
  398. guard let tableShare = tableShare else { return }
  399. showProfileMenu(userId: tableShare.shareWith)
  400. }
  401. func quickStatus(with tableShare: tableShare?, sender: Any) {
  402. guard let tableShare = tableShare else { return }
  403. if tableShare.shareType != NCGlobal.shared.permissionDefaultFileRemoteShareNoSupportShareOption {
  404. let quickStatusMenu = NCShareQuickStatusMenu()
  405. quickStatusMenu.toggleMenu(viewController: self, directory: metadata!.directory, tableShare: tableShare)
  406. }
  407. }
  408. }