NCUploadScanDocument.swift 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. //
  2. // NCUploadScanDocument.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 28/12/22.
  6. // Copyright © 2022 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. import SwiftUI
  24. import NextcloudKit
  25. import Vision
  26. import VisionKit
  27. import Photos
  28. import PDFKit
  29. class NCHostingUploadScanDocumentView: NSObject {
  30. @objc func makeShipDetailsUI(images: [UIImage], userBaseUrl: NCUserBaseUrl, serverUrl: String) -> UIViewController {
  31. let uploadScanDocument = NCUploadScanDocument(images: images, userBaseUrl: userBaseUrl, serverUrl: serverUrl)
  32. let details = UploadScanDocumentView(uploadScanDocument)
  33. let vc = UIHostingController(rootView: details)
  34. vc.title = NSLocalizedString("_save_", comment: "")
  35. return vc
  36. }
  37. }
  38. // MARK: - Class
  39. class NCUploadScanDocument: ObservableObject {
  40. internal var userBaseUrl: NCUserBaseUrl
  41. internal var serverUrl: String
  42. internal var metadata = tableMetadata()
  43. internal var images: [UIImage]
  44. internal var password: String = ""
  45. internal var isTextRecognition: Bool = false
  46. internal var quality: Double = 0
  47. internal var removeAllFiles: Bool = false
  48. @Published var showHUD: Bool = false
  49. init(images: [UIImage], userBaseUrl: NCUserBaseUrl, serverUrl: String) {
  50. self.images = images
  51. self.userBaseUrl = userBaseUrl
  52. self.serverUrl = serverUrl
  53. }
  54. func save(fileName: String, password: String = "", isTextRecognition: Bool = false, removeAllFiles: Bool, quality: Double, completion: @escaping (_ openConflictViewController: Bool) -> Void) {
  55. let ext = (fileName as NSString).pathExtension.uppercased()
  56. var fileNameMetadata = ""
  57. if ext.isEmpty {
  58. fileNameMetadata = fileName + ".pdf"
  59. } else {
  60. fileNameMetadata = (fileName as NSString).deletingPathExtension + ".pdf"
  61. }
  62. self.password = password
  63. self.isTextRecognition = isTextRecognition
  64. self.quality = quality
  65. self.removeAllFiles = removeAllFiles
  66. metadata = NCManageDatabase.shared.createMetadata(account: userBaseUrl.account,
  67. user: userBaseUrl.user,
  68. userId: userBaseUrl.userId,
  69. fileName: fileNameMetadata,
  70. fileNameView: fileNameMetadata,
  71. ocId: UUID().uuidString,
  72. serverUrl: serverUrl,
  73. urlBase: userBaseUrl.urlBase,
  74. url: "",
  75. contentType: "")
  76. metadata.session = NCNetworking.shared.sessionIdentifierBackground
  77. metadata.sessionSelector = NCGlobal.shared.selectorUploadFile
  78. metadata.status = NCGlobal.shared.metadataStatusWaitUpload
  79. if NCManageDatabase.shared.getMetadataConflict(account: userBaseUrl.account, serverUrl: serverUrl, fileNameView: fileNameMetadata) != nil {
  80. completion(true)
  81. } else {
  82. createPDF(metadata: metadata) { error in
  83. if !error {
  84. completion(false)
  85. }
  86. }
  87. }
  88. }
  89. func createPDF(metadata: tableMetadata, completion: @escaping (_ error: Bool) -> Void) {
  90. DispatchQueue.global().async {
  91. let fileNamePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
  92. let pdfData = NSMutableData()
  93. if self.password.isEmpty {
  94. UIGraphicsBeginPDFContextToData(pdfData, CGRect.zero, nil)
  95. } else {
  96. for char in self.password.unicodeScalars {
  97. if !char.isASCII {
  98. let error = NKError(errorCode: NCGlobal.shared.errorForbidden, errorDescription: "_password_ascii_")
  99. NCContentPresenter.shared.showError(error: error)
  100. return DispatchQueue.main.async { completion(true) }
  101. }
  102. }
  103. let info: [AnyHashable: Any] = [kCGPDFContextUserPassword as String: self.password, kCGPDFContextOwnerPassword as String: self.password]
  104. UIGraphicsBeginPDFContextToData(pdfData, CGRect.zero, info)
  105. }
  106. for image in self.images {
  107. self.drawImage(image: image, quality: self.quality, isTextRecognition: self.isTextRecognition, fontColor: UIColor.clear)
  108. }
  109. UIGraphicsEndPDFContext()
  110. do {
  111. try pdfData.write(to: URL(fileURLWithPath: fileNamePath), options: .atomic)
  112. metadata.size = NCUtilityFileSystem.shared.getFileSize(filePath: fileNamePath)
  113. NCNetworkingProcessUpload.shared.createProcessUploads(metadatas: [metadata], completion: { _ in })
  114. if self.removeAllFiles {
  115. let path = CCUtility.getDirectoryScan()!
  116. let filePaths = try FileManager.default.contentsOfDirectory(atPath: path)
  117. for filePath in filePaths {
  118. try FileManager.default.removeItem(atPath: path + "/" + filePath)
  119. }
  120. }
  121. } catch {
  122. print("Error: \(error)")
  123. }
  124. DispatchQueue.main.async { completion(false) }
  125. }
  126. }
  127. func createPDFPreview(quality: Double, isTextRecognition: Bool, completion: @escaping (_ data: Data) -> Void) {
  128. DispatchQueue.global().async {
  129. if let image = self.images.first {
  130. let pdfData = NSMutableData()
  131. UIGraphicsBeginPDFContextToData(pdfData, CGRect.zero, nil)
  132. self.drawImage(image: image, quality: quality, isTextRecognition: isTextRecognition, fontColor: UIColor.red)
  133. UIGraphicsEndPDFContext()
  134. DispatchQueue.main.async { completion(pdfData as Data) }
  135. } else {
  136. let url = Bundle.main.url(forResource: "Reasons to use Nextcloud", withExtension: "pdf")!
  137. let data = try? Data(contentsOf: url)
  138. DispatchQueue.main.async { completion(data!) }
  139. }
  140. }
  141. }
  142. private func changeCompressionImage(_ image: UIImage, quality: Double) -> UIImage {
  143. var compressionQuality: CGFloat = 0.0
  144. var baseHeight: Float = 595.2 // A4
  145. var baseWidth: Float = 841.8 // A4
  146. switch quality {
  147. case 0:
  148. baseHeight *= 2
  149. baseWidth *= 2
  150. compressionQuality = 0.3
  151. case 1:
  152. baseHeight *= 3
  153. baseWidth *= 3
  154. compressionQuality = 0.4
  155. case 2:
  156. baseHeight *= 4
  157. baseWidth *= 4
  158. compressionQuality = 0.5
  159. case 3:
  160. baseHeight *= 5
  161. baseWidth *= 5
  162. compressionQuality = 0.6
  163. case 4:
  164. baseHeight = Float(image.size.height)
  165. baseWidth = Float(image.size.width)
  166. compressionQuality = 0.6
  167. default:
  168. break
  169. }
  170. var newHeight = Float(image.size.height)
  171. var newWidth = Float(image.size.width)
  172. var imgRatio: Float = newWidth / newHeight
  173. let baseRatio: Float = baseWidth / baseHeight
  174. if newHeight > baseHeight || newWidth > baseWidth {
  175. if imgRatio < baseRatio {
  176. imgRatio = baseHeight / newHeight
  177. newWidth = imgRatio * newWidth
  178. newHeight = baseHeight
  179. } else if imgRatio > baseRatio {
  180. imgRatio = baseWidth / newWidth
  181. newHeight = imgRatio * newHeight
  182. newWidth = baseWidth
  183. } else {
  184. newHeight = baseHeight
  185. newWidth = baseWidth
  186. }
  187. }
  188. let rect = CGRect(x: 0.0, y: 0.0, width: CGFloat(newWidth), height: CGFloat(newHeight))
  189. UIGraphicsBeginImageContext(rect.size)
  190. image.draw(in: rect)
  191. let img = UIGraphicsGetImageFromCurrentImageContext()
  192. let imageData = img?.jpegData(compressionQuality: CGFloat(compressionQuality))
  193. UIGraphicsEndImageContext()
  194. if let imageData = imageData, let image = UIImage(data: imageData) {
  195. return image
  196. }
  197. return image
  198. }
  199. private func bestFittingFont(for text: String, in bounds: CGRect, fontDescriptor: UIFontDescriptor, fontColor: UIColor) -> [NSAttributedString.Key: Any] {
  200. let constrainingDimension = min(bounds.width, bounds.height)
  201. let properBounds = CGRect(origin: .zero, size: bounds.size)
  202. var attributes: [NSAttributedString.Key: Any] = [:]
  203. let infiniteBounds = CGSize(width: CGFloat.infinity, height: CGFloat.infinity)
  204. var bestFontSize: CGFloat = constrainingDimension
  205. // Search font (H)
  206. for fontSize in stride(from: bestFontSize, through: 0, by: -1) {
  207. let newFont = UIFont(descriptor: fontDescriptor, size: fontSize)
  208. attributes[.font] = newFont
  209. let currentFrame = text.boundingRect(with: infiniteBounds, options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: attributes, context: nil)
  210. if properBounds.contains(currentFrame) {
  211. bestFontSize = fontSize
  212. break
  213. }
  214. }
  215. // Search kern (W)
  216. let font = UIFont(descriptor: fontDescriptor, size: bestFontSize)
  217. attributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: fontColor, NSAttributedString.Key.kern: 0] as [NSAttributedString.Key: Any]
  218. for kern in stride(from: 0, through: 100, by: 0.1) {
  219. let attributesTmp = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: fontColor, NSAttributedString.Key.kern: kern] as [NSAttributedString.Key: Any]
  220. let size = text.size(withAttributes: attributesTmp).width
  221. if size <= bounds.width {
  222. attributes = attributesTmp
  223. } else {
  224. break
  225. }
  226. }
  227. return attributes
  228. }
  229. private func drawImage(image: UIImage, quality: Double, isTextRecognition: Bool, fontColor: UIColor) {
  230. let image = changeCompressionImage(image, quality: quality)
  231. let bounds = CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)
  232. if isTextRecognition {
  233. UIGraphicsBeginPDFPageWithInfo(bounds, nil)
  234. image.draw(in: bounds)
  235. let requestHandler = VNImageRequestHandler(cgImage: image.cgImage!, options: [:])
  236. let request = VNRecognizeTextRequest { request, _ in
  237. guard let observations = request.results as? [VNRecognizedTextObservation] else { return }
  238. for observation in observations {
  239. guard let textLine = observation.topCandidates(1).first else { continue }
  240. var t: CGAffineTransform = CGAffineTransform.identity
  241. t = t.scaledBy(x: image.size.width, y: -image.size.height)
  242. t = t.translatedBy(x: 0, y: -1)
  243. let rect = observation.boundingBox.applying(t)
  244. let text = textLine.string
  245. let font = UIFont.systemFont(ofSize: rect.size.height, weight: .regular)
  246. let attributes = self.bestFittingFont(for: text, in: rect, fontDescriptor: font.fontDescriptor, fontColor: fontColor)
  247. text.draw(with: rect, options: .usesLineFragmentOrigin, attributes: attributes, context: nil)
  248. }
  249. }
  250. request.recognitionLevel = .accurate
  251. request.usesLanguageCorrection = true
  252. try? requestHandler.perform([request])
  253. } else {
  254. UIGraphicsBeginPDFPageWithInfo(bounds, nil)
  255. image.draw(in: bounds)
  256. }
  257. }
  258. }
  259. // MARK: - Delegate
  260. extension NCUploadScanDocument: NCSelectDelegate {
  261. func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) {
  262. if let serverUrl = serverUrl {
  263. CCUtility.setDirectoryScanDocument(serverUrl)
  264. self.serverUrl = serverUrl
  265. }
  266. }
  267. }
  268. extension NCUploadScanDocument: NCCreateFormUploadConflictDelegate {
  269. func dismissCreateFormUploadConflict(metadatas: [tableMetadata]?) {
  270. if let metadata = metadatas?.first {
  271. self.showHUD.toggle()
  272. createPDF(metadata: metadata) { error in
  273. if !error {
  274. self.showHUD.toggle()
  275. NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDismissScanDocument)
  276. }
  277. }
  278. }
  279. }
  280. }
  281. // MARK: - View
  282. struct UploadScanDocumentView: View {
  283. @State var fileName = "Scan"
  284. @State var password: String = ""
  285. @State var isSecuredPassword: Bool = true
  286. @State var isTextRecognition: Bool = CCUtility.getTextRecognitionStatus()
  287. @State var quality = CCUtility.getQualityScanDocument()
  288. @State var removeAllFiles: Bool = CCUtility.getDeleteAllScanImages()
  289. @State var isPresentedSelect = false
  290. @State var isPresentedUploadConflict = false
  291. var metadatasConflict: [tableMetadata] = []
  292. @ObservedObject var uploadScanDocument: NCUploadScanDocument
  293. @Environment(\.presentationMode) var presentationMode
  294. init(_ uploadScanDocument: NCUploadScanDocument) {
  295. self.uploadScanDocument = uploadScanDocument
  296. }
  297. var body: some View {
  298. GeometryReader { geo in
  299. ZStack(alignment: .top) {
  300. List {
  301. Section(header: Text(NSLocalizedString("_file_creation_", comment: ""))) {
  302. HStack {
  303. Label {
  304. if NCUtilityFileSystem.shared.getHomeServer(urlBase: uploadScanDocument.userBaseUrl.urlBase, userId: uploadScanDocument.userBaseUrl.userId) == uploadScanDocument.serverUrl {
  305. Text("/")
  306. .frame(maxWidth: .infinity, alignment: .trailing)
  307. } else {
  308. Text((uploadScanDocument.serverUrl as NSString).lastPathComponent)
  309. .frame(maxWidth: .infinity, alignment: .trailing)
  310. }
  311. } icon: {
  312. Image("folder")
  313. .renderingMode(.template)
  314. .resizable()
  315. .scaledToFit()
  316. .foregroundColor(Color(NCBrandColor.shared.brand))
  317. }
  318. }
  319. .contentShape(Rectangle())
  320. .onTapGesture {
  321. isPresentedSelect = true
  322. }
  323. .complexModifier { view in
  324. if #available(iOS 16, *) {
  325. view.alignmentGuide(.listRowSeparatorLeading) { _ in
  326. return 0
  327. }
  328. }
  329. }
  330. HStack {
  331. Text(NSLocalizedString("_filename_", comment: ""))
  332. TextField(NSLocalizedString("_enter_filename_", comment: ""), text: $fileName)
  333. .multilineTextAlignment(.trailing)
  334. }
  335. HStack {
  336. Group {
  337. Text(NSLocalizedString("_password_", comment: ""))
  338. if isSecuredPassword {
  339. SecureField(NSLocalizedString("_enter_password_", comment: ""), text: $password)
  340. .multilineTextAlignment(.trailing)
  341. } else {
  342. TextField(NSLocalizedString("_enter_password_", comment: ""), text: $password)
  343. .multilineTextAlignment(.trailing)
  344. }
  345. }
  346. Button(action: {
  347. isSecuredPassword.toggle()
  348. }) {
  349. Image(systemName: self.isSecuredPassword ? "eye.slash" : "eye")
  350. .accentColor(.gray)
  351. }
  352. }
  353. HStack {
  354. Toggle(NSLocalizedString("_text_recognition_", comment: ""), isOn: $isTextRecognition)
  355. .toggleStyle(SwitchToggleStyle(tint: Color(NCBrandColor.shared.brand)))
  356. .onChange(of: isTextRecognition) { newValue in
  357. CCUtility.setTextRecognitionStatus(newValue)
  358. }
  359. }
  360. }
  361. VStack(spacing: 20) {
  362. Toggle(NSLocalizedString("_delete_all_scanned_images_", comment: ""), isOn: $removeAllFiles)
  363. .toggleStyle(SwitchToggleStyle(tint: Color(NCBrandColor.shared.brand)))
  364. .onChange(of: removeAllFiles) { newValue in
  365. CCUtility.setDeleteAllScanImages(newValue)
  366. }
  367. Button(NSLocalizedString("_save_", comment: "")) {
  368. uploadScanDocument.showHUD.toggle()
  369. uploadScanDocument.save(fileName: fileName, password: password, isTextRecognition: isTextRecognition, removeAllFiles: removeAllFiles, quality: quality) { openConflictViewController in
  370. uploadScanDocument.showHUD.toggle()
  371. if openConflictViewController {
  372. isPresentedUploadConflict = true
  373. } else {
  374. NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDismissScanDocument)
  375. }
  376. }
  377. }
  378. .buttonStyle(ButtonUploadScanDocumenStyle(disabled: fileName.isEmpty))
  379. }
  380. Section(header: Text(NSLocalizedString("_quality_image_title_", comment: ""))) {
  381. VStack {
  382. Slider(value: $quality, in: 0...4, step: 1, onEditingChanged: { touch in
  383. if !touch {
  384. CCUtility.setQualityScanDocument(quality)
  385. }
  386. })
  387. .accentColor(Color(NCBrandColor.shared.brand))
  388. }
  389. PDFKitRepresentedView(quality: $quality, isTextRecognition: $isTextRecognition, uploadScanDocument: uploadScanDocument)
  390. .frame(maxWidth: .infinity, minHeight: geo.size.height / 2)
  391. }
  392. .complexModifier { view in
  393. if #available(iOS 15, *) {
  394. view.listRowSeparator(.hidden)
  395. }
  396. }
  397. }
  398. HUDView(showHUD: $uploadScanDocument.showHUD, textLabel: NSLocalizedString("_wait_", comment: ""), image: "doc.badge.arrow.up")
  399. .offset(y: uploadScanDocument.showHUD ? 0 : -200)
  400. .animation(.easeOut)
  401. }
  402. }
  403. .background(Color(UIColor.systemGroupedBackground))
  404. .sheet(isPresented: $isPresentedSelect) {
  405. NCSelectRepresentedView(uploadScanDocument: uploadScanDocument)
  406. }
  407. .sheet(isPresented: $isPresentedUploadConflict) {
  408. NCUploadConflictRepresentedView(uploadScanDocument: uploadScanDocument)
  409. }.onTapGesture {
  410. dismissKeyboard()
  411. }
  412. }
  413. func dismissKeyboard() {
  414. UIApplication.shared.windows.filter { $0.isKeyWindow }.first?.endEditing(true)
  415. }
  416. }
  417. struct ButtonUploadScanDocumenStyle: ButtonStyle {
  418. var disabled = false
  419. func makeBody(configuration: Configuration) -> some View {
  420. configuration.label
  421. .padding(.horizontal, 40)
  422. .padding(.vertical, 10)
  423. .background(disabled ? Color(UIColor.systemGray4) : Color(NCBrandColor.shared.brand))
  424. .foregroundColor(.white)
  425. .clipShape(Capsule())
  426. }
  427. }
  428. // MARK: - UIViewControllerRepresentable
  429. struct NCSelectRepresentedView: UIViewControllerRepresentable {
  430. typealias UIViewControllerType = UINavigationController
  431. @ObservedObject var uploadScanDocument: NCUploadScanDocument
  432. func makeUIViewController(context: Context) -> UINavigationController {
  433. let storyboard = UIStoryboard(name: "NCSelect", bundle: nil)
  434. let navigationController = storyboard.instantiateInitialViewController() as? UINavigationController
  435. let viewController = navigationController?.topViewController as? NCSelect
  436. viewController?.delegate = uploadScanDocument
  437. viewController?.typeOfCommandView = .selectCreateFolder
  438. viewController?.includeDirectoryE2EEncryption = true
  439. return navigationController!
  440. }
  441. func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {
  442. }
  443. }
  444. struct NCUploadConflictRepresentedView: UIViewControllerRepresentable {
  445. typealias UIViewControllerType = NCCreateFormUploadConflict
  446. @ObservedObject var uploadScanDocument: NCUploadScanDocument
  447. func makeUIViewController(context: Context) -> NCCreateFormUploadConflict {
  448. let storyboard = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil)
  449. let viewController = storyboard.instantiateInitialViewController() as? NCCreateFormUploadConflict
  450. viewController?.delegate = uploadScanDocument
  451. viewController?.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "")
  452. viewController?.serverUrl = uploadScanDocument.serverUrl
  453. viewController?.metadatasUploadInConflict = [uploadScanDocument.metadata]
  454. return viewController!
  455. }
  456. func updateUIViewController(_ uiViewController: NCCreateFormUploadConflict, context: Context) {
  457. }
  458. }
  459. struct PDFKitRepresentedView: UIViewRepresentable {
  460. typealias UIView = PDFView
  461. @Binding var quality: Double
  462. @Binding var isTextRecognition: Bool
  463. @ObservedObject var uploadScanDocument: NCUploadScanDocument
  464. func makeUIView(context: UIViewRepresentableContext<PDFKitRepresentedView>) -> PDFKitRepresentedView.UIViewType {
  465. let pdfView = PDFView()
  466. pdfView.autoScales = true
  467. pdfView.backgroundColor = .clear
  468. pdfView.displayMode = .singlePage
  469. pdfView.displayDirection = .vertical
  470. return pdfView
  471. }
  472. func updateUIView(_ uiView: UIView, context: UIViewRepresentableContext<PDFKitRepresentedView>) {
  473. uploadScanDocument.createPDFPreview(quality: quality, isTextRecognition: isTextRecognition) { data in
  474. uiView.document = PDFDocument(data: data)
  475. uiView.autoScales = true
  476. }
  477. }
  478. }
  479. // MARK: - Preview
  480. struct UploadScanDocumentView_Previews: PreviewProvider {
  481. static var previews: some View {
  482. if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
  483. let uploadScanDocument = NCUploadScanDocument(images: [], userBaseUrl: appDelegate, serverUrl: "ABCD")
  484. UploadScanDocumentView(uploadScanDocument)
  485. }
  486. }
  487. }