NCViewerMedia.swift 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  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. private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
  47. let utilityFileSystem = NCUtilityFileSystem()
  48. let utility = NCUtility()
  49. weak var viewerMediaPage: NCViewerMediaPage?
  50. var playerToolBar: NCPlayerToolBar?
  51. var ncplayer: NCPlayer?
  52. var image: UIImage?
  53. var metadata: tableMetadata = tableMetadata()
  54. var index: Int = 0
  55. var doubleTapGestureRecognizer: UITapGestureRecognizer = UITapGestureRecognizer()
  56. var imageViewConstraint: CGFloat = 0
  57. var isDetailViewInitializze: Bool = false
  58. weak var delegate: NCViewerMediaViewDelegate?
  59. private var allowOpeningDetails = true
  60. // MARK: - View Life Cycle
  61. required init?(coder aDecoder: NSCoder) {
  62. super.init(coder: aDecoder)
  63. doubleTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(didDoubleTapWith(gestureRecognizer:)))
  64. doubleTapGestureRecognizer.numberOfTapsRequired = 2
  65. }
  66. deinit {
  67. print("deinit NCViewerMedia")
  68. self.tipView?.dismiss()
  69. NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterOpenMediaDetail), object: nil)
  70. }
  71. override func viewDidLoad() {
  72. super.viewDidLoad()
  73. scrollView.delegate = self
  74. scrollView.maximumZoomScale = 4
  75. scrollView.minimumZoomScale = 1
  76. view.addGestureRecognizer(doubleTapGestureRecognizer)
  77. if NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) != nil {
  78. statusViewImage.image = utility.loadImage(named: "livephoto", color: .gray)
  79. statusLabel.text = "LIVE"
  80. } else {
  81. statusViewImage.image = nil
  82. statusLabel.text = ""
  83. }
  84. if metadata.isAudioOrVideo {
  85. playerToolBar = Bundle.main.loadNibNamed("NCPlayerToolBar", owner: self, options: nil)?.first as? NCPlayerToolBar
  86. if let playerToolBar = playerToolBar {
  87. view.addSubview(playerToolBar)
  88. playerToolBar.translatesAutoresizingMaskIntoConstraints = false
  89. playerToolBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor).isActive = true
  90. playerToolBar.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
  91. playerToolBar.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
  92. playerToolBar.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
  93. }
  94. self.ncplayer = NCPlayer(imageVideoContainer: self.imageVideoContainer, playerToolBar: self.playerToolBar, metadata: self.metadata, viewerMediaPage: self.viewerMediaPage)
  95. }
  96. // TIP
  97. var preferences = EasyTipView.Preferences()
  98. preferences.drawing.foregroundColor = .white
  99. preferences.drawing.backgroundColor = NCBrandColor.shared.nextcloud
  100. preferences.drawing.textAlignment = .left
  101. preferences.drawing.arrowPosition = .bottom
  102. preferences.drawing.cornerRadius = 10
  103. preferences.animating.dismissTransform = CGAffineTransform(translationX: 0, y: -15)
  104. preferences.animating.showInitialTransform = CGAffineTransform(translationX: 0, y: -15)
  105. preferences.animating.showInitialAlpha = 0
  106. preferences.animating.showDuration = 0.5
  107. preferences.animating.dismissDuration = 0
  108. tipView = EasyTipView(text: NSLocalizedString("_tip_open_mediadetail_", comment: ""), preferences: preferences, delegate: self)
  109. detailViewTopConstraint.constant = 0
  110. detailView.hide()
  111. self.image = nil
  112. self.imageVideoContainer.image = nil
  113. loadImage()
  114. }
  115. override func viewWillAppear(_ animated: Bool) {
  116. super.viewWillAppear(animated)
  117. viewerMediaPage?.navigationController?.navigationBar.prefersLargeTitles = false
  118. viewerMediaPage?.navigationItem.title = (metadata.fileNameView as NSString).deletingPathExtension
  119. if metadata.isImage, let viewerMediaPage = self.viewerMediaPage {
  120. if viewerMediaPage.modifiedOcId.contains(metadata.ocId) {
  121. viewerMediaPage.modifiedOcId.removeAll(where: { $0 == metadata.ocId })
  122. loadImage()
  123. }
  124. }
  125. }
  126. override func viewDidAppear(_ animated: Bool) {
  127. super.viewDidAppear(animated)
  128. // Set Last Opening Date
  129. NCManageDatabase.shared.setLastOpeningDate(metadata: metadata)
  130. viewerMediaPage?.clearCommandCenter()
  131. if metadata.isAudioOrVideo {
  132. if let ncplayer = self.ncplayer {
  133. if ncplayer.url == nil {
  134. NCActivityIndicator.shared.startActivity(backgroundView: self.view, style: .medium)
  135. NCNetworking.shared.getVideoUrl(metadata: metadata) { url, autoplay, error in
  136. NCActivityIndicator.shared.stop()
  137. if error == .success, let url = url {
  138. ncplayer.openAVPlayer(url: url, autoplay: autoplay)
  139. } else {
  140. guard let metadata = NCManageDatabase.shared.setMetadatasSessionInWaitDownload(metadatas: [self.metadata],
  141. session: NextcloudKit.shared.nkCommonInstance.sessionIdentifierDownload,
  142. selector: "") else { return }
  143. var downloadRequest: DownloadRequest?
  144. let hud = JGProgressHUD()
  145. hud.indicatorView = JGProgressHUDRingIndicatorView()
  146. hud.textLabel.text = NSLocalizedString("_downloading_", comment: "")
  147. hud.detailTextLabel.text = NSLocalizedString("_tap_to_cancel_", comment: "")
  148. if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView { indicatorView.ringWidth = 1.5 }
  149. hud.tapOnHUDViewBlock = { _ in
  150. if let request = downloadRequest {
  151. request.cancel()
  152. }
  153. }
  154. if let view = self.appDelegate.window?.rootViewController?.view {
  155. hud.show(in: view)
  156. }
  157. NCNetworking.shared.download(metadata: metadata, withNotificationProgressTask: false) {
  158. } requestHandler: { request in
  159. downloadRequest = request
  160. } progressHandler: { progress in
  161. hud.progress = Float(progress.fractionCompleted)
  162. } completion: { _, error in
  163. DispatchQueue.main.async {
  164. if error == .success {
  165. hud.dismiss()
  166. if self.utilityFileSystem.fileProviderStorageExists(self.metadata) {
  167. let url = URL(fileURLWithPath: self.utilityFileSystem.getDirectoryProviderStorageOcId(self.metadata.ocId, fileNameView: self.metadata.fileNameView))
  168. ncplayer.openAVPlayer(url: url, autoplay: autoplay)
  169. }
  170. } else {
  171. hud.indicatorView = JGProgressHUDErrorIndicatorView()
  172. hud.textLabel.text = error.errorDescription
  173. hud.dismiss(afterDelay: NCGlobal.shared.dismissAfterSecond)
  174. }
  175. }
  176. }
  177. }
  178. }
  179. } else {
  180. var position: Float = 0
  181. if let result = NCManageDatabase.shared.getVideo(metadata: metadata), let resultPosition = result.position {
  182. position = resultPosition
  183. }
  184. ncplayer.restartAVPlayer(position: position, pauseAfterPlay: true)
  185. }
  186. }
  187. } else if metadata.isImage {
  188. DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
  189. self.showTip()
  190. }
  191. }
  192. NotificationCenter.default.addObserver(self, selector: #selector(openDetail(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterOpenMediaDetail), object: nil)
  193. NotificationCenter.default.addObserver(self, selector: #selector(closeDetail(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDownloadStartFile), object: nil)
  194. }
  195. override func viewWillDisappear(_ animated: Bool) {
  196. super.viewWillDisappear(animated)
  197. self.tipView?.dismiss()
  198. }
  199. override func viewDidDisappear(_ animated: Bool) {
  200. super.viewDidDisappear(animated)
  201. if let ncplayer = ncplayer, ncplayer.isPlay() {
  202. ncplayer.playerPause()
  203. }
  204. }
  205. override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  206. super.viewWillTransition(to: size, with: coordinator)
  207. let wasShown = detailView.isShown
  208. if UIDevice.current.orientation.isValidInterfaceOrientation {
  209. if wasShown { closeDetail(animate: false) }
  210. self.tipView?.dismiss()
  211. if metadata.isVideo {
  212. self.imageVideoContainer.isHidden = true
  213. }
  214. coordinator.animate(alongsideTransition: { _ in
  215. // back to the original size
  216. self.scrollView.zoom(to: CGRect(x: 0, y: 0, width: self.scrollView.bounds.width, height: self.scrollView.bounds.height), animated: false)
  217. self.view.layoutIfNeeded()
  218. }, completion: { _ in
  219. if self.metadata.isVideo {
  220. self.imageVideoContainer.isHidden = false
  221. } else if self.metadata.isImage {
  222. self.showTip()
  223. }
  224. if wasShown {
  225. self.openDetail(animate: true)
  226. }
  227. })
  228. }
  229. }
  230. // MARK: - Tip
  231. func showTip() {
  232. if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCViewerMediaDetailView) {
  233. self.tipView?.show(forView: detailView)
  234. }
  235. }
  236. // MARK: - Image
  237. func loadImage() {
  238. guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) else { return }
  239. self.metadata = metadata
  240. if metadata.isLivePhoto,
  241. let metadata = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata),
  242. !utilityFileSystem.fileProviderStorageExists(metadata),
  243. let metadata = NCManageDatabase.shared.setMetadatasSessionInWaitDownload(metadatas: [metadata],
  244. session: NextcloudKit.shared.nkCommonInstance.sessionIdentifierDownload,
  245. selector: "") {
  246. NCNetworking.shared.download(metadata: metadata, withNotificationProgressTask: true)
  247. }
  248. if metadata.isImage, (metadata.fileExtension.lowercased() == "gif" || metadata.fileExtension.lowercased() == "svg"), !utilityFileSystem.fileProviderStorageExists(metadata) {
  249. downloadImage()
  250. }
  251. // Get image
  252. let image = getImageMetadata(metadata)
  253. if self.metadata.ocId == metadata.ocId {
  254. self.image = image
  255. self.imageVideoContainer.image = image
  256. }
  257. }
  258. func getImageMetadata(_ metadata: tableMetadata) -> UIImage? {
  259. if let image = utility.getImage(metadata: metadata) {
  260. return image
  261. }
  262. if metadata.isVideo && !metadata.hasPreview {
  263. utility.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
  264. }
  265. if utilityFileSystem.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) {
  266. return UIImage(contentsOfFile: utilityFileSystem.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag))
  267. }
  268. if metadata.isAudio {
  269. return UIImage(named: "noPreviewAudio")!.image(color: .gray, size: view.frame.width)
  270. } else if metadata.isImage {
  271. return UIImage(named: "noPreview")!.image(color: .gray, size: view.frame.width)
  272. } else {
  273. return nil
  274. }
  275. }
  276. func downloadImage(withSelector selector: String = "") {
  277. guard let metadata = NCManageDatabase.shared.setMetadatasSessionInWaitDownload(metadatas: [metadata],
  278. session: NextcloudKit.shared.nkCommonInstance.sessionIdentifierDownload,
  279. selector: selector) else { return }
  280. NCNetworking.shared.download(metadata: metadata, withNotificationProgressTask: true) {
  281. } requestHandler: { _ in
  282. self.allowOpeningDetails = false
  283. } completion: { _, _ in
  284. DispatchQueue.main.async {
  285. let image = self.getImageMetadata(self.metadata)
  286. self.image = image
  287. self.imageVideoContainer.image = image
  288. self.allowOpeningDetails = true
  289. }
  290. }
  291. }
  292. // MARK: - Live Photo
  293. func playLivePhoto(filePath: String) {
  294. updateViewConstraints()
  295. statusViewImage.isHidden = true
  296. statusLabel.isHidden = true
  297. player.media = VLCMedia(url: URL(fileURLWithPath: filePath))
  298. player.drawable = imageVideoContainer
  299. player.play()
  300. }
  301. func stopLivePhoto() {
  302. player.stop()
  303. statusViewImage.isHidden = false
  304. statusLabel.isHidden = false
  305. }
  306. // MARK: - Gesture
  307. @objc func didDoubleTapWith(gestureRecognizer: UITapGestureRecognizer) {
  308. guard metadata.isImage, !detailView.isShown else { return }
  309. let pointInView = gestureRecognizer.location(in: self.imageVideoContainer)
  310. var newZoomScale = self.scrollView.maximumZoomScale
  311. if self.scrollView.zoomScale >= newZoomScale || abs(self.scrollView.zoomScale - newZoomScale) <= 0.01 {
  312. newZoomScale = self.scrollView.minimumZoomScale
  313. }
  314. let width = self.scrollView.bounds.width / newZoomScale
  315. let height = self.scrollView.bounds.height / newZoomScale
  316. let originX = pointInView.x - (width / 2.0)
  317. let originY = pointInView.y - (height / 2.0)
  318. let rectToZoomTo = CGRect(x: originX, y: originY, width: width, height: height)
  319. self.scrollView.zoom(to: rectToZoomTo, animated: true)
  320. }
  321. @objc func didPanWith(gestureRecognizer: UIPanGestureRecognizer) {
  322. guard metadata.isImage else { return }
  323. let currentLocation = gestureRecognizer.translation(in: self.view)
  324. switch gestureRecognizer.state {
  325. case .ended:
  326. if detailView.isShown {
  327. self.imageViewTopConstraint.constant = -imageViewConstraint
  328. self.imageViewBottomConstraint.constant = imageViewConstraint
  329. } else {
  330. self.imageViewTopConstraint.constant = 0
  331. self.imageViewBottomConstraint.constant = 0
  332. }
  333. case .changed:
  334. imageViewTopConstraint.constant = (currentLocation.y - imageViewConstraint)
  335. imageViewBottomConstraint.constant = -(currentLocation.y - imageViewConstraint)
  336. // DISMISS VIEW
  337. if detailView.isHidden && (currentLocation.y > 20) {
  338. viewerMediaPage?.navigationController?.popViewController(animated: true)
  339. gestureRecognizer.state = .ended
  340. }
  341. // CLOSE DETAIL
  342. if !detailView.isHidden && (currentLocation.y > 20) {
  343. self.closeDetail()
  344. gestureRecognizer.state = .ended
  345. }
  346. // OPEN DETAIL
  347. if detailView.isHidden && (currentLocation.y < -20) {
  348. self.openDetail()
  349. gestureRecognizer.state = .ended
  350. }
  351. default:
  352. break
  353. }
  354. }
  355. }
  356. extension NCViewerMedia {
  357. @objc func openDetail(_ notification: NSNotification) {
  358. if let userInfo = notification.userInfo as NSDictionary?, let ocId = userInfo["ocId"] as? String, ocId == metadata.ocId {
  359. allowOpeningDetails = true
  360. openDetail()
  361. }
  362. }
  363. @objc func closeDetail(_ notification: NSNotification) {
  364. DispatchQueue.main.async {
  365. self.closeDetail()
  366. }
  367. }
  368. func toggleDetail () {
  369. detailView.isShown ? closeDetail() : openDetail()
  370. }
  371. private func openDetail(animate: Bool = true) {
  372. if !allowOpeningDetails { return }
  373. delegate?.didOpenDetail()
  374. self.dismissTip()
  375. UIView.animate(withDuration: 0.3) {
  376. self.scrollView.setZoomScale(1.0, animated: false)
  377. self.statusLabel.isHidden = true
  378. self.statusViewImage.isHidden = true
  379. }
  380. self.utility.getExif(metadata: self.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. var 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. self.imageViewConstraint = min(self.imageViewConstraint, self.detailView.frame.height + 30)
  393. imageContainerHeight = self.imageViewConstraint.truncatingRemainder(dividingBy: 1000)
  394. }
  395. UIView.animate(withDuration: animate ? 0.3 : 0) {
  396. self.imageViewTopConstraint.constant = -self.imageViewConstraint
  397. self.imageViewBottomConstraint.constant = self.imageViewConstraint
  398. self.detailViewTopConstraint.constant = self.detailView.frame.height
  399. self.view.layoutIfNeeded()
  400. }
  401. self.scrollView.pinchGestureRecognizer?.isEnabled = false
  402. }
  403. }
  404. func closeDetail(animate: Bool = true) {
  405. delegate?.didCloseDetail()
  406. self.detailView.hide()
  407. imageViewConstraint = 0
  408. statusLabel.isHidden = false
  409. statusViewImage.isHidden = false
  410. UIView.animate(withDuration: animate ? 0.3 : 0) {
  411. self.imageViewTopConstraint.constant = 0
  412. self.imageViewBottomConstraint.constant = 0
  413. self.detailViewTopConstraint.constant = 0
  414. self.view.layoutIfNeeded()
  415. }
  416. scrollView.pinchGestureRecognizer?.isEnabled = true
  417. }
  418. private func showDetailView(exif: ExifData) {
  419. self.detailView.show(
  420. metadata: self.metadata,
  421. image: self.image,
  422. textColor: self.viewerMediaPage?.textColor,
  423. exif: exif,
  424. ncplayer: self.ncplayer,
  425. delegate: self)
  426. }
  427. func reloadDetail() {
  428. if self.detailView.isShown {
  429. utility.getExif(metadata: metadata) { exif in
  430. self.showDetailView(exif: exif)
  431. }
  432. }
  433. }
  434. }
  435. extension NCViewerMedia: UIScrollViewDelegate {
  436. func viewForZooming(in scrollView: UIScrollView) -> UIView? {
  437. return imageVideoContainer
  438. }
  439. func scrollViewDidZoom(_ scrollView: UIScrollView) {
  440. if scrollView.zoomScale > 1 {
  441. if let image = imageVideoContainer.image {
  442. let ratioW = imageVideoContainer.frame.width / image.size.width
  443. let ratioH = imageVideoContainer.frame.height / image.size.height
  444. let ratio = ratioW < ratioH ? ratioW : ratioH
  445. let newWidth = image.size.width * ratio
  446. let newHeight = image.size.height * ratio
  447. let conditionLeft = newWidth * scrollView.zoomScale > imageVideoContainer.frame.width
  448. let left = 0.5 * (conditionLeft ? newWidth - imageVideoContainer.frame.width : (scrollView.frame.width - scrollView.contentSize.width))
  449. let conditioTop = newHeight * scrollView.zoomScale > imageVideoContainer.frame.height
  450. let top = 0.5 * (conditioTop ? newHeight - imageVideoContainer.frame.height : (scrollView.frame.height - scrollView.contentSize.height))
  451. scrollView.contentInset = UIEdgeInsets(top: top, left: left, bottom: top, right: left)
  452. }
  453. } else {
  454. scrollView.contentInset = .zero
  455. }
  456. }
  457. }
  458. extension NCViewerMedia: NCViewerMediaDetailViewDelegate {
  459. func downloadFullResolution() {
  460. downloadImage(withSelector: NCGlobal.shared.selectorOpenDetail)
  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. }