Marino Faggiana 6 years ago
parent
commit
963890a434

+ 26 - 1
iOSClient/Main/CCCreateCloud.swift

@@ -1063,7 +1063,32 @@ class CreateFormUploadScanDocument: XLFormViewController, CCMoveDelegate {
         
         NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: self.serverUrl, fileID: nil, action: Int32(k_action_NULL))
         
-        self.dismiss(animated: true, completion: nil)
+        // Request delete all image scanned
+        let alertController = UIAlertController(title: "", message: NSLocalizedString("_delete_all_scanned_images_", comment: ""), preferredStyle: .alert)
+        
+        let actionYes = UIAlertAction(title: NSLocalizedString("_yes_delete_", comment: ""), style: .default) { (action:UIAlertAction) in
+            
+            let path = CCUtility.getDirectoryScan()!
+            
+            do {
+                let filePaths = try FileManager.default.contentsOfDirectory(atPath: path)
+                for filePath in filePaths {
+                    try FileManager.default.removeItem(atPath: path + filePath)
+                }
+            } catch let error as NSError {
+                print("Could not clear temp folder: \(error.debugDescription)")
+            }
+            
+            self.dismiss(animated: true, completion: nil)
+        }
+        
+        let actionNo = UIAlertAction(title: NSLocalizedString("_no_delete_", comment: ""), style: .default) { (action:UIAlertAction) in
+            self.dismiss(animated: true, completion: nil)
+        }
+        
+        alertController.addAction(actionYes)
+        alertController.addAction(actionNo)
+        self.present(alertController, animated: true, completion:nil)
     }
     
     func cancel() {

+ 1 - 1
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -584,7 +584,7 @@
 "_file_type_"                       = "File type";
 "_pdf_password_"                    = "PDF Password";
 "_file_creation_"                   = "File creation";
-
+"_delete_all_scanned_images_"       = "Do you want to delete all scanned images?";
 
 /* The title on the navigation bar of the Scanning screen. */
 "wescan.scanning.title"             = "Scanning";