Browse Source

Improved code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 years ago
parent
commit
9c732a90a1
1 changed files with 13 additions and 13 deletions
  1. 13 13
      iOSClient/Scan document/NCUploadScanDocument.swift

+ 13 - 13
iOSClient/Scan document/NCUploadScanDocument.swift

@@ -62,19 +62,6 @@ class NCUploadScanDocument: ObservableObject {
         self.serverUrl = serverUrl
     }
 
-    func fileName(_ fileName: String) -> String {
-
-        var fileName = fileName.trimmingCharacters(in: .whitespacesAndNewlines)
-        guard !fileName.isEmpty, fileName != ".", fileName.lowercased() != ".pdf" else { return "" }
-
-        let ext = (fileName as NSString).pathExtension.uppercased()
-        if ext.isEmpty {
-            return fileName + ".pdf"
-        } else {
-            return (fileName as NSString).deletingPathExtension + ".pdf"
-        }
-    }
-
     func save(fileName: String, password: String = "", isTextRecognition: Bool = false, removeAllFiles: Bool, quality: Double, completion: @escaping (_ openConflictViewController: Bool, _ error: Bool) -> Void) {
 
         self.password = password
@@ -178,6 +165,19 @@ class NCUploadScanDocument: ObservableObject {
         }
     }
 
+    func fileName(_ fileName: String) -> String {
+
+        var fileName = fileName.trimmingCharacters(in: .whitespacesAndNewlines)
+        guard !fileName.isEmpty, fileName != ".", fileName.lowercased() != ".pdf" else { return "" }
+
+        let ext = (fileName as NSString).pathExtension.uppercased()
+        if ext.isEmpty {
+            return fileName + ".pdf"
+        } else {
+            return (fileName as NSString).deletingPathExtension + ".pdf"
+        }
+    }
+
     private func changeCompressionImage(_ image: UIImage, quality: Double) -> UIImage {
 
         var compressionQuality: CGFloat = 0.0