NCViewerMedia.swift 23 KB

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