Browse Source

fix NCDocumentCamera

Signed-off-by: Marino Faggiana <8616947+marinofaggiana@users.noreply.github.com>
Marino Faggiana 1 year ago
parent
commit
ff06131fec

+ 1 - 1
iOSClient/AppDelegate.swift

@@ -885,7 +885,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
                 case NCGlobal.shared.actionScanDocument:
 
-                    NCDocumentCamera().openScannerDocument(viewController: rootViewController)
+                    NCDocumentCamera.shared.openScannerDocument(viewController: rootViewController)
 
                 case NCGlobal.shared.actionTextDocument:
 

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

@@ -84,7 +84,7 @@ extension AppDelegate {
             NCMenuAction(
                 title: NSLocalizedString("_scans_document_", comment: ""), icon: NCUtility().loadImage(named: "doc.text.viewfinder"), action: { _ in
                     if let viewController = appDelegate.window?.rootViewController {
-                        NCDocumentCamera().openScannerDocument(viewController: viewController)
+                        NCDocumentCamera.shared.openScannerDocument(viewController: viewController)
                     }
                 }
             )

+ 4 - 0
iOSClient/Scan document/NCDocumentCamera.swift

@@ -25,6 +25,10 @@ import Foundation
 import VisionKit
 
 class NCDocumentCamera: NSObject, VNDocumentCameraViewControllerDelegate {
+    static let shared: NCDocumentCamera = {
+        let instance = NCDocumentCamera()
+        return instance
+    }()
 
     var viewController: UIViewController?
     let utilityFileSystem = NCUtilityFileSystem()

+ 1 - 1
iOSClient/Scan document/NCScan.swift

@@ -185,7 +185,7 @@ class NCScan: UIViewController, NCScanCellCellDelegate {
         // TIP
         dismissTip()
 
-        NCDocumentCamera().openScannerDocument(viewController: self)
+        NCDocumentCamera.shared.openScannerDocument(viewController: self)
     }
 
     @IBAction func transferDown(sender: UIButton) {