@@ -141,47 +141,44 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
141141
142142 var section : XLFormSectionDescriptor
143143 var row : XLFormRowDescriptor
144-
144+
145145 // Section: Destination Folder
146146
147- section = XLFormSectionDescriptor . formSection ( withTitle: NSLocalizedString ( " _save_path_ " , comment: " " ) )
147+ section = XLFormSectionDescriptor . formSection ( withTitle: NSLocalizedString ( " _save_path_ " , comment: " " ) . uppercased ( ) )
148+ section. footerTitle = " "
148149 form. addFormSection ( section)
149-
150- XLFormViewController . cellClassesForRowDescriptorTypes ( ) [ " NMCScamFileNameCustomInputField " ] = FileNameInputTextField . self
151- row = XLFormRowDescriptor ( tag: " fileName " , rowType: " NMCScamFileNameCustomInputField " , title: NSLocalizedString ( " _filename_ " , comment: " " ) )
152- row. cellClass = FileNameInputTextField . self
153- row. cellConfig [ " fileNameInputTextField.placeholder " ] = self . fileName
154-
155- row. cellConfig [ " fileNameInputTextField.textAlignment " ] = NSTextAlignment . left. rawValue
156- row. cellConfig [ " fileNameInputTextField.font " ] = UIFont . systemFont ( ofSize: 15.0 )
157- row. cellConfig [ " fileNameInputTextField.textColor " ] = NCBrandColor . shared. label
158-
159-
160- section. addFormRow ( row)
161- //FileName custom view END
162-
163- section = XLFormSectionDescriptor . formSection ( withTitle: NSLocalizedString ( " _location_ " , comment: " " ) )
164- form. addFormSection ( section)
165-
166- //Scan documnet folder path
167- XLFormViewController . cellClassesForRowDescriptorTypes ( ) [ " NMCScanFolderPathCustomCell " ] = ScanDocumentPathView . self
168- row = XLFormRowDescriptor ( tag: " ButtonDestinationFolder " , rowType: " NMCScanFolderPathCustomCell " , title: self . titleServerUrl)
150+
151+ XLFormViewController . cellClassesForRowDescriptorTypes ( ) [ " kNMCFolderCustomCellType " ] = FolderPathCustomCell . self
152+ row = XLFormRowDescriptor ( tag: " ButtonDestinationFolder " , rowType: " kNMCFolderCustomCellType " , title: self . titleServerUrl)
153+ row. cellConfig [ " backgroundColor " ] = UIColor . secondarySystemGroupedBackground
169154 row. action. formSelector = #selector( changeDestinationFolder ( _: ) )
170- row. cellConfig [ " backgroundColor " ] = cellBackgoundColor
171- row. cellConfig [ " folderImage.image " ] = UIImage ( named: " folder " ) ? . imageColor ( NCBrandColor . shared. customer)
155+ row. cellConfig [ " folderImage.image " ] = UIImage ( named: " folder_nmcloud " ) ? . image ( color: NCBrandColor . shared. brandElement, size: 25 )
172156 row. cellConfig [ " photoLabel.textAlignment " ] = NSTextAlignment . left. rawValue
173157 row. cellConfig [ " photoLabel.font " ] = UIFont . systemFont ( ofSize: 15.0 )
174- row. cellConfig [ " photoLabel.textColor " ] = NCBrandColor . shared . label
158+ row. cellConfig [ " photoLabel.textColor " ] = UIColor . label //photos
175159 if ( self . titleServerUrl == " / " ) {
176160 row. cellConfig [ " photoLabel.text " ] = NSLocalizedString ( " _prefix_upload_path_ " , comment: " " )
177161 } else {
178162 row. cellConfig [ " photoLabel.text " ] = self . titleServerUrl
179163 }
180164 row. cellConfig [ " textLabel.text " ] = " "
181-
182165 section. addFormRow ( row)
183- // END of Scan documnet folder path
166+
167+ // Section: File Name
168+
169+ XLFormViewController . cellClassesForRowDescriptorTypes ( ) [ " kMyAppCustomCellType " ] = TextTableViewCell . self
184170
171+ section = XLFormSectionDescriptor . formSection ( withTitle: NSLocalizedString ( " _filename_ " , comment: " " ) . uppercased ( ) )
172+ form. addFormSection ( section)
173+
174+ row = XLFormRowDescriptor ( tag: " fileName " , rowType: " kMyAppCustomCellType " , title: NSLocalizedString ( " _filename_ " , comment: " " ) )
175+ row. cellClass = TextTableViewCell . self
176+ row. cellConfigAtConfigure [ " backgroundColor " ] = UIColor . secondarySystemGroupedBackground;
177+ row. cellConfig [ " fileNameTextField.textAlignment " ] = NSTextAlignment . left. rawValue
178+ row. cellConfig [ " fileNameTextField.font " ] = UIFont . systemFont ( ofSize: 15.0 )
179+ row. cellConfig [ " fileNameTextField.textColor " ] = UIColor . label
180+ row. cellConfig [ " fileNameTextField.text " ] = self . fileName
181+ section. addFormRow ( row)
185182
186183 section = XLFormSectionDescriptor . formSection ( withTitle: NSLocalizedString ( " _save_with_text_recognition_ " , comment: " " ) )
187184 form. addFormSection ( section)
@@ -309,7 +306,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
309306 let fileNameNew = newValue as? String
310307
311308 if let fileNameNew = newValue as? String {
312- self . fileName = utility . removeForbiddenCharacters ( fileNameNew)
309+ self . fileName = FileAutoRenamer . rename ( fileNameNew, account : session . account )
313310 } else {
314311 self . fileName = " "
315312 }
@@ -456,7 +453,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
456453 var newFileName : String = " "
457454
458455 if fileName == nil || fileName == " " {
459- name = utilityFileSystem. createFileNameDate ( " scan " , ext: " pdf " )
456+ name = utilityFileSystem. createFileNameDate ( " scan " , ext: " pdf " )
460457 } else {
461458 name = fileName!
462459 }
@@ -717,8 +714,9 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
717714 metadataForUpload. session = NCNetworking . shared. sessionUploadBackground
718715 metadataForUpload. sessionSelector = NCGlobal . shared. selectorUploadFile
719716 metadataForUpload. status = NCGlobal . shared. metadataStatusWaitUpload
720-
717+
721718 if NCManageDatabase . shared. getMetadataConflict ( account: session. account, serverUrl: serverUrl, fileNameView: fileNameSave, nativeFormat: false ) != nil {
719+
722720
723721 guard let conflictViewController = UIStoryboard ( name: " NCCreateFormUploadConflict " , bundle: nil ) . instantiateInitialViewController ( ) as? NCCreateFormUploadConflict else { return }
724722 conflictViewController. textLabelDetailNewFile = NSLocalizedString ( " _now_ " , comment: " " )
@@ -771,7 +769,6 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
771769 }
772770 }
773771
774-
775772 let metadataForUpload = NCManageDatabase . shared. createMetadata ( fileName: fileNameSave, fileNameView: fileNameSave, ocId: UUID ( ) . uuidString, serverUrl: serverUrl, url: " " , contentType: " " , session: session, sceneIdentifier: self . appDelegate? . sceneIdentifier)
776773
777774 metadataForUpload. session = NCNetworking . shared. sessionUploadBackground
@@ -849,8 +846,9 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
849846 metadataForUpload. session = NCNetworking . shared. sessionUploadBackground
850847 metadataForUpload. sessionSelector = NCGlobal . shared. selectorUploadFile
851848 metadataForUpload. status = NCGlobal . shared. metadataStatusWaitUpload
852-
849+
853850 if NCManageDatabase . shared. getMetadataConflict ( account: session. account, serverUrl: serverUrl, fileNameView: fileNameSave, nativeFormat: false ) != nil {
851+
854852
855853 guard let conflictViewController = UIStoryboard ( name: " NCCreateFormUploadConflict " , bundle: nil ) . instantiateInitialViewController ( ) as? NCCreateFormUploadConflict else { return }
856854 conflictViewController. textLabelDetailNewFile = NSLocalizedString ( " _now_ " , comment: " " )
@@ -1060,6 +1058,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
10601058 // let image = changeCompressionImage(self.arrayImages[0])
10611059 guard let data = image. jpegData ( compressionQuality: CGFloat ( 0.5 ) ) else {
10621060 NCActivityIndicator . shared. stop ( )
1061+ contentPresenter. messageNotification ( " _error_ " , error: NKError ( errorCode: NCGlobal . shared. errorCreationFile, errorDescription: " _error_creation_file_ " ) , delay: NCGlobal . shared. dismissAfterSecond, type: NCContentPresenter . messageType. info)
10631062 contentPresenter. messageNotification ( " _error_ " , error: NKError ( errorCode: NCGlobal . shared. errorCreationFile, errorDescription: NSLocalizedString ( " _error_creation_file_ " , comment: " " ) ) , delay: NCGlobal . shared. dismissAfterSecond, type: NCContentPresenter . messageType. info)
10641063 return
10651064 }
@@ -1068,6 +1067,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
10681067 try data. write ( to: fileUrl, options: . atomic)
10691068 } catch {
10701069 NCActivityIndicator . shared. stop ( )
1070+ contentPresenter. messageNotification ( " _error_ " , error: NKError ( errorCode: NCGlobal . shared. errorCreationFile, errorDescription: " _error_creation_file_ " ) , delay: NCGlobal . shared. dismissAfterSecond, type: NCContentPresenter . messageType. info)
10711071 contentPresenter. messageNotification ( " _error_ " , error: NKError ( errorCode: NCGlobal . shared. errorCreationFile, errorDescription: NSLocalizedString ( " _error_creation_file_ " , comment: " " ) ) , delay: NCGlobal . shared. dismissAfterSecond, type: NCContentPresenter . messageType. info)
10721072 return
10731073 }
@@ -1084,6 +1084,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
10841084 // let image = changeCompressionImage(self.arrayImages[0])
10851085 guard let data = image. jpegData ( compressionQuality: CGFloat ( 0.5 ) ) else {
10861086 NCActivityIndicator . shared. stop ( )
1087+ contentPresenter. messageNotification ( " _error_ " , error: NKError ( errorCode: NCGlobal . shared. errorCreationFile, errorDescription: " _error_creation_file_ " ) , delay: NCGlobal . shared. dismissAfterSecond, type: NCContentPresenter . messageType. info)
10871088 contentPresenter. messageNotification ( " _error_ " , error: NKError ( errorCode: NCGlobal . shared. errorCreationFile, errorDescription: NSLocalizedString ( " _error_creation_file_ " , comment: " " ) ) , delay: NCGlobal . shared. dismissAfterSecond, type: NCContentPresenter . messageType. info)
10881089 return
10891090 }
@@ -1092,6 +1093,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
10921093 try data. write ( to: NSURL . fileURL ( withPath: fileNameGenerateExport) , options: . atomic)
10931094 } catch {
10941095 NCActivityIndicator . shared. stop ( )
1096+ contentPresenter. messageNotification ( " _error_ " , error: NKError ( errorCode: NCGlobal . shared. errorCreationFile, errorDescription: " _error_creation_file_ " ) , delay: NCGlobal . shared. dismissAfterSecond, type: NCContentPresenter . messageType. info)
10951097 contentPresenter. messageNotification ( " _error_ " , error: NKError ( errorCode: NCGlobal . shared. errorCreationFile, errorDescription: NSLocalizedString ( " _error_creation_file_ " , comment: " " ) ) , delay: NCGlobal . shared. dismissAfterSecond, type: NCContentPresenter . messageType. info)
10961098 return
10971099 }
@@ -1265,4 +1267,3 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
12651267 return nil
12661268 }
12671269}
1268-
0 commit comments