Browse Source

fix

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 1 year ago
parent
commit
8f435c9dcc

+ 3 - 0
iOSClient/NCGlobal.swift

@@ -368,6 +368,9 @@ class NCGlobal: NSObject {
     let notificationCenterDismissScanDocument                   = "dismissScanDocument"
     let notificationCenterDismissUploadAssets                   = "dismissUploadAssets"
 
+    let notificationCenterEnableSwipeGesture                    = "enableSwipeGesture"
+    let notificationCenterDisableSwipeGesture                   = "disableSwipeGesture"
+
     // TIP
     //
     let tipNCViewerPDFThumbnail                                 = "tipncviewerpdfthumbnail"

+ 0 - 1
iOSClient/Utility/CCUtility.h

@@ -211,7 +211,6 @@
 + (NSString *)getDirectoryProviderStorageOcId:(NSString *)ocId fileNameView:(NSString *)fileNameView;
 + (NSString *)getDirectoryProviderStorageIconOcId:(NSString *)ocId etag:(NSString *)etag;
 + (NSString *)getDirectoryProviderStoragePreviewOcId:(NSString *)ocId etag:(NSString *)etag;
-+ (NSString *)getDirectoryProviderStorageSnapshotOcId:(NSString *)ocId etag:(NSString *)etag;
 + (BOOL)fileProviderStorageExists:(tableMetadata *)metadata;
 + (int64_t)fileProviderStorageSize:(NSString *)ocId fileNameView:(NSString *)fileNameView;
 + (BOOL)fileProviderStoragePreviewIconExists:(NSString *)ocId etag:(NSString *)etag;

+ 0 - 5
iOSClient/Utility/CCUtility.m

@@ -1107,11 +1107,6 @@
     return [NSString stringWithFormat:@"%@/%@.preview.%@", [self getDirectoryProviderStorageOcId:ocId], etag, [NCGlobal shared].extensionPreview];
 }
 
-+ (NSString *)getDirectoryProviderStorageSnapshotOcId:(NSString *)ocId etag:(NSString *)etag
-{
-    return [NSString stringWithFormat:@"%@/%@.snapshot.%@", [self getDirectoryProviderStorageOcId:ocId], etag, [NCGlobal shared].extensionPreview];
-}
-
 + (BOOL)fileProviderStorageExists:(tableMetadata *)metadata
 {
     NSString *fileNameViewPath = [self getDirectoryProviderStorageOcId:metadata.ocId fileNameView:metadata.fileNameView];

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

@@ -108,7 +108,7 @@ class NCPlayer: NSObject {
             player.media = VLCMedia(url: url)
             player.position = position
             playerToolBar?.setBarPlayer(position: position)
-            viewerMediaPage?.changeScreenMode(mode: .normal)
+            viewerMediaPage?.changeScreenMode(mode: .normal, isMovie: true)
             pauseAfterPlay = true
             player.play()
         }

+ 0 - 5
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -181,11 +181,6 @@ class NCViewerMedia: UIViewController {
                         }
                     }
                 } else {
-                    if viewerMediaScreenMode == .normal {
-                        playerToolBar?.show()
-                    } else {
-                        playerToolBar?.hide()
-                    }
                     var position: Float = 0
                     if let result = NCManageDatabase.shared.getVideo(metadata: metadata), let resultPosition = result.position {
                         position = resultPosition

+ 30 - 3
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift

@@ -122,6 +122,9 @@ class NCViewerMediaPage: UIViewController {
         progressView.trackTintColor = .clear
         progressView.progress = 0
 
+        NotificationCenter.default.addObserver(self, selector: #selector(pageViewController.enableSwipeGesture), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterEnableSwipeGesture), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(pageViewController.disableSwipeGesture), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDisableSwipeGesture), object: nil)
+
         NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterRenameFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterMoveFile), object: nil)
@@ -139,6 +142,9 @@ class NCViewerMediaPage: UIViewController {
 
         timerAutoHide?.invalidate()
 
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterEnableSwipeGesture), object: nil)
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDisableSwipeGesture), object: nil)
+
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil)
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterRenameFile), object: nil)
         NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterMoveFile), object: nil)
@@ -206,7 +212,9 @@ class NCViewerMediaPage: UIViewController {
         NCViewer.shared.toggleMenu(viewController: self, metadata: currentViewController.metadata, webView: false, imageIcon: imageIcon)
     }
 
-    func changeScreenMode(mode: ScreenMode) {
+    func changeScreenMode(mode: ScreenMode, isMovie: Bool = false) {
+
+        let metadata = metadatas[currentIndex]
 
         if mode == .normal {
 
@@ -214,7 +222,7 @@ class NCViewerMediaPage: UIViewController {
             hideStatusBar = false
             progressView.isHidden = false
 
-            if metadatas[currentIndex].isMovie {
+            if metadata.isMovie || isMovie {
                 currentViewController.playerToolBar?.show()
                 view.backgroundColor = .black
                 textColor = .white
@@ -231,7 +239,7 @@ class NCViewerMediaPage: UIViewController {
             hideStatusBar = true
             progressView.isHidden = true
 
-            if metadatas[currentIndex].isMovie {
+            if metadata.isMovie || isMovie {
                 currentViewController.playerToolBar?.hide()
             }
 
@@ -642,3 +650,22 @@ extension NCViewerMediaPage: UIGestureRecognizerDelegate {
         }
     }
 }
+
+extension UIPageViewController {
+
+    @objc func enableSwipeGesture() {
+        for view in self.view.subviews {
+            if let subView = view as? UIScrollView {
+                subView.isScrollEnabled = true
+            }
+        }
+    }
+
+    @objc func disableSwipeGesture() {
+        for view in self.view.subviews {
+            if let subView = view as? UIScrollView {
+                subView.isScrollEnabled = false
+            }
+        }
+    }
+}