NCViewerMedia.swift 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. //
  2. // NCViewerMedia.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 24/10/2020.
  6. // Copyright © 2020 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. import UIKit
  24. import SVGKit
  25. import NextcloudKit
  26. import EasyTipView
  27. import SwiftUI
  28. import MobileVLCKit
  29. import JGProgressHUD
  30. import Alamofire
  31. public protocol NCViewerMediaViewDelegate: AnyObject {
  32. func didOpenDetail()
  33. func didCloseDetail()
  34. }
  35. class NCViewerMedia: UIViewController {
  36. @IBOutlet weak var detailViewTopConstraint: NSLayoutConstraint!
  37. @IBOutlet weak var imageViewTopConstraint: NSLayoutConstraint!
  38. @IBOutlet weak var imageViewBottomConstraint: NSLayoutConstraint!
  39. @IBOutlet weak var scrollView: UIScrollView!
  40. @IBOutlet weak var imageVideoContainer: UIImageView!
  41. @IBOutlet weak var statusViewImage: UIImageView!
  42. @IBOutlet weak var statusLabel: UILabel!
  43. @IBOutlet weak var detailView: NCViewerMediaDetailView!
  44. private var tipView: EasyTipView?
  45. private let player = VLCMediaPlayer()
  46. let appDelegate = UIApplication.shared.delegate as! AppDelegate
  47. weak var viewerMediaPage: NCViewerMediaPage?
  48. var playerToolBar: NCPlayerToolBar?
  49. var ncplayer: NCPlayer?
  50. var image: UIImage?
  51. var metadata: tableMetadata = tableMetadata()
  52. var index: Int = 0
  53. var doubleTapGestureRecognizer: UITapGestureRecognizer = UITapGestureRecognizer()
  54. var imageViewConstraint: CGFloat = 0
  55. var isDetailViewInitializze: Bool = false
  56. weak var delegate: NCViewerMediaViewDelegate?
  57. // MARK: - View Life Cycle
  58. required init?(coder aDecoder: NSCoder) {
  59. super.init(coder: aDecoder)
  60. doubleTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(didDoubleTapWith(gestureRecognizer:)))
  61. doubleTapGestureRecognizer.numberOfTapsRequired = 2
  62. }
  63. deinit {
  64. print("deinit NCViewerMedia")
  65. self.tipView?.dismiss()
  66. NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterOpenMediaDetail), object: nil)
  67. }
  68. override func viewDidLoad() {
  69. super.viewDidLoad()
  70. scrollView.delegate = self
  71. scrollView.maximumZoomScale = 4
  72. scrollView.minimumZoomScale = 1
  73. view.addGestureRecognizer(doubleTapGestureRecognizer)
  74. if NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) != nil {
  75. statusViewImage.image = NCUtility.shared.loadImage(named: "livephoto", color: .gray)
  76. statusLabel.text = "LIVE"
  77. } else {
  78. statusViewImage.image = nil
  79. statusLabel.text = ""
  80. }
  81. if metadata.isAudioOrVideo {
  82. playerToolBar = Bundle.main.loadNibNamed("NCPlayerToolBar", owner: self, options: nil)?.first as? NCPlayerToolBar
  83. if let playerToolBar = playerToolBar {
  84. view.addSubview(playerToolBar)
  85. playerToolBar.translatesAutoresizingMaskIntoConstraints = false
  86. playerToolBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true
  87. playerToolBar.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
  88. playerToolBar.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
  89. playerToolBar.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
  90. }
  91. self.ncplayer = NCPlayer(imageVideoContainer: self.imageVideoContainer, playerToolBar: self.playerToolBar, metadata: self.metadata, viewerMediaPage: self.viewerMediaPage)
  92. }
  93. // TIP
  94. var preferences = EasyTipView.Preferences()
  95. preferences.drawing.foregroundColor = .white
  96. preferences.drawing.backgroundColor = NCBrandColor.shared.nextcloud
  97. preferences.drawing.textAlignment = .left
  98. preferences.drawing.arrowPosition = .bottom
  99. preferences.drawing.cornerRadius = 10
  100. preferences.animating.dismissTransform = CGAffineTransform(translationX: 0, y: -15)
  101. preferences.animating.showInitialTransform = CGAffineTransform(translationX: 0, y: -15)
  102. preferences.animating.showInitialAlpha = 0
  103. preferences.animating.showDuration = 0.5
  104. preferences.animating.dismissDuration = 0
  105. tipView = EasyTipView(text: NSLocalizedString("_tip_open_mediadetail_", comment: ""), preferences: preferences, delegate: self)
  106. detailViewTopConstraint.constant = 0
  107. detailView.hide()
  108. self.image = nil
  109. self.imageVideoContainer.image = nil
  110. loadImage()
  111. }
  112. override func viewWillAppear(_ animated: Bool) {
  113. super.viewWillAppear(animated)
  114. viewerMediaPage?.navigationController?.navigationBar.prefersLargeTitles = false
  115. viewerMediaPage?.navigationItem.title = (metadata.fileNameView as NSString).deletingPathExtension
  116. if metadata.isImage, let viewerMediaPage = self.viewerMediaPage {
  117. if viewerMediaPage.modifiedOcId.contains(metadata.ocId) {
  118. viewerMediaPage.modifiedOcId.removeAll(where: { $0 == metadata.ocId })
  119. loadImage()
  120. }
  121. }
  122. }
  123. override func viewDidAppear(_ animated: Bool) {
  124. super.viewDidAppear(animated)
  125. viewerMediaPage?.clearCommandCenter()
  126. if metadata.isAudioOrVideo {
  127. if let ncplayer = self.ncplayer {
  128. if ncplayer.url == nil {
  129. NCActivityIndicator.shared.startActivity(backgroundView: self.view, style: .medium)
  130. NCNetworking.shared.getVideoUrl(metadata: metadata) { url, autoplay, error in
  131. NCActivityIndicator.shared.stop()
  132. if error == .success, let url = url {
  133. ncplayer.openAVPlayer(url: url, autoplay: autoplay)
  134. } else {
  135. var downloadRequest: DownloadRequest?
  136. let hud = JGProgressHUD()
  137. hud.indicatorView = JGProgressHUDRingIndicatorView()
  138. hud.textLabel.text = NSLocalizedString("_downloading_", comment: "")
  139. hud.detailTextLabel.text = NSLocalizedString("_tap_to_cancel_", comment: "")
  140. if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView { indicatorView.ringWidth = 1.5 }
  141. hud.tapOnHUDViewBlock = { _ in
  142. if let request = downloadRequest {
  143. request.cancel()
  144. }
  145. }
  146. if let view = self.appDelegate.window?.rootViewController?.view {
  147. hud.show(in: view)
  148. }
  149. NCNetworking.shared.download(metadata: self.metadata, selector: "", notificationCenterProgressTask: false) { request in
  150. downloadRequest = request
  151. } progressHandler: { progress in
  152. hud.progress = Float(progress.fractionCompleted)
  153. } completion: { afError, error in
  154. if error == .success {
  155. hud.dismiss()
  156. if CCUtility.fileProviderStorageExists(self.metadata) {
  157. let url = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(self.metadata.ocId, fileNameView: self.metadata.fileNameView))
  158. ncplayer.openAVPlayer(url: url, autoplay: autoplay)
  159. }
  160. } else {
  161. hud.indicatorView = JGProgressHUDErrorIndicatorView()
  162. hud.textLabel.text = error.errorDescription
  163. hud.dismiss(afterDelay: NCGlobal.shared.dismissAfterSecond)
  164. }
  165. }
  166. }
  167. }
  168. } else {
  169. var position: Float = 0
  170. if let result = NCManageDatabase.shared.getVideo(metadata: metadata), let resultPosition = result.position {
  171. position = resultPosition
  172. }
  173. ncplayer.restartAVPlayer(position: position, pauseAfterPlay: true)
  174. }
  175. }
  176. } else if metadata.isImage {
  177. DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
  178. self.showTip()
  179. }
  180. }
  181. NotificationCenter.default.addObserver(self, selector: #selector(openDetail(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterOpenMediaDetail), object: nil)
  182. NotificationCenter.default.addObserver(self, selector: #selector(closeDetail(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDownloadStartFile), object: nil)
  183. }
  184. override func viewWillDisappear(_ animated: Bool) {
  185. super.viewWillDisappear(animated)
  186. self.tipView?.dismiss()
  187. }
  188. override func viewDidDisappear(_ animated: Bool) {
  189. super.viewDidDisappear(animated)
  190. if let ncplayer = ncplayer, ncplayer.isPlay() {
  191. ncplayer.playerPause()
  192. }
  193. }
  194. override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  195. if UIDevice.current.orientation.isValidInterfaceOrientation {
  196. closeDetail()
  197. }
  198. self.tipView?.dismiss()
  199. if metadata.isVideo {
  200. self.imageVideoContainer.isHidden = true
  201. }
  202. super.viewWillTransition(to: size, with: coordinator)
  203. coordinator.animate(alongsideTransition: { context in
  204. // back to the original size
  205. self.scrollView.zoom(to: CGRect(x: 0, y: 0, width: self.scrollView.bounds.width, height: self.scrollView.bounds.height), animated: false)
  206. self.view.layoutIfNeeded()
  207. UIView.animate(withDuration: context.transitionDuration) {
  208. if self.detailView.isShown {
  209. self.openDetail()
  210. }
  211. }
  212. }, completion: { context in
  213. self.showTip()
  214. if self.metadata.isVideo {
  215. self.imageVideoContainer.isHidden = false
  216. }
  217. })
  218. }
  219. // MARK: - Tip
  220. func showTip() {
  221. if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCViewerMediaDetailView) {
  222. self.tipView?.show(forView: detailView)
  223. }
  224. }
  225. // MARK: - Image
  226. func loadImage() {
  227. guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) else { return }
  228. self.metadata = metadata
  229. // Download image
  230. if !CCUtility.fileProviderStorageExists(metadata) && metadata.isImage && metadata.session == "" {
  231. if metadata.livePhoto {
  232. let fileName = (metadata.fileNameView as NSString).deletingPathExtension + ".mov"
  233. if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", metadata.account, metadata.serverUrl, fileName)), !CCUtility.fileProviderStorageExists(metadata) {
  234. NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in }
  235. }
  236. }
  237. }
  238. // Get image
  239. let image = getImageMetadata(metadata)
  240. if self.metadata.ocId == metadata.ocId {
  241. self.image = image
  242. self.imageVideoContainer.image = image
  243. }
  244. func getImageMetadata(_ metadata: tableMetadata) -> UIImage? {
  245. if let image = getImage(metadata: metadata) {
  246. return image
  247. }
  248. if metadata.isVideo && !metadata.hasPreview {
  249. NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
  250. }
  251. if CCUtility.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) {
  252. if let imagePreviewPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag) {
  253. return UIImage(contentsOfFile: imagePreviewPath)
  254. }
  255. }
  256. if metadata.isAudio {
  257. return UIImage(named: "noPreviewAudio")!.image(color: .gray, size: view.frame.width)
  258. } else if metadata.isImage {
  259. return UIImage(named: "noPreview")!.image(color: .gray, size: view.frame.width)
  260. } else {
  261. return nil
  262. }
  263. }
  264. func getImage(metadata: tableMetadata) -> UIImage? {
  265. let ext = CCUtility.getExtension(metadata.fileNameView)
  266. var image: UIImage?
  267. if CCUtility.fileProviderStorageExists(metadata) && metadata.isImage {
  268. let previewPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)!
  269. let imagePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
  270. if ext == "GIF" {
  271. if !FileManager().fileExists(atPath: previewPath) {
  272. NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
  273. }
  274. image = UIImage.animatedImage(withAnimatedGIFURL: URL(fileURLWithPath: imagePath))
  275. } else if ext == "SVG" {
  276. if let svgImage = SVGKImage(contentsOfFile: imagePath) {
  277. svgImage.size = CGSize(width: NCGlobal.shared.sizePreview, height: NCGlobal.shared.sizePreview)
  278. if let image = svgImage.uiImage {
  279. if !FileManager().fileExists(atPath: previewPath) {
  280. do {
  281. try image.pngData()?.write(to: URL(fileURLWithPath: previewPath), options: .atomic)
  282. } catch { }
  283. }
  284. return image
  285. } else {
  286. return nil
  287. }
  288. } else {
  289. return nil
  290. }
  291. } else {
  292. NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
  293. image = UIImage(contentsOfFile: imagePath)
  294. }
  295. }
  296. return image
  297. }
  298. }
  299. // MARK: - Live Photo
  300. func playLivePhoto(filePath: String) {
  301. updateViewConstraints()
  302. statusViewImage.isHidden = true
  303. statusLabel.isHidden = true
  304. player.media = VLCMedia(url: URL(fileURLWithPath: filePath))
  305. player.drawable = imageVideoContainer
  306. player.play()
  307. }
  308. func stopLivePhoto() {
  309. player.stop()
  310. statusViewImage.isHidden = false
  311. statusLabel.isHidden = false
  312. }
  313. // MARK: - Gesture
  314. @objc func didDoubleTapWith(gestureRecognizer: UITapGestureRecognizer) {
  315. guard metadata.isImage, !detailView.isShown else { return }
  316. let pointInView = gestureRecognizer.location(in: self.imageVideoContainer)
  317. var newZoomScale = self.scrollView.maximumZoomScale
  318. if self.scrollView.zoomScale >= newZoomScale || abs(self.scrollView.zoomScale - newZoomScale) <= 0.01 {
  319. newZoomScale = self.scrollView.minimumZoomScale
  320. }
  321. let width = self.scrollView.bounds.width / newZoomScale
  322. let height = self.scrollView.bounds.height / newZoomScale
  323. let originX = pointInView.x - (width / 2.0)
  324. let originY = pointInView.y - (height / 2.0)
  325. let rectToZoomTo = CGRect(x: originX, y: originY, width: width, height: height)
  326. self.scrollView.zoom(to: rectToZoomTo, animated: true)
  327. }
  328. @objc func didPanWith(gestureRecognizer: UIPanGestureRecognizer) {
  329. guard metadata.isImage else { return }
  330. let currentLocation = gestureRecognizer.translation(in: self.view)
  331. switch gestureRecognizer.state {
  332. case .ended:
  333. if detailView.isShown {
  334. self.imageViewTopConstraint.constant = -imageViewConstraint
  335. self.imageViewBottomConstraint.constant = imageViewConstraint
  336. } else {
  337. self.imageViewTopConstraint.constant = 0
  338. self.imageViewBottomConstraint.constant = 0
  339. }
  340. case .changed:
  341. imageViewTopConstraint.constant = (currentLocation.y - imageViewConstraint)
  342. imageViewBottomConstraint.constant = -(currentLocation.y - imageViewConstraint)
  343. // DISMISS VIEW
  344. if detailView.isHidden && (currentLocation.y > 20) {
  345. viewerMediaPage?.navigationController?.popViewController(animated: true)
  346. gestureRecognizer.state = .ended
  347. }
  348. // CLOSE DETAIL
  349. if !detailView.isHidden && (currentLocation.y > 20) {
  350. self.closeDetail()
  351. gestureRecognizer.state = .ended
  352. }
  353. // OPEN DETAIL
  354. if detailView.isHidden && (currentLocation.y < -20) {
  355. self.openDetail()
  356. gestureRecognizer.state = .ended
  357. }
  358. default:
  359. break
  360. }
  361. }
  362. }
  363. extension NCViewerMedia {
  364. @objc func openDetail(_ notification: NSNotification) {
  365. if let userInfo = notification.userInfo as NSDictionary?, let ocId = userInfo["ocId"] as? String, ocId == metadata.ocId {
  366. openDetail()
  367. }
  368. }
  369. @objc func closeDetail(_ notification: NSNotification) {
  370. closeDetail()
  371. }
  372. func toggleDetail () {
  373. detailView.isShown ? closeDetail() : openDetail()
  374. }
  375. private func openDetail() {
  376. delegate?.didOpenDetail()
  377. self.dismissTip()
  378. statusLabel.isHidden = true
  379. statusViewImage.isHidden = true
  380. NCUtility.shared.getExif(metadata: metadata) { exif in
  381. self.view.layoutIfNeeded()
  382. self.showDetailView(exif: exif)
  383. if let image = self.imageVideoContainer.image {
  384. let ratioW = self.imageVideoContainer.frame.width / image.size.width
  385. let ratioH = self.imageVideoContainer.frame.height / image.size.height
  386. let ratio = min(ratioW, ratioH)
  387. let imageHeight = image.size.height * ratio
  388. let imageContainerHeight = self.imageVideoContainer.frame.height * ratio
  389. let height = max(imageHeight, imageContainerHeight)
  390. self.imageViewConstraint = self.detailView.frame.height - ((self.view.frame.height - height) / 2) + self.view.safeAreaInsets.bottom
  391. if self.imageViewConstraint < 0 { self.imageViewConstraint = 0 }
  392. }
  393. UIView.animate(withDuration: 0.3) {
  394. self.imageViewTopConstraint.constant = -self.imageViewConstraint
  395. self.imageViewBottomConstraint.constant = self.imageViewConstraint
  396. self.detailViewTopConstraint.constant = self.detailView.frame.height
  397. self.view.layoutIfNeeded()
  398. }
  399. self.scrollView.pinchGestureRecognizer?.isEnabled = false
  400. }
  401. }
  402. private func closeDetail() {
  403. delegate?.didCloseDetail()
  404. self.detailView.hide()
  405. imageViewConstraint = 0
  406. statusLabel.isHidden = false
  407. statusViewImage.isHidden = false
  408. UIView.animate(withDuration: 0.3) {
  409. self.imageViewTopConstraint.constant = 0
  410. self.imageViewBottomConstraint.constant = 0
  411. self.detailViewTopConstraint.constant = 0
  412. self.view.layoutIfNeeded()
  413. }
  414. scrollView.pinchGestureRecognizer?.isEnabled = true
  415. }
  416. private func showDetailView(exif: ExifData) {
  417. self.detailView.show(
  418. metadata: self.metadata,
  419. image: self.image,
  420. textColor: self.viewerMediaPage?.textColor,
  421. exif: exif,
  422. ncplayer: self.ncplayer,
  423. delegate: self)
  424. }
  425. func reloadDetail() {
  426. if self.detailView.isShown {
  427. NCUtility.shared.getExif(metadata: metadata) { exif in
  428. self.showDetailView(exif: exif)
  429. }
  430. }
  431. }
  432. }
  433. extension NCViewerMedia: UIScrollViewDelegate {
  434. func viewForZooming(in scrollView: UIScrollView) -> UIView? {
  435. return imageVideoContainer
  436. }
  437. func scrollViewDidZoom(_ scrollView: UIScrollView) {
  438. if scrollView.zoomScale > 1 {
  439. if let image = imageVideoContainer.image {
  440. let ratioW = imageVideoContainer.frame.width / image.size.width
  441. let ratioH = imageVideoContainer.frame.height / image.size.height
  442. let ratio = ratioW < ratioH ? ratioW : ratioH
  443. let newWidth = image.size.width * ratio
  444. let newHeight = image.size.height * ratio
  445. let conditionLeft = newWidth * scrollView.zoomScale > imageVideoContainer.frame.width
  446. let left = 0.5 * (conditionLeft ? newWidth - imageVideoContainer.frame.width : (scrollView.frame.width - scrollView.contentSize.width))
  447. let conditioTop = newHeight * scrollView.zoomScale > imageVideoContainer.frame.height
  448. let top = 0.5 * (conditioTop ? newHeight - imageVideoContainer.frame.height : (scrollView.frame.height - scrollView.contentSize.height))
  449. scrollView.contentInset = UIEdgeInsets(top: top, left: left, bottom: top, right: left)
  450. }
  451. } else {
  452. scrollView.contentInset = .zero
  453. }
  454. }
  455. func scrollViewDidScroll(_ scrollView: UIScrollView) {
  456. }
  457. }
  458. extension NCViewerMedia: NCViewerMediaDetailViewDelegate {
  459. func downloadFullResolution() {
  460. NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorOpenDetail) { _, _ in }
  461. }
  462. }
  463. extension NCViewerMedia: EasyTipViewDelegate {
  464. // TIP
  465. func easyTipViewDidTap(_ tipView: EasyTipView) {
  466. NCManageDatabase.shared.addTip(NCGlobal.shared.tipNCViewerMediaDetailView)
  467. }
  468. func easyTipViewDidDismiss(_ tipView: EasyTipView) { }
  469. func dismissTip() {
  470. NCManageDatabase.shared.addTip(NCGlobal.shared.tipNCViewerMediaDetailView)
  471. self.tipView?.dismiss()
  472. }
  473. }