Bläddra i källkod

Improved code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 år sedan
förälder
incheckning
82785332f3

+ 3 - 3
Nextcloud.xcodeproj/project.pbxproj

@@ -1583,7 +1583,7 @@
 			path = Networking;
 			sourceTree = "<group>";
 		};
-		F758B41E212C516300515F55 /* Scan */ = {
+		F758B41E212C516300515F55 /* Scan document */ = {
 			isa = PBXGroup;
 			children = (
 				F758B457212C564000515F55 /* NCScan.storyboard */,
@@ -1591,7 +1591,7 @@
 				F758B45F212C56A400515F55 /* NCScan.swift */,
 				F7B6B70327C4E7FA00A7F6EB /* NCScan+CollectionView.swift */,
 			);
-			path = Scan;
+			path = "Scan document";
 			sourceTree = "<group>";
 		};
 		F75DD764290AB369002EB562 /* Intent */ = {
@@ -2149,7 +2149,7 @@
 				F765F72E25237E3F00391DBE /* Recent */,
 				F70D87CC25EE6E58008CBBBD /* Rename file */,
 				F7CADB3D23CCDDA1000EEC78 /* RichWorkspace */,
-				F758B41E212C516300515F55 /* Scan */,
+				F758B41E212C516300515F55 /* Scan document */,
 				F7FE125B1BAC03FB0041924B /* Security */,
 				F79A65C12191D8DC00FF6DCC /* Select */,
 				F7ACE4281BAC0268006C0017 /* Settings */,

+ 5 - 3
iOSClient/Main/Create cloud/NCUploadScanDocument.swift

@@ -242,6 +242,7 @@ struct UploadScanDocumentView: View {
     @State var isSecured: Bool = true
     @State var isPresented = false
     @ObservedObject var uploadScanDocument: NCUploadScanDocument
+    @Environment(\.presentationMode) var presentationMode
 
     init(_ uploadScanDocument: NCUploadScanDocument) {
         self.uploadScanDocument = uploadScanDocument
@@ -336,9 +337,10 @@ struct UploadScanDocumentView: View {
                 }
 
                 Button(NSLocalizedString("_save_", comment: "")) {
-                    uploadScanDocument.save(fileName: filename) { dismiss in
-                        
-                    }
+                    // presentationMode.wrappedValue.dismiss()
+                    // uploadScanDocument.save(fileName: filename) { dismiss in
+                    // }
+                    NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDismissScanDocument)
                 }
                 .buttonStyle(ButtonUploadScanDocumenStyle(disabled: true))
                 .frame(maxWidth: .infinity, alignment: .center)

+ 2 - 0
iOSClient/NCGlobal.swift

@@ -374,6 +374,8 @@ class NCGlobal: NSObject {
     let notificationCenterPlayMedia                             = "playMedia"
     let notificationCenterPauseMedia                            = "pauseMedia"
 
+    let notificationCenterDismissScanDocument                   = "dismissScanDocument"
+
     // TIP
     //
     let tipNCViewerPDFThumbnail                                 = "tipncviewerpdfthumbnail"

+ 0 - 0
iOSClient/Scan/NCScan+CollectionView.swift → iOSClient/Scan document/NCScan+CollectionView.swift


+ 0 - 0
iOSClient/Scan/NCScan.storyboard → iOSClient/Scan document/NCScan.storyboard


+ 6 - 0
iOSClient/Scan/NCScan.swift → iOSClient/Scan document/NCScan.swift

@@ -111,6 +111,8 @@ class NCScan: UIViewController, NCScanCellCellDelegate {
         collectionViewSource.reloadData()
         collectionViewDestination.reloadData()
 
+        NotificationCenter.default.addObserver(self, selector: #selector(dismiss(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDismissScanDocument), object: nil)
+
         loadImage()
     }
 
@@ -156,6 +158,10 @@ class NCScan: UIViewController, NCScanCellCellDelegate {
         return false
     }
 
+    @objc func dismiss(_ notification: NSNotification) {
+        self.dismiss(animated: true, completion: nil)
+    }
+
     @IBAction func cancelAction(sender: UIBarButtonItem) {
         self.dismiss(animated: true, completion: nil)
     }

+ 0 - 0
iOSClient/Scan/NCScanCell.swift → iOSClient/Scan document/NCScanCell.swift