NCViewerMedia.swift 23 KB

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