Marino Faggiana 1 yıl önce
ebeveyn
işleme
f75673cc78

+ 2 - 0
iOSClient/NCGlobal.swift

@@ -364,6 +364,8 @@ class NCGlobal: NSObject {
     let notificationCenterDownloadedThumbnail                   = "DownloadedThumbnail"             // userInfo: ocId
 
     let notificationCenterOpenMediaDetail                       = "openMediaDetail"                 // userInfo: ocId
+    
+    let notificationCenterStartTimerAutoHideMediaPage           = "startTimerAutoHideMediaPage"
 
     let notificationCenterDismissScanDocument                   = "dismissScanDocument"
     let notificationCenterDismissUploadAssets                   = "dismissUploadAssets"

+ 9 - 0
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -199,6 +199,7 @@ class NCPlayerToolBar: UIView {
             playbackSliderEvent = .began
         case .moved:
             ncplayer.playerPosition(newPosition)
+            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
             playbackSliderEvent = .moved
         case .ended:
             ncplayer.playerPosition(newPosition)
@@ -224,6 +225,8 @@ class NCPlayerToolBar: UIView {
         } else {
             ncplayer.playerPlay()
         }
+
+        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
     }
 
     @IBAction func tapMute(_ sender: Any) {
@@ -239,6 +242,8 @@ class NCPlayerToolBar: UIView {
             ncplayer.setVolumeAudio(100)
             muteButton.setImage(NCUtility.shared.loadImage(named: "audioOn", color: .white), for: .normal)
         }
+
+        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
     }
 
     @IBAction func tapForward(_ sender: Any) {
@@ -246,6 +251,8 @@ class NCPlayerToolBar: UIView {
         guard let ncplayer = ncplayer else { return }
 
         ncplayer.jumpForward(10)
+
+        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
     }
 
     @IBAction func tapBack(_ sender: Any) {
@@ -253,5 +260,7 @@ class NCPlayerToolBar: UIView {
         guard let ncplayer = ncplayer else { return }
 
         ncplayer.jumpBackward(10)
+
+        NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage)
     }
 }

+ 5 - 1
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift

@@ -119,6 +119,8 @@ class NCViewerMediaPage: UIViewController {
         NotificationCenter.default.addObserver(self, selector: #selector(uploadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
 
         NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
+
+        NotificationCenter.default.addObserver(self, selector: #selector(startTimerAutoHide), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage), object: nil)
     }
 
     deinit {
@@ -136,6 +138,8 @@ class NCViewerMediaPage: UIViewController {
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
 
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
+
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterStartTimerAutoHideMediaPage), object: nil)
     }
 
     override func viewDidDisappear(_ animated: Bool) {
@@ -227,7 +231,7 @@ class NCViewerMediaPage: UIViewController {
         currentViewController.reloadDetail()
     }
 
-    func startTimerAutoHide() {
+    @objc func startTimerAutoHide() {
 
         timerAutoHide?.invalidate()
         timerAutoHide = Timer.scheduledTimer(timeInterval: timerAutoHideSeconds, target: self, selector: #selector(autoHide), userInfo: nil, repeats: true)