marinofaggiana 4 سال پیش
والد
کامیت
6c7f0f36ad

+ 2 - 2
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -329,7 +329,7 @@ import NCCommunication
                         self.dismiss(animated: true, completion: {
                             let metadata = NCManageDatabase.sharedInstance.createMetadata(account: self.appDelegate.account, fileName: fileName, ocId: CCUtility.createRandomString(12), serverUrl: self.serverUrl, urlBase: self.appDelegate.urlBase, url: url ?? "", contentType: result.contentType, livePhoto: false)
                             
-                            NCNetworkingNotificationCenter.shared.segueMetadata(metadata)
+                            _ = NCViewer.init(viewController: self.appDelegate.activeViewController, metadata: metadata)
                         })
                     }
                     
@@ -351,7 +351,7 @@ import NCCommunication
                     
                         let metadata = NCManageDatabase.sharedInstance.createMetadata(account: self.appDelegate.account, fileName: (fileName as NSString).deletingPathExtension + "." + self.fileNameExtension, ocId: CCUtility.createRandomString(12), serverUrl: self.serverUrl, urlBase: self.appDelegate.urlBase, url: url!, contentType: "", livePhoto: false)
                     
-                        NCNetworkingNotificationCenter.shared.segueMetadata(metadata)
+                        _ = NCViewer.init(viewController: self.appDelegate.activeViewController, metadata: metadata)
                    })
                    
                     

+ 0 - 14
iOSClient/Networking/NCNetworkingNotificationCenter.swift

@@ -174,20 +174,6 @@ import Foundation
         }
     }
     
-    @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)
-        }
-    }
-    
     //MARK: - Upload
 
     @objc func uploadedFile(_ notification: NSNotification) {

+ 17 - 2
iOSClient/Viewer/NCViewer.swift

@@ -30,13 +30,12 @@ class NCViewer: NSObject {
     init(viewController: UIViewController, metadata: tableMetadata) {
         super.init()
 
-        guard let navigationController = viewController.navigationController else { return }
-        
         if metadata.typeFile == k_metadataTypeFile_document {
                 
             // PDF
             if metadata.contentType == "application/pdf" {
                     
+                guard let navigationController = viewController.navigationController else { return }
                 let viewController:NCViewerPDF = UIStoryboard(name: "NCViewerPDF", bundle: nil).instantiateInitialViewController() as! NCViewerPDF
                 
                 viewController.metadata = metadata
@@ -47,3 +46,19 @@ class NCViewer: NSObject {
         }
     }
 }
+
+/*
+ @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)
+     }
+ }
+ */

+ 2 - 2
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -221,7 +221,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
         handlePageChange()
     }
     
-    //MARK: -
+    //MARK: - Search
     
     @objc func searchText() {
         
@@ -230,7 +230,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
         viewerPDFSearch.pdfDocument = pdfDocument
         
         let navigaionController = UINavigationController.init(rootViewController: viewerPDFSearch)
-        appDelegate.activeDetail.present(navigaionController, animated: true)
+        self.present(navigaionController, animated: true)
     }
     
     func searchPdfSelection(_ pdfSelection: PDFSelection) {