@regulaforensics/ionic-native-document-reader 6.6.1 → 6.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/ionic-native-document-reader",
3
- "version": "6.6.1",
3
+ "version": "6.7.0",
4
4
  "description": "Ionic Native wrapper for cordova documentreader",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -16,9 +16,9 @@
16
16
  "@awesome-cordova-plugins/image-picker": "^5.36.0",
17
17
  "@ionic/react": "^6.0.0",
18
18
  "@ionic/react-router": "^6.0.0",
19
- "@regulaforensics/cordova-plugin-document-reader-api": "6.6.1",
20
- "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "6.6.0",
21
- "@regulaforensics/ionic-native-document-reader": "6.6.1",
19
+ "@regulaforensics/cordova-plugin-document-reader-api": "6.7.2",
20
+ "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "6.7.0",
21
+ "@regulaforensics/ionic-native-document-reader": "6.7.0",
22
22
  "@testing-library/jest-dom": "^5.11.9",
23
23
  "@testing-library/react": "^11.2.5",
24
24
  "@testing-library/user-event": "^12.6.3",
@@ -130,8 +130,6 @@ function handleCompletion(completion?: DocumentReaderCompletion) {
130
130
  handleResults(completion.results!)
131
131
  if (completion.action === Enum.DocReaderAction.TIMEOUT)
132
132
  handleResults(completion.results!)
133
- if (completion.action === Enum.DocReaderAction.CANCEL || completion.action === Enum.DocReaderAction.ERROR)
134
- isReadingRfid = false
135
133
  }
136
134
 
137
135
  function showRfidUI() {
@@ -159,7 +157,7 @@ function restartRfidUI() {
159
157
 
160
158
  function updateRfidUI(notification: DocumentReaderNotification) {
161
159
  if (notification.code === Enum.eRFID_NotificationCodes.RFID_NOTIFICATION_PCSC_READING_DATAGROUP)
162
- rfidDescription = Enum.eRFID_DataFile_Type.getTranslation(notification.attachment!)
160
+ rfidDescription = Enum.eRFID_DataFile_Type.getTranslation(notification.dataFileType!)
163
161
  rfidUIHeader = "Reading RFID"
164
162
  rfidUIHeaderColor = "black"
165
163
  rfidProgress = notification.value!
@@ -270,22 +268,22 @@ function handleResults(results: DocumentReaderResults) {
270
268
  }
271
269
 
272
270
  function displayResults(results: DocumentReaderResults) {
273
- if(results == null) return
271
+ if (results == null) return
274
272
 
275
- DocumentReader.getTextFieldValueByType(results, Enum.eVisualFieldType.FT_SURNAME_AND_GIVEN_NAMES).then((value: string | undefined) => {
276
- if(value != null){
273
+ DocumentReader.textFieldValueByType(results, Enum.eVisualFieldType.FT_SURNAME_AND_GIVEN_NAMES).then((value: string | undefined) => {
274
+ if (value != null) {
277
275
  status.innerHTML = value
278
276
  status.style.backgroundColor = "green"
279
277
  }
280
278
  })
281
279
 
282
- DocumentReader.getGraphicFieldImageByType(results, Enum.eGraphicFieldType.GF_DOCUMENT_IMAGE).then((value: string | undefined) => {
283
- if(value != null)
280
+ DocumentReader.graphicFieldImageByType(results, Enum.eGraphicFieldType.GF_DOCUMENT_IMAGE).then((value: string | undefined) => {
281
+ if (value != null)
284
282
  documentImage.src = "data:image/png;base64," + value
285
283
  })
286
284
 
287
- DocumentReader.getGraphicFieldImageByType(results, Enum.eGraphicFieldType.GF_PORTRAIT).then((value: string | undefined) => {
288
- if(value != null)
285
+ DocumentReader.graphicFieldImageByType(results, Enum.eGraphicFieldType.GF_PORTRAIT).then((value: string | undefined) => {
286
+ if (value != null)
289
287
  portraitImage.src = "data:image/png;base64," + value
290
288
  })
291
289
  }
@@ -311,7 +309,8 @@ function recognize() {
311
309
  File.readAsDataURL((isPlatform("ios") ? "file://" : "") + results[0].substring(0, (results[0] as string).lastIndexOf("/")), results[0].substring((results[0] as string).lastIndexOf("/") + 1)).then((file => {
312
310
  status.innerHTML = "processing image......"
313
311
  status.style.backgroundColor = "grey"
314
- DocumentReader.recognizeImage((file as string).substring(23)).subscribe((m: string) =>
312
+ let fileString = (file as string)
313
+ DocumentReader.recognizeImage(fileString.substring(fileString.indexOf(",") + 1)).subscribe((m: string) =>
315
314
  handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m))))
316
315
  })).catch(error2)
317
316
  }, error2)