marinofaggiana 4 年之前
父節點
當前提交
7129ff682d
共有 2 個文件被更改,包括 11 次插入18 次删除
  1. 2 2
      Nextcloud.xcodeproj/project.pbxproj
  2. 9 16
      iOSClient/Viewer/NCViewer.swift

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -1084,12 +1084,12 @@
 		F79630EC215526B60015EEA5 /* Viewer */ = {
 			isa = PBXGroup;
 			children = (
+				F7F9D1BA25397CE000D9BFF5 /* NCViewer.swift */,
+				F76D3CEF2428B3DD005DFA87 /* NCViewerPDF */,
 				F79018B1240962C7007C9B6D /* NCViewerImage */,
 				F72D404823D2082500A97FD0 /* NCViewerNextcloudText.swift */,
-				F76D3CEF2428B3DD005DFA87 /* NCViewerPDF */,
 				F790110D21415BF600D7B136 /* NCViewerRichdocument.swift */,
 				F7C7B488245EBA4100D93E60 /* NCViewerQuickLook.swift */,
-				F7F9D1BA25397CE000D9BFF5 /* NCViewer.swift */,
 				F79630ED215527D40015EEA5 /* NCViewerVideo.swift */,
 			);
 			path = Viewer;

+ 9 - 16
iOSClient/Viewer/NCViewer.swift

@@ -35,6 +35,7 @@ class NCViewer: NSObject {
             // PDF
             if metadata.contentType == "application/pdf" {
                     
+                if !canPush(viewController: viewController) { return }
                 guard let navigationController = viewController.navigationController else { return }
                 let viewController:NCViewerPDF = UIStoryboard(name: "NCViewerPDF", bundle: nil).instantiateInitialViewController() as! NCViewerPDF
                 
@@ -45,20 +46,12 @@ class NCViewer: NSObject {
             }
         }
     }
+    
+    private func canPush(viewController: UIViewController) -> Bool {
+        
+        if viewController is NCFiles || viewController is NCFavorite || viewController is NCOffline || viewController is NCRecent || viewController is NCFileViewInFolder {
+            return true
+        }
+        return false
+    }
 }
-
-/*
- @objc func segueMetadata(_ metadata: tableMetadata) {
-     if self.appDelegate.activeViewController is NCFiles {
-         (self.appDelegate.activeViewController as! NCFiles).segue(metadata: metadata)
-     } else if self.appDelegate.activeViewController is NCFavorite {
-         (self.appDelegate.activeViewController as! NCFavorite).segue(metadata: metadata)
-     } else if self.appDelegate.activeViewController is NCOffline {
-         (self.appDelegate.activeViewController as! NCOffline).segue(metadata: metadata)
-     } else if self.appDelegate.activeViewController is NCRecent {
-         (self.appDelegate.activeViewController as! NCRecent).segue(metadata: metadata)
-     } else if self.appDelegate.activeViewController is NCFileViewInFolder {
-         (self.appDelegate.activeViewController as! NCFileViewInFolder).segue(metadata: metadata)
-     }
- }
- */