marinofaggiana 3 years ago
parent
commit
64d5c5b3bf

+ 10 - 17
iOSClient/Viewer/NCViewerImage/NCViewerImage.swift

@@ -515,17 +515,10 @@ extension NCViewerImage: UIGestureRecognizerDelegate {
     
     @objc func didSingleTapWith(gestureRecognizer: UITapGestureRecognizer) {
              
-        if currentViewerImageZoom?.detailView.isShow() ?? false {
-            
-            UIView.animate(withDuration: 0.2) {
-//                self.currentViewerImageZoom?.updateConstraints()
-                // VideoToolBar
-                if self.currentMetadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue || self.currentMetadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue {
-                    self.viewerVideo?.viewerVideoToolBar?.showToolBar()
-                }
-            }
-            return
-        }
+//        if currentViewerImageZoom?.detailView.isShow() ?? false {
+//            self.viewerVideo?.viewerVideoToolBar?.showToolBar(metadata: self.currentMetadata)
+//            return
+//        }
         
         /*
         if currentMetadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || currentMetadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue {
@@ -550,11 +543,11 @@ extension NCViewerImage: UIGestureRecognizerDelegate {
         }
         */
         
-        if currentMetadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || currentMetadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue {
-            let wasHidden = viewerVideo?.viewerVideoToolBar?.isHidden
-            viewerVideo?.viewerVideoToolBar?.showToolBar()
-            if wasHidden ?? false { return }
-        }
+//        if currentMetadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || currentMetadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue {
+//            let wasHidden = viewerVideo?.viewerVideoToolBar?.isHidden
+//            viewerVideo?.viewerVideoToolBar?.showToolBar(metadata: currentMetadata)
+//            if wasHidden ?? false { return }
+//        }
         
         if currentMode == .full {
             
@@ -608,7 +601,7 @@ extension NCViewerImage: NCViewerImageZoomDelegate {
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
                 self.viewerVideo?.videoPlay(metadata: metadata)
             }
-            viewerImageZoom.videoToolBar.showToolBar()
+//            viewerImageZoom.videoToolBar.showToolBar(metadata: currentMetadata)
         }
             
         if !NCOperationQueue.shared.downloadExists(metadata: metadata) {

+ 1 - 1
iOSClient/Viewer/NCViewerVideo/NCViewerVideo.swift

@@ -84,7 +84,7 @@ class NCViewerVideo: NSObject {
                         if metadata.livePhoto {
                             NCManageDatabase.shared.deleteVideoTime(metadata: metadata)
                         }
-                        self.viewerVideoToolBar?.showToolBar()
+                        self.viewerVideoToolBar?.showToolBar(metadata: metadata)
                     }
                 }
                             

+ 11 - 5
iOSClient/Viewer/NCViewerVideo/NCViewerVideoToolBar.swift

@@ -22,6 +22,7 @@
 //
 
 import Foundation
+import NCCommunication
 
 class NCViewerVideoToolBar: UIView {
     
@@ -113,7 +114,6 @@ class NCViewerVideoToolBar: UIView {
         if playbackSliderEvent == .began || playbackSliderEvent == .moved {
             timerAutoHide?.invalidate()
             timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(autoHideToolBar), userInfo: nil, repeats: true)
-
             return
         }
         if self.player?.rate == 1 {
@@ -121,11 +121,17 @@ class NCViewerVideoToolBar: UIView {
         }
     }
     
-    @objc public func showToolBar() {
-        updateOutlet()
-        self.isHidden = false
+    @objc public func showToolBar(metadata: tableMetadata) {
+
         timerAutoHide?.invalidate()
-        timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(autoHideToolBar), userInfo: nil, repeats: true)
+
+        if !metadata.livePhoto && (metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue) {
+            updateOutlet()
+            timerAutoHide = Timer.scheduledTimer(timeInterval: 5, target: self, selector: #selector(autoHideToolBar), userInfo: nil, repeats: true)
+            UIView.animate(withDuration: 0.2) {
+                self.isHidden = false
+            }
+        }
     }
     
     public func setToolBar() {