Explorar el Código

new build

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana hace 1 año
padre
commit
925e43420c

+ 1 - 1
Brand/Database.swift

@@ -26,4 +26,4 @@ import Foundation
 // Database Realm
 //
 let databaseName                    = "nextcloud.realm"
-let databaseSchemaVersion: UInt64   = 281
+let databaseSchemaVersion: UInt64   = 290

+ 0 - 1
Cartfile.resolved

@@ -1,3 +1,2 @@
 binary "https://code.videolan.org/videolan/VLCKit/raw/master/Packaging/MobileVLCKit.json" "3.5.1"
-github "marinofaggiana/KTVHTTPCache" "2.0.6"
 github "marinofaggiana/TOPasscodeViewController" "ed795637acd2b1ef154e011a04ebab4686d0523c"

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -3958,7 +3958,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0;
+				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = NKUJUXUJ3B;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;
@@ -4021,7 +4021,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0;
+				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = NKUJUXUJ3B;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;

+ 0 - 2
iOSClient/NCGlobal.swift

@@ -363,8 +363,6 @@ class NCGlobal: NSObject {
 
     let notificationCenterDownloadedThumbnail                   = "DownloadedThumbnail"             // userInfo: ocId
 
-    let notificationCenterHidePlayerToolBar                     = "hidePlayerToolBar"               // userInfo: ocId
-    let notificationCenterShowPlayerToolBar                     = "showPlayerToolBar"               // userInfo: ocId, enableTimerAutoHide
     let notificationCenterOpenMediaDetail                       = "openMediaDetail"                 // userInfo: ocId
 
     let notificationCenterDismissScanDocument                   = "dismissScanDocument"

+ 0 - 1
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift

@@ -205,7 +205,6 @@ extension NCPlayer: VLCMediaPlayerDelegate {
         case .ended:
             if let url = self.url {
                 NCManageDatabase.shared.addVideo(metadata: metadata, position: 0)
-                NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterShowPlayerToolBar, userInfo: ["ocId": self.metadata.ocId, "enableTimerAutoHide": false])
                 self.thumbnailer?.fetchThumbnail()
                 self.openAVPlayer(url: url)
             }

+ 13 - 23
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -55,9 +55,9 @@ class NCPlayerToolBar: UIView {
     private var timerAutoHideSeconds: Double {
         get {
             if NCUtility.shared.isSimulator() { // for test
-                return 150
+                return 3
             } else {
-                return 3.5
+                return 5
             }
         }
     }
@@ -133,7 +133,7 @@ class NCPlayerToolBar: UIView {
             muteButton.setImage(NCUtility.shared.loadImage(named: "audioOn", color: .white), for: .normal)
         }
 
-        show(enableTimerAutoHide: false)
+        show()
     }
 
     public func update() {
@@ -165,13 +165,13 @@ class NCPlayerToolBar: UIView {
 
     // MARK: -
 
-    public func show(enableTimerAutoHide: Bool = false) {
+    public func show() {
 
-        timerAutoHide?.invalidate()
-        if enableTimerAutoHide {
+        if let ncplayer = ncplayer, ncplayer.isPlay() {
             startTimerAutoHide()
         }
-        if !self.isHidden { return }
+
+        ncplayer?.viewerMediaPage?.changeScreenMode(mode: .normal, toggleToolbar: false)
 
         UIView.animate(withDuration: 0.3, animations: {
             self.alpha = 1
@@ -180,12 +180,15 @@ class NCPlayerToolBar: UIView {
         })
     }
 
-    func isShow() -> Bool {
+    private func startTimerAutoHide() {
 
-        return !self.isHidden
+        timerAutoHide?.invalidate()
+        timerAutoHide = Timer.scheduledTimer(timeInterval: timerAutoHideSeconds, target: self, selector: #selector(hide), userInfo: nil, repeats: false)
     }
 
-    public func hide() {
+    @objc func hide() {
+
+        ncplayer?.viewerMediaPage?.changeScreenMode(mode: .full, toggleToolbar: false)
 
         UIView.animate(withDuration: 0.3, animations: {
             self.alpha = 0
@@ -194,19 +197,6 @@ class NCPlayerToolBar: UIView {
         })
     }
 
-    @objc private func automaticHide() {
-
-        if let metadata = self.metadata {
-            NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterHidePlayerToolBar, userInfo: ["ocId": metadata.ocId])
-        }
-    }
-
-    private func startTimerAutoHide() {
-
-        timerAutoHide?.invalidate()
-        timerAutoHide = Timer.scheduledTimer(timeInterval: timerAutoHideSeconds, target: self, selector: #selector(automaticHide), userInfo: nil, repeats: false)
-    }
-
     private func reStartTimerAutoHide() {
 
         if let timerAutoHide = timerAutoHide, timerAutoHide.isValid {

+ 8 - 31
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift

@@ -106,9 +106,6 @@ class NCViewerMediaPage: UIViewController {
         NotificationCenter.default.addObserver(self, selector: #selector(uploadStartFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadStartFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(uploadedFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
 
-        NotificationCenter.default.addObserver(self, selector: #selector(hidePlayerToolBar(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterHidePlayerToolBar), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(showPlayerToolBar(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterShowPlayerToolBar), object: nil)
-
         NotificationCenter.default.addObserver(self, selector: #selector(applicationDidBecomeActive(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
     }
 
@@ -124,9 +121,6 @@ class NCViewerMediaPage: UIViewController {
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadStartFile), object: nil)
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedFile), object: nil)
 
-        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterHidePlayerToolBar), object: nil)
-        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterShowPlayerToolBar), object: nil)
-
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidBecomeActive), object: nil)
     }
 
@@ -182,7 +176,7 @@ class NCViewerMediaPage: UIViewController {
         NCViewer.shared.toggleMenu(viewController: self, metadata: currentViewController.metadata, webView: false, imageIcon: imageIcon)
     }
 
-    func changeScreenMode(mode: ScreenMode, enableTimerAutoHide: Bool = false) {
+    func changeScreenMode(mode: ScreenMode, toggleToolbar: Bool) {
 
         if mode == .normal {
 
@@ -190,9 +184,8 @@ class NCViewerMediaPage: UIViewController {
             hideStatusBar = false
             progressView.isHidden = false
 
-            if metadatas[currentIndex].classFile == NKCommon.TypeClassFile.video.rawValue || metadatas[currentIndex].classFile == NKCommon.TypeClassFile.audio.rawValue {
-                currentViewController.playerToolBar?.show(enableTimerAutoHide: enableTimerAutoHide)
-
+            if toggleToolbar && (metadatas[currentIndex].classFile == NKCommon.TypeClassFile.video.rawValue || metadatas[currentIndex].classFile == NKCommon.TypeClassFile.audio.rawValue) {
+                currentViewController.playerToolBar?.show()
             }
 
             NCUtility.shared.colorNavigationController(navigationController, backgroundColor: .systemBackground, titleColor: .label, tintColor: nil, withoutShadow: false)
@@ -205,7 +198,9 @@ class NCViewerMediaPage: UIViewController {
             hideStatusBar = true
             progressView.isHidden = true
 
-            currentViewController.playerToolBar?.hide()
+            if toggleToolbar && (metadatas[currentIndex].classFile == NKCommon.TypeClassFile.video.rawValue || metadatas[currentIndex].classFile == NKCommon.TypeClassFile.audio.rawValue) {
+                currentViewController.playerToolBar?.hide()
+            }
 
             view.backgroundColor = .black
             textColor = .white
@@ -354,24 +349,6 @@ class NCViewerMediaPage: UIViewController {
         }
     }
 
-    @objc func hidePlayerToolBar(_ notification: NSNotification) {
-
-        if let userInfo = notification.userInfo as NSDictionary?, let ocId = userInfo["ocId"] as? String {
-            if currentViewController.metadata.ocId == ocId {
-                changeScreenMode(mode: .full)
-            }
-        }
-    }
-
-    @objc func showPlayerToolBar(_ notification: NSNotification) {
-
-        if let userInfo = notification.userInfo as NSDictionary?, let ocId = userInfo["ocId"] as? String, let enableTimerAutoHide = userInfo["enableTimerAutoHide"] as? Bool {
-            if currentViewController.metadata.ocId == ocId {
-                changeScreenMode(mode: .normal, enableTimerAutoHide: enableTimerAutoHide)
-            }
-        }
-    }
-
     @objc func applicationDidBecomeActive(_ notification: NSNotification) {
 
         progressView.progress = 0
@@ -594,9 +571,9 @@ extension NCViewerMediaPage: UIGestureRecognizerDelegate {
     @objc func didSingleTapWith(gestureRecognizer: UITapGestureRecognizer) {
 
         if currentScreenMode == .full {
-            changeScreenMode(mode: .normal, enableTimerAutoHide: true)
+            changeScreenMode(mode: .normal, toggleToolbar: true)
         } else {
-            changeScreenMode(mode: .full)
+            changeScreenMode(mode: .full, toggleToolbar: true)
         }
     }