marinofaggiana 4 жил өмнө
parent
commit
dd8775b704

+ 0 - 20
iOSClient/Main/Colleaction Common/NCCollectionCommon.swift

@@ -287,26 +287,6 @@ class NCCollectionCommon: NSObject, NCSelectDelegate {
         })
     }
     
-    // MARK: - Print
-    
-    func printDocument(metadata: tableMetadata) {
-    
-        let fileNameURL = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!)
-        
-        if UIPrintInteractionController.canPrint(fileNameURL) {
-            
-            let printInfo = UIPrintInfo(dictionary: nil)
-            printInfo.jobName = fileNameURL.lastPathComponent
-            printInfo.outputType = .photo
-
-            let printController = UIPrintInteractionController.shared
-            printController.printInfo = printInfo
-            printController.showsNumberOfCopies = true
-            printController.printingItem = fileNameURL
-            printController.present(animated: true, completionHandler: nil)
-        }
-    }
-    
     // MARK: - Context Menu Configuration
     
     @available(iOS 13.0, *)

+ 1 - 1
iOSClient/Menu/NCCollectionViewCommon+Menu.swift

@@ -175,7 +175,7 @@ extension NCCollectionViewCommon {
                     icon: NCUtility.shared.loadImage(named: "printer"),
                     action: { menuAction in
                         if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
-                            NCCollectionCommon.shared.printDocument(metadata: metadata)
+                            NCNetworkingNotificationCenter.shared.printDocument(metadata: metadata)
                         } else {
                             NCOperationQueue.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorPrint)
                         }

+ 1 - 1
iOSClient/Menu/NCViewer+Menu.swift

@@ -128,7 +128,7 @@ extension NCViewer {
                     icon: NCUtility.shared.loadImage(named: "printer"),
                     action: { menuAction in
                         if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
-                            NCCollectionCommon.shared.printDocument(metadata: metadata)
+                            NCNetworkingNotificationCenter.shared.printDocument(metadata: metadata)
                         } else {
                             NCOperationQueue.shared.download(metadata: metadata, selector: NCGlobal.shared.selectorPrint)
                         }

+ 23 - 3
iOSClient/Networking/NCNetworkingNotificationCenter.swift

@@ -110,7 +110,7 @@ import Foundation
                        
                     case NCGlobal.shared.selectorPrint:
                         
-                        NCCollectionCommon.shared.printDocument(metadata: metadata)
+                        printDocument(metadata: metadata)
                         
                     case NCGlobal.shared.selectorSaveAlbum:
                         
@@ -160,7 +160,9 @@ import Foundation
         }
     }
     
-    @objc func openShare(ViewController: UIViewController, metadata: tableMetadata, indexPage: Int) {
+    // MARK: -
+
+    func openShare(ViewController: UIViewController, metadata: tableMetadata, indexPage: Int) {
         
         let shareNavigationController = UIStoryboard(name: "NCShare", bundle: nil).instantiateInitialViewController() as! UINavigationController
         let shareViewController = shareNavigationController.topViewController as! NCSharePaging
@@ -172,7 +174,7 @@ import Foundation
         ViewController.present(shareNavigationController, animated: true, completion: nil)
     }
         
-    @objc func downloadOpen(metadata: tableMetadata, selector: String) {
+    func downloadOpen(metadata: tableMetadata, selector: String) {
         
         if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: metadata.fileNameView) {
             
@@ -183,6 +185,24 @@ import Foundation
             NCNetworking.shared.download(metadata: metadata, selector: selector) { (_) in }
         }
     }
+        
+    func printDocument(metadata: tableMetadata) {
+    
+        let fileNameURL = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!)
+        
+        if UIPrintInteractionController.canPrint(fileNameURL) {
+            
+            let printInfo = UIPrintInfo(dictionary: nil)
+            printInfo.jobName = fileNameURL.lastPathComponent
+            printInfo.outputType = .photo
+
+            let printController = UIPrintInteractionController.shared
+            printController.printInfo = printInfo
+            printController.showsNumberOfCopies = true
+            printController.printingItem = fileNameURL
+            printController.present(animated: true, completionHandler: nil)
+        }
+    }
     
     //MARK: - Upload