NCViewerMedia.swift 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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. var downloadRequest: DownloadRequest?
  132. let hud = JGProgressHUD()
  133. hud.indicatorView = JGProgressHUDRingIndicatorView()
  134. hud.textLabel.text = NSLocalizedString("_downloading_", comment: "")
  135. hud.detailTextLabel.text = NSLocalizedString("_tap_to_cancel_", comment: "")
  136. if let indicatorView = hud.indicatorView as? JGProgressHUDRingIndicatorView { indicatorView.ringWidth = 1.5 }
  137. hud.tapOnHUDViewBlock = { _ in
  138. if let request = downloadRequest {
  139. request.cancel()
  140. }
  141. }
  142. if let view = self.appDelegate.window?.rootViewController?.view {
  143. hud.show(in: view)
  144. }
  145. NCNetworking.shared.download(metadata: self.metadata, selector: "", notificationCenterProgressTask: false) { request in
  146. downloadRequest = request
  147. } progressHandler: { progress in
  148. hud.progress = Float(progress.fractionCompleted)
  149. } completion: { afError, error in
  150. if error == .success {
  151. hud.dismiss()
  152. if CCUtility.fileProviderStorageExists(self.metadata) {
  153. let url = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(self.metadata.ocId, fileNameView: self.metadata.fileNameView))
  154. ncplayer.openAVPlayer(url: url, autoplay: autoplay)
  155. }
  156. } else {
  157. hud.indicatorView = JGProgressHUDErrorIndicatorView()
  158. hud.textLabel.text = error.errorDescription
  159. hud.dismiss(afterDelay: NCGlobal.shared.dismissAfterSecond)
  160. }
  161. }
  162. }
  163. }
  164. } else {
  165. var position: Float = 0
  166. if let result = NCManageDatabase.shared.getVideo(metadata: metadata), let resultPosition = result.position {
  167. position = resultPosition
  168. }
  169. ncplayer.restartAVPlayer(position: position, pauseAfterPlay: true)
  170. }
  171. }
  172. } else if metadata.isImage {
  173. DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
  174. self.showTip()
  175. }
  176. }
  177. NotificationCenter.default.addObserver(self, selector: #selector(openDetail(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterOpenMediaDetail), object: nil)
  178. }
  179. override func viewWillDisappear(_ animated: Bool) {
  180. super.viewWillDisappear(animated)
  181. self.tipView?.dismiss()
  182. }
  183. override func viewDidDisappear(_ animated: Bool) {
  184. super.viewDidDisappear(animated)
  185. if let ncplayer = ncplayer, ncplayer.isPlay() {
  186. ncplayer.playerPause()
  187. }
  188. }
  189. override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
  190. self.tipView?.dismiss()
  191. if metadata.isVideo {
  192. self.imageVideoContainer.isHidden = true
  193. }
  194. super.viewWillTransition(to: size, with: coordinator)
  195. coordinator.animate(alongsideTransition: { context in
  196. // back to the original size
  197. self.scrollView.zoom(to: CGRect(x: 0, y: 0, width: self.scrollView.bounds.width, height: self.scrollView.bounds.height), animated: false)
  198. self.view.layoutIfNeeded()
  199. UIView.animate(withDuration: context.transitionDuration) {
  200. if self.detailView.isShow() {
  201. self.openDetail()
  202. }
  203. }
  204. }, completion: { context in
  205. self.showTip()
  206. if self.metadata.isVideo {
  207. self.imageVideoContainer.isHidden = false
  208. }
  209. })
  210. }
  211. // MARK: - Tip
  212. func showTip() {
  213. if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCViewerMediaDetailView), let view = self.navigationController?.navigationBar {
  214. self.tipView?.show(forView: view)
  215. }
  216. }
  217. // MARK: - Image
  218. func loadImage() {
  219. guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) else { return }
  220. self.metadata = metadata
  221. // Download image
  222. if !CCUtility.fileProviderStorageExists(metadata) && metadata.isImage && metadata.session == "" {
  223. if metadata.livePhoto {
  224. let fileName = (metadata.fileNameView as NSString).deletingPathExtension + ".mov"
  225. if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", metadata.account, metadata.serverUrl, fileName)), !CCUtility.fileProviderStorageExists(metadata) {
  226. NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in }
  227. }
  228. }
  229. NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in
  230. let image = getImageMetadata(metadata)
  231. if self.metadata.ocId == metadata.ocId {
  232. self.image = image
  233. self.imageVideoContainer.image = image
  234. }
  235. }
  236. }
  237. // Get image
  238. let image = getImageMetadata(metadata)
  239. if self.metadata.ocId == metadata.ocId {
  240. self.image = image
  241. self.imageVideoContainer.image = image
  242. }
  243. func getImageMetadata(_ metadata: tableMetadata) -> UIImage? {
  244. if let image = getImage(metadata: metadata) {
  245. return image
  246. }
  247. if metadata.isVideo && !metadata.hasPreview {
  248. NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
  249. }
  250. if CCUtility.fileProviderStoragePreviewIconExists(metadata.ocId, etag: metadata.etag) {
  251. if let imagePreviewPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag) {
  252. return UIImage(contentsOfFile: imagePreviewPath)
  253. }
  254. }
  255. if metadata.isAudio {
  256. return UIImage(named: "noPreviewAudio")!.image(color: .gray, size: view.frame.width)
  257. } else if metadata.isImage {
  258. return UIImage(named: "noPreview")!.image(color: .gray, size: view.frame.width)
  259. } else {
  260. return nil
  261. }
  262. }
  263. func getImage(metadata: tableMetadata) -> UIImage? {
  264. let ext = CCUtility.getExtension(metadata.fileNameView)
  265. var image: UIImage?
  266. if CCUtility.fileProviderStorageExists(metadata) && metadata.isImage {
  267. let previewPath = CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)!
  268. let imagePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
  269. if ext == "GIF" {
  270. if !FileManager().fileExists(atPath: previewPath) {
  271. NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
  272. }
  273. image = UIImage.animatedImage(withAnimatedGIFURL: URL(fileURLWithPath: imagePath))
  274. } else if ext == "SVG" {
  275. if let svgImage = SVGKImage(contentsOfFile: imagePath) {
  276. svgImage.size = CGSize(width: NCGlobal.shared.sizePreview, height: NCGlobal.shared.sizePreview)
  277. if let image = svgImage.uiImage {
  278. if !FileManager().fileExists(atPath: previewPath) {
  279. do {
  280. try image.pngData()?.write(to: URL(fileURLWithPath: previewPath), options: .atomic)
  281. } catch { }
  282. }
  283. return image
  284. } else {
  285. return nil
  286. }
  287. } else {
  288. return nil
  289. }
  290. } else {
  291. NCUtility.shared.createImageFrom(fileNameView: metadata.fileNameView, ocId: metadata.ocId, etag: metadata.etag, classFile: metadata.classFile)
  292. image = UIImage(contentsOfFile: imagePath)
  293. }
  294. }
  295. return image
  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.isShow() 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 .began:
  332. // let velocity = gestureRecognizer.velocity(in: self.view)
  333. // gesture moving Up
  334. // if velocity.y < 0 {
  335. // }
  336. break
  337. case .ended:
  338. if detailView.isShow() {
  339. self.imageViewTopConstraint.constant = -imageViewConstraint
  340. self.imageViewBottomConstraint.constant = imageViewConstraint
  341. } else {
  342. self.imageViewTopConstraint.constant = 0
  343. self.imageViewBottomConstraint.constant = 0
  344. }
  345. case .changed:
  346. imageViewTopConstraint.constant = (currentLocation.y - imageViewConstraint)
  347. imageViewBottomConstraint.constant = -(currentLocation.y - imageViewConstraint)
  348. // DISMISS VIEW
  349. if detailView.isHidden && (currentLocation.y > 20) {
  350. viewerMediaPage?.navigationController?.popViewController(animated: true)
  351. gestureRecognizer.state = .ended
  352. }
  353. // CLOSE DETAIL
  354. if !detailView.isHidden && (currentLocation.y > 20) {
  355. self.closeDetail()
  356. gestureRecognizer.state = .ended
  357. }
  358. // OPEN DETAIL
  359. if detailView.isHidden && (currentLocation.y < -20) {
  360. self.openDetail()
  361. gestureRecognizer.state = .ended
  362. }
  363. default:
  364. break
  365. }
  366. }
  367. }
  368. // MARK: -
  369. extension NCViewerMedia {
  370. @objc func openDetail(_ notification: NSNotification) {
  371. if let userInfo = notification.userInfo as NSDictionary?, let ocId = userInfo["ocId"] as? String, ocId == metadata.ocId {
  372. openDetail()
  373. }
  374. }
  375. private func openDetail() {
  376. self.dismissTip()
  377. CCUtility.setExif(metadata) { latitude, longitude, location, date, lensModel in
  378. if latitude != -1 && latitude != 0 && longitude != -1 && longitude != 0 {
  379. self.detailViewHeighConstraint.constant = self.view.bounds.height / 2
  380. } else {
  381. self.detailViewHeighConstraint.constant = 170
  382. }
  383. self.view.layoutIfNeeded()
  384. self.detailView.show(
  385. metadata: self.metadata,
  386. image: self.image,
  387. textColor: self.viewerMediaPage?.textColor,
  388. mediaMetadata: (latitude: latitude, longitude: longitude, location: location, date: date, lensModel: lensModel),
  389. ncplayer: self.ncplayer,
  390. delegate: self)
  391. if let image = self.imageVideoContainer.image {
  392. let ratioW = self.imageVideoContainer.frame.width / image.size.width
  393. let ratioH = self.imageVideoContainer.frame.height / image.size.height
  394. let ratio = ratioW < ratioH ? ratioW : ratioH
  395. let imageHeight = image.size.height * ratio
  396. let VideoContainerHeight = self.imageVideoContainer.frame.height * ratio
  397. let height = max(imageHeight, VideoContainerHeight)
  398. self.imageViewConstraint = self.detailView.frame.height - ((self.view.frame.height - height) / 2) + self.view.safeAreaInsets.bottom
  399. if self.imageViewConstraint < 0 { self.imageViewConstraint = 0 }
  400. }
  401. UIView.animate(withDuration: 0.3) {
  402. self.imageViewTopConstraint.constant = -self.imageViewConstraint
  403. self.imageViewBottomConstraint.constant = self.imageViewConstraint
  404. self.detailViewTopConstraint.constant = self.detailViewHeighConstraint.constant
  405. self.view.layoutIfNeeded()
  406. } completion: { _ in
  407. }
  408. self.scrollView.pinchGestureRecognizer?.isEnabled = false
  409. }
  410. }
  411. private func closeDetail() {
  412. self.detailView.hide()
  413. imageViewConstraint = 0
  414. UIView.animate(withDuration: 0.3) {
  415. self.imageViewTopConstraint.constant = 0
  416. self.imageViewBottomConstraint.constant = 0
  417. self.detailViewTopConstraint.constant = 0
  418. self.view.layoutIfNeeded()
  419. } completion: { _ in
  420. }
  421. scrollView.pinchGestureRecognizer?.isEnabled = true
  422. }
  423. func reloadDetail() {
  424. if self.detailView.isShow() {
  425. CCUtility.setExif(metadata) { (latitude, longitude, location, date, lensModel) in
  426. self.detailView.show(
  427. metadata: self.metadata,
  428. image: self.image,
  429. textColor: self.viewerMediaPage?.textColor,
  430. mediaMetadata: (latitude: latitude, longitude: longitude, location: location, date: date, lensModel: lensModel),
  431. ncplayer: self.ncplayer,
  432. delegate: self)
  433. }
  434. }
  435. }
  436. }
  437. // MARK: -
  438. extension NCViewerMedia: UIScrollViewDelegate {
  439. func viewForZooming(in scrollView: UIScrollView) -> UIView? {
  440. return imageVideoContainer
  441. }
  442. func scrollViewDidZoom(_ scrollView: UIScrollView) {
  443. if scrollView.zoomScale > 1 {
  444. if let image = imageVideoContainer.image {
  445. let ratioW = imageVideoContainer.frame.width / image.size.width
  446. let ratioH = imageVideoContainer.frame.height / image.size.height
  447. let ratio = ratioW < ratioH ? ratioW : ratioH
  448. let newWidth = image.size.width * ratio
  449. let newHeight = image.size.height * ratio
  450. let conditionLeft = newWidth*scrollView.zoomScale > imageVideoContainer.frame.width
  451. let left = 0.5 * (conditionLeft ? newWidth - imageVideoContainer.frame.width : (scrollView.frame.width - scrollView.contentSize.width))
  452. let conditioTop = newHeight*scrollView.zoomScale > imageVideoContainer.frame.height
  453. let top = 0.5 * (conditioTop ? newHeight - imageVideoContainer.frame.height : (scrollView.frame.height - scrollView.contentSize.height))
  454. scrollView.contentInset = UIEdgeInsets(top: top, left: left, bottom: top, right: left)
  455. }
  456. } else {
  457. scrollView.contentInset = .zero
  458. }
  459. }
  460. func scrollViewDidScroll(_ scrollView: UIScrollView) {
  461. }
  462. }
  463. extension NCViewerMedia: NCViewerMediaDetailViewDelegate {
  464. func downloadFullResolution() {
  465. closeDetail()
  466. NCNetworking.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorOpenDetail) { _, _ in }
  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. }