@regulaforensics/cordova-plugin-document-reader-api 6.9.0 → 7.1.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/README.md CHANGED
@@ -1,49 +1,19 @@
1
- # Regula Document Reader (Cordova)
1
+ # Regula Document Reader SDK for Cordova
2
+
2
3
  Regula Document Reader SDK allows you to read various kinds of identification documents, passports, driving licenses, ID cards, etc. All processing is performed completely _**offline**_ on your device. No any data leaving your device.
3
4
 
4
5
  You can use native camera to scan the documents or image from gallery for extract all data from it.
5
6
 
6
7
  This repository contains the source code of the Document Reader API, and the sample application that demonstrates the _**API**_ calls you can use to interact with the Document Reader library.
7
8
 
8
- # Contents
9
- * [How to build demo application](#how-to-build-demo-application)
10
- * [Troubleshooting license issues](#troubleshooting-license-issues)
11
- * [Documentation](#documentation)
12
- * [Additional information](#additional-information)
13
-
14
- ## How to build the demo application
15
- 1. Visit [client.regulaforensics.com](https://client.regulaforensics.com) to get a trial license (`regula.license` file). The license creation wizard will guide you through the necessary steps.
16
- 2. Download or clone current repository using the command `git clone https://github.com/regulaforensics/DocumentReader-Cordova-Plugin.git`.
17
- 3. Run the following commands in Terminal:
18
- ```bash
19
- $ cd example
20
- $ npm install
21
- $ npx jetify
22
- $ cordova prepare
23
- ```
24
-
25
- 4. Copy the `regula.license` file to the `example/www` folder.
26
- 6. Android:
27
- * Run `cordova run android` inside `example` folder - this is just one way to run the app. You can also run it directly from within Android Studio.
28
-
29
- **Note**: if the gallery doesn't open, check if the following line is presented in the AndroidManifest.xml inside the `application` tag:
30
- `<activity android:label="@string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity" android:theme="@android:style/Theme.Holo.Light" />`
31
-
32
- 7. iOS:
33
- * Run `cordova run ios` inside `example` folder - this is just one way to run the app. You can also run it directly from within Xcode.
34
-
35
- ### Troubleshooting license issues
36
- If you have issues with license verification when running the application, please verify that next is true:
37
- 1. The OS, which you use, is specified in the license (e.g., Android and/or iOS).
38
- 3. The license is valid (not expired).
39
- 4. The date and time on the device, where you run the application, are valid.
40
- 5. You use the latest release version of the Document Reader SDK.
41
- 6. You placed the `license` into the correct folder as described [here](#how-to-build-demo-application).
42
-
43
9
  ## Documentation
44
- You can find documentation on API [here](https://docs.regulaforensics.com/develop/doc-reader-sdk/mobile/cordova).
45
10
 
46
- ## Additional information
47
- If you have any technical questions, feel free to [contact](mailto:cordova.support@regulaforensics.com) us or create issue [here](https://github.com/regulaforensics/DocumentReader-Cordova-Plugin/issues).
11
+ You can find documentation [here](https://docs.regulaforensics.com/develop/doc-reader-sdk/mobile/cordova).
12
+
13
+ ## License
14
+
15
+ To obtaining the production license or other purchasing information, please [submit an inquiry](https://regulaforensics.com/talk-to-an-expert) and our sales team will contact you shortly.
16
+
17
+ ## Support
48
18
 
49
- To use our SDK in your own app you need to [purchase](https://pipedrivewebforms.com/form/394a3706041290a04fbd0d18e7d7810f1841159) a commercial license.
19
+ Please do not hesitate to [contact us](https://support.regulaforensics.com/hc/requests/new), if you need any assistance or want to report a bug / suggest an improvement.
@@ -0,0 +1,32 @@
1
+ # How to build the demo application
2
+
3
+ 1. Get the trial license at [client.regulaforensics.com](https://client.regulaforensics.com/) (`regula.license` file). The license creation wizard will guide you through the necessary steps.
4
+ 2. Get the trial database at [client.regulaforensics.com/customer/databases](https://client.regulaforensics.com/customer/databases) (`db.dat`)
5
+ 3. Download or clone current repository using the command `git clone https://github.com/regulaforensics/DocumentReader-Cordova-Plugin.git`.
6
+ 4. Copy the `regula.license` file to the `example/www/` folder.
7
+ 5. Copy the `db.dat` file to the `example/www/` folder.
8
+ 6. Run the following commands in Terminal:
9
+ ```bash
10
+ $ cd example
11
+ $ npm install
12
+ $ npx jetify
13
+ $ cordova prepare
14
+ ```
15
+
16
+ 7. Android:
17
+ * Run `cordova run android` inside `example` folder - this is just one way to run the app. You can also run it directly from within Android Studio.
18
+
19
+ **Note**: if the gallery doesn't open, check if the following line is presented in the AndroidManifest.xml inside the `application` tag:
20
+ `<activity android:label="@string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity" android:theme="@android:style/Theme.Holo.Light" />`
21
+
22
+ 8. iOS:
23
+ * Run `cordova run ios` inside `example` folder - this is just one way to run the app. You can also run it directly from within Xcode.
24
+
25
+ # Troubleshooting license issues
26
+
27
+ If you have issues with license verification when running the application, please verify that next is true:
28
+ 1. The OS, which you use, is specified in the license (e.g., Android and/or iOS).
29
+ 3. The license is valid (not expired).
30
+ 4. The date and time on the device, where you run the application, are valid.
31
+ 5. You use the latest release version of the Document Reader SDK.
32
+ 6. You placed the `license` into the correct folder as described [here](#how-to-build-demo-application).
@@ -16,6 +16,7 @@
16
16
  <allow-intent href="mailto:*" />
17
17
  <allow-intent href="geo:*" />
18
18
  <platform name="android">
19
+ <resource-file src="www/db.dat" target="app/src/main/assets/Regula/db.dat"/>
19
20
  <preference name="android-minSdkVersion" value="23" />
20
21
  <preference name="android-targetSdkVersion" value="34" />
21
22
  <allow-intent href="market:*" />
@@ -27,12 +28,15 @@
27
28
  </config-file>
28
29
  </platform>
29
30
  <platform name="ios">
31
+ <resource-file src="www/db.dat" />
30
32
  <allow-intent href="itms:*" />
31
33
  <allow-intent href="itms-apps:*" />
32
- <preference name="CAMERA_USAGE_DESCRIPTION" default=" " />
33
34
  <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
34
35
  <string>To use camera</string>
35
36
  </config-file>
37
+ <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
38
+ <string>To pick images</string>
39
+ </config-file>
36
40
  <config-file target="*-Info.plist" parent="NFCReaderUsageDescription">
37
41
  <string>To use NFC</string>
38
42
  </config-file>
@@ -13,25 +13,22 @@
13
13
  "author": "Regula Forensics Inc.",
14
14
  "license": "commercial",
15
15
  "dependencies": {
16
- "@regulaforensics/cordova-plugin-document-reader-api": "6.9.0",
17
- "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "6.9.0",
18
- "cordova-android": "12.0.0",
19
- "cordova-ios": "7.0.0",
16
+ "@regulaforensics/cordova-plugin-document-reader-api": "7.1.0",
17
+ "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": "7.1.0",
18
+ "cordova-android": "12.0.1",
19
+ "cordova-ios": "7.0.1",
20
20
  "cordova-plugin-add-swift-support": "2.0.2",
21
21
  "cordova-plugin-advanced-http": "3.3.1",
22
- "cordova-plugin-android-permissions": "1.1.5",
22
+ "cordova-plugin-camera": "7.0.0",
23
23
  "cordova-plugin-file": "8.0.0",
24
24
  "jetifier": "2.0.0"
25
25
  },
26
26
  "cordova": {
27
27
  "plugins": {
28
- "@regulaforensics/cordova-plugin-document-reader-api": {
29
- "CAMERA_USAGE_DESCRIPTION": "To take photo",
30
- "READ_EXTERNAL_STORAGE": "To choose photo"
31
- },
28
+ "@regulaforensics/cordova-plugin-document-reader-api": {},
32
29
  "@regulaforensics/cordova-plugin-document-reader-core-fullrfid": {},
33
30
  "cordova-plugin-file": {},
34
- "cordova-plugin-android-permissions": {},
31
+ "cordova-plugin-camera": {},
35
32
  "cordova-plugin-advanced-http": {}
36
33
  },
37
34
  "platforms": [
@@ -4,6 +4,15 @@ var app = {
4
4
  },
5
5
 
6
6
  onDeviceReady: function () {
7
+ function onInitialized() {
8
+ document.getElementById("status").innerHTML = "Ready"
9
+ document.getElementById("status").style.backgroundColor = "green"
10
+
11
+ DocumentReader.setFunctionality({
12
+ showCaptureButton: true
13
+ }, function (s) { }, function (e) { })
14
+ }
15
+
7
16
  this.receivedEvent('deviceready')
8
17
  document.getElementById("status").innerHTML = "loading......"
9
18
  document.getElementById("status").style.backgroundColor = "grey"
@@ -12,10 +21,12 @@ var app = {
12
21
  // This way you can import any class declared in DocumentReaderPlugin
13
22
  var DocumentReader = DocumentReaderPlugin.DocumentReader
14
23
  var DocumentReaderResults = DocumentReaderPlugin.DocumentReaderResults
24
+ var DocumentReaderNotification = DocumentReaderPlugin.DocumentReaderNotification
15
25
  var DocumentReaderScenario = DocumentReaderPlugin.DocumentReaderScenario
16
26
  var DocumentReaderCompletion = DocumentReaderPlugin.DocumentReaderCompletion
17
27
  var ScannerConfig = DocumentReaderPlugin.ScannerConfig
18
28
  var RecognizeConfig = DocumentReaderPlugin.RecognizeConfig
29
+ var DocReaderConfig = DocumentReaderPlugin.DocReaderConfig
19
30
  var Enum = DocumentReaderPlugin.Enum
20
31
 
21
32
  var selectedScenario = "Mrz"
@@ -34,7 +45,7 @@ var app = {
34
45
  document.getElementById("rfidUIHeader").style.color = rfidUIHeaderColor
35
46
  document.getElementById("rfidDescription").innerHTML = rfidDescription
36
47
  document.getElementById("rfidProgress").value = rfidProgress
37
- document.getElementById("cancelButton").addEventListener("click", stopRfid)
48
+ document.getElementById("cancelButton").addEventListener("click", hideRfidUI)
38
49
 
39
50
  function postInitialize(scenarios, canRfid) {
40
51
  for (var index in scenarios) {
@@ -78,58 +89,42 @@ var app = {
78
89
  }, function (e) { })
79
90
  }
80
91
 
81
- function recognizeAndroid() {
82
- var permissions = cordova.plugins.permissions
83
- permissions.checkPermission(permissions.READ_EXTERNAL_STORAGE, function (status) {
84
- if (status.hasPermission)
85
- recognize()
86
- else {
87
- permissions.requestPermission(permissions.READ_EXTERNAL_STORAGE, function success(status) {
88
- if (status.hasPermission)
89
- recognize()
90
- }, function error() {
91
- console.warn('READ_EXTERNAL_STORAGE permission denied')
92
- })
93
- }
92
+ function recognize() {
93
+ navigator.camera.getPicture(function (result) {
94
+ document.getElementById("status").innerHTML = "processing image......"
95
+ document.getElementById("status").style.backgroundColor = "grey"
96
+ var config = new RecognizeConfig()
97
+ config.scenario = selectedScenario
98
+ config.image = result
99
+ DocumentReader.recognize(config, function (m) {
100
+ handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m)))
101
+ }, function (e) { })
102
+ }, function (e) { }, {
103
+ destinationType: Camera.DestinationType.DATA_URL,
104
+ sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
105
+ mediaType: Camera.MediaType.PICTURE
94
106
  })
95
107
  }
96
108
 
97
- function stopRfid() {
98
- hideRfidUI()
99
- DocumentReader.stopRFIDReader(function (e) { }, function (e) { })
109
+ function handleCompletion(completion) {
110
+ if (isReadingRfidCustomUi) {
111
+ if (completion.action == Enum.DocReaderAction.ERROR) restartRfidUI()
112
+ if (actionSuccess(completion.action) || actionError(completion.action)) {
113
+ hideRfidUI()
114
+ displayResults(completion.results)
115
+ }
116
+ } else if (actionSuccess(completion.action))
117
+ handleResults(completion.results)
100
118
  }
101
119
 
102
- function recognize() {
103
- // window.imagePicker.getPictures(function (images) {
104
- // document.getElementById("status").innerHTML = "processing image......"
105
- // document.getElementById("status").style.backgroundColor = "grey"
106
- // var config = new RecognizeConfig()
107
- // config.scenario = selectedScenario
108
- // config.images = images
109
- // DocumentReader.recognize(config, function (m) {
110
- // handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m)))
111
- // }, function (e) { })
112
- // }, function (e) { }, { maximumImagesCount: 10, outputType: window.imagePicker.OutputType.BASE64_STRING })
120
+ function actionSuccess(action) {
121
+ if (action == Enum.DocReaderAction.COMPLETE || action == Enum.DocReaderAction.TIMEOUT) return true
122
+ return false
113
123
  }
114
124
 
115
- function handleCompletion(completion) {
116
- console.log("DocReaderAction: " + completion.action)
117
- if (isReadingRfidCustomUi && (completion.action === Enum.DocReaderAction.CANCEL || completion.action === Enum.DocReaderAction.ERROR))
118
- hideRfidUI()
119
- if (isReadingRfidCustomUi && completion.action === Enum.DocReaderAction.NOTIFICATION)
120
- updateRfidUI(completion.results.documentReaderNotification)
121
- if (completion.action === Enum.DocReaderAction.COMPLETE)
122
- if (isReadingRfidCustomUi)
123
- if (completion.results.rfidResult !== 1)
124
- restartRfidUI()
125
- else {
126
- hideRfidUI()
127
- displayResults(completion.results)
128
- }
129
- else
130
- handleResults(completion.results)
131
- if (completion.action === Enum.DocReaderAction.TIMEOUT)
132
- handleResults(completion.results)
125
+ function actionError(action) {
126
+ if (action == Enum.DocReaderAction.CANCEL || action == Enum.DocReaderAction.ERROR) return true
127
+ return false
133
128
  }
134
129
 
135
130
  function showRfidUI() {
@@ -141,78 +136,56 @@ var app = {
141
136
 
142
137
  function hideRfidUI() {
143
138
  // show animation
139
+ DocumentReader.stopRFIDReader(function (s) { }, function (e) { });
144
140
  restartRfidUI()
145
141
  isReadingRfidCustomUi = false
146
142
  document.getElementById("rfidUI").style.display = isReadingRfidCustomUi ? "" : "none"
147
143
  document.getElementById("mainUI").style.display = !isReadingRfidCustomUi ? "" : "none"
148
- rfidUIHeader = "Reading RFID"
149
- document.getElementById("rfidUIHeader").innerHTML = rfidUIHeader
150
- rfidUIHeaderColor = "black"
151
- document.getElementById("rfidUIHeader").style.color = rfidUIHeaderColor
144
+ document.getElementById("rfidUIHeader").innerHTML = "Reading RFID"
145
+ document.getElementById("rfidUIHeader").style.color = "black"
152
146
  }
153
147
 
154
148
  function restartRfidUI() {
155
- rfidUIHeaderColor = "red"
156
- document.getElementById("rfidUIHeader").style.color = rfidUIHeaderColor
157
- rfidUIHeader = "Failed!"
158
- document.getElementById("rfidUIHeader").innerHTML = rfidUIHeader
159
- rfidDescription = "Place your phone on top of the NFC tag"
160
- document.getElementById("rfidDescription").innerHTML = rfidDescription
161
- rfidProgress = -1
162
- document.getElementById("rfidProgress").value = rfidProgress
149
+ document.getElementById("rfidUIHeader").style.color = "red"
150
+ document.getElementById("rfidUIHeader").innerHTML = "Failed!"
151
+ document.getElementById("rfidDescription").innerHTML = "Place your phone on top of the NFC tag"
152
+ document.getElementById("rfidProgress").value = -1
163
153
  }
164
154
 
165
- function updateRfidUI(results) {
166
- if (results.value == null) return
167
- if (results.notificationCode === Enum.eRFID_NotificationCodes.RFID_NOTIFICATION_PCSC_READING_DATAGROUP) {
168
- rfidDescription = Enum.eRFID_DataFile_Type.getTranslation(results.dataFileType)
155
+ function updateRfidUI(notification) {
156
+ if (notification.notificationCode === Enum.eRFID_NotificationCodes.RFID_NOTIFICATION_PCSC_READING_DATAGROUP) {
157
+ rfidDescription = "ERFIDDataFileType: " + notification.dataFileType
169
158
  document.getElementById("rfidDescription").innerHTML = rfidDescription
170
159
  }
171
- rfidUIHeader = "Reading RFID"
172
- document.getElementById("rfidUIHeader").innerHTML = rfidUIHeader
173
- rfidUIHeaderColor = "black"
174
- document.getElementById("rfidUIHeader").style.color = rfidUIHeaderColor
175
- rfidProgress = results.progress
176
- document.getElementById("rfidProgress").value = rfidProgress
177
- if (window.cordova.platformId === 'ios')
178
- DocumentReader.setRfidSessionStatus(rfidDescription + "\n" + results.progress + "%", function (e) { }, function (e) { })
160
+ document.getElementById("rfidUIHeader").innerHTML = "Reading RFID"
161
+ document.getElementById("rfidUIHeader").style.color = "black"
162
+ if (notification.progress != null)
163
+ document.getElementById("rfidProgress").value = notification.progress
179
164
  }
180
165
 
181
166
  function customRFID() {
182
167
  showRfidUI()
183
- DocumentReader.readRFID(function (m) { handleRfidCompletion(m) }, function (e) { })
168
+ DocumentReader.readRFID(false, false, false, function (m) { handleRfidCompletion(m) }, function (e) { })
184
169
  }
185
170
 
186
171
  function usualRFID() {
187
172
  isReadingRfid = true
188
- DocumentReader.startRFIDReader(function (m) { handleRfidCompletion(m) }, function (e) { })
173
+ DocumentReader.startRFIDReader(false, false, false, function (m) { handleRfidCompletion(m) }, function (e) { })
189
174
  }
190
175
 
191
176
  function handleRfidCompletion(raw) {
192
- var notification = "rfidNotificationCompletionEvent"
193
- var paCert = "paCertificateCompletionEvent"
194
- var taCert = "taCertificateCompletionEvent"
195
- var taSig = "taSignatureCompletionEvent"
196
- if (raw.substring(0, notification.length) === notification) {
197
- raw = raw.substring(notification.length, raw.length)
198
- console.log(notification + ": " + raw)
199
- } else if (raw.substring(0, paCert.length) === paCert) {
200
- raw = raw.substring(paCert.length, raw.length)
201
- console.log(paCert + ": " + raw)
202
- } else if (raw.substring(0, taCert.length) === taCert) {
203
- raw = raw.substring(taCert.length, raw.length)
204
- console.log(taCert + ": " + raw)
205
- } else if (raw.substring(0, taSig.length) === taSig) {
206
- raw = raw.substring(taSig.length, raw.length)
207
- console.log(taSig + ": " + raw)
177
+ var id = "rfidOnProgressCompletion"
178
+ if (raw.substring(0, id.length) === id) {
179
+ raw = raw.substring(id.length, raw.length)
180
+ updateRfidUI(DocumentReaderNotification.fromJson(JSON.parse(raw)))
208
181
  } else
209
182
  handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(raw)))
210
183
  }
211
184
 
212
185
  function handleResults(results) {
213
186
  clearResults()
214
- if (doRfid && !isReadingRfid && results != null && results.chipPage != 0) {
215
- //customRFID()
187
+ if (doRfid && !isReadingRfid && results != null) {
188
+ // customRFID()
216
189
  usualRFID()
217
190
  } else {
218
191
  isReadingRfid = false
@@ -253,7 +226,6 @@ var app = {
253
226
  DocumentReader.textFieldValueByType(results, Enum.eVisualFieldType.FT_SURNAME_AND_GIVEN_NAMES, function (value) {
254
227
  document.getElementById("status").style.backgroundColor = "green"
255
228
  document.getElementById("status").innerHTML = value
256
- this.setState({ fullName: value })
257
229
  }, function (error) { console.log(error) })
258
230
 
259
231
  DocumentReader.graphicFieldImageByType(results, Enum.eGraphicFieldType.GF_DOCUMENT_IMAGE, function (value) {
@@ -273,33 +245,6 @@ var app = {
273
245
  document.getElementById("portraitImage").src = "img/portrait.png"
274
246
  }
275
247
 
276
- function addCertificates() {
277
- window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "www/certificates/", function (fileSystem) {
278
- fileSystem.createReader().readEntries(function (entries) {
279
- for (var i in entries) {
280
- var item = entries[i]
281
- if (item.isFile) {
282
- var findExt = item.name.split('.')
283
- var pkdResourceType = 0
284
- if (findExt.length > 0)
285
- pkdResourceType = Enum.PKDResourceType.getType(findExt[findExt.length - 1].toLowerCase())
286
- readFile("www/certificates/" + item.name, function (file, resType) {
287
- resType = resType[0]
288
- var certificates = []
289
- certificates.push({
290
- 'binaryData': file,
291
- 'resourceType': resType
292
- })
293
- DocumentReader.addPKDCertificates(certificates, function (s) {
294
- console.log("certificate added")
295
- }, function (e) { console.log(e) })
296
- }, pkdResourceType)
297
- }
298
- }
299
- }, function (err) { console.log(err) })
300
- }, function (err) { console.log(err) })
301
- }
302
-
303
248
  function readFile(path, callback, ...items) {
304
249
  if (path.substring(0, 8) !== "file:///")
305
250
  path = cordova.file.applicationDirectory + path
@@ -315,48 +260,28 @@ var app = {
315
260
  }
316
261
 
317
262
  readFile("www/regula.license", function (license) {
318
- DocumentReader.prepareDatabase("Full", function (message) {
319
- if (message != "database prepared")
320
- document.getElementById("status").innerHTML = "Downloading database: " + message + "%"
321
- else {
322
- document.getElementById("status").innerHTML = "Loading......"
323
- DocumentReader.initializeReader({
324
- license: license,
325
- delayedNNLoad: true
326
- }, function (message) {
327
- document.getElementById("status").innerHTML = "Ready"
328
- document.getElementById("status").style.backgroundColor = "green"
329
- document.getElementById("showScannerButton").addEventListener("click", scan)
330
- if (window.cordova.platformId == "android")
331
- document.getElementById("showImagePicker").addEventListener("click", recognizeAndroid)
332
- if (window.cordova.platformId == "ios")
333
- document.getElementById("showImagePicker").addEventListener("click", recognize)
334
- DocumentReader.setConfig({
335
- functionality: {
336
- videoCaptureMotionControl: true,
337
- showCaptureButton: true
338
- },
339
- customization: {
340
- showResultStatusMessages: true,
341
- showStatusMessages: true
342
- },
343
- processParams: {
344
- scenario: "Mrz",
345
- doRfid: false,
346
- },
347
- }, function (m) { }, function (e) { })
348
- DocumentReader.getAvailableScenarios(function (s) {
349
- DocumentReader.isRFIDAvailableForUse(function (r) { postInitialize(JSON.parse(s), r) }, function (e) { })
350
- }, function (e) { })
351
- DocumentReader.setRfidDelegate(Enum.RFIDDelegate.NO_PA, function (r) { }, function (e) { })
352
- // addCertificates()
353
- }, function (error) {
354
- console.log(error)
355
- document.getElementById("status").innerHTML = error
356
- document.getElementById("status").style.backgroundColor = "red"
357
- })
263
+ var config = new DocReaderConfig()
264
+ config.license = license
265
+ config.delayedNNLoad = true
266
+ DocumentReader.initializeReader(config, function (message) {
267
+ callback = JSON.parse(message)
268
+ if (!callback.success) {
269
+ console.log("Init error: " + callback.error.message)
270
+ document.getElementById("status").innerHTML = "Init error: " + callback.error.message
271
+ return
358
272
  }
359
- }, function (e) { console.log(e) })
273
+ console.log("Init complete")
274
+ document.getElementById("showScannerButton").addEventListener("click", scan)
275
+ document.getElementById("showImagePicker").addEventListener("click", recognize)
276
+ DocumentReader.getAvailableScenarios(function (s) {
277
+ DocumentReader.getIsRFIDAvailableForUse(function (r) { postInitialize(JSON.parse(s), r) }, function (e) { })
278
+ }, function (e) { })
279
+ onInitialized()
280
+ }, function (error) {
281
+ console.log(error)
282
+ document.getElementById("status").innerHTML = error
283
+ document.getElementById("status").style.backgroundColor = "red"
284
+ })
360
285
  })
361
286
  },
362
287
 
@@ -370,4 +295,4 @@ var app = {
370
295
  },
371
296
  }
372
297
 
373
- app.initialize()
298
+ app.initialize()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regulaforensics/cordova-plugin-document-reader-api",
3
- "version": "6.9.0",
3
+ "version": "7.1.0",
4
4
  "description": "Cordova plugin for reading and validation of identification documents (API framework)",
5
5
  "cordova": {
6
6
  "id": "@regulaforensics/cordova-plugin-document-reader-api",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-document-reader-api" version="6.9.0"
2
+ <plugin id="cordova-plugin-document-reader-api" version="7.1.0"
3
3
  xmlns="http://apache.org/cordova/ns/plugins/1.0">
4
4
  <name>DocumentReaderApi</name>
5
5
  <description>Cordova plugin Document reader api</description>
@@ -20,13 +20,13 @@
20
20
  <source-file src="src/ios/RGLWDocumentReader.m" />
21
21
  <header-file src="src/ios/RGLWJSONConstructor.h" />
22
22
  <source-file src="src/ios/RGLWJSONConstructor.m" />
23
- <header-file src="src/ios/RGLWRegulaConfig.h" />
24
- <source-file src="src/ios/RGLWRegulaConfig.m" />
23
+ <header-file src="src/ios/RGLWConfig.h" />
24
+ <source-file src="src/ios/RGLWConfig.m" />
25
25
  <podspec>
26
26
  <config>
27
27
  </config>
28
28
  <pods>
29
- <pod name="DocumentReader" spec="6.9.3102" />
29
+ <pod name="DocumentReader" spec="7.1.3379" />
30
30
  </pods>
31
31
  </podspec>
32
32
  </platform>
@@ -38,10 +38,10 @@
38
38
  </feature>
39
39
  </config-file>
40
40
  <framework src="src/android/build.gradle" custom="true" type="gradleReference" />
41
- <source-file src="src/android/DocumentReader.java" target-dir="src/cordova.plugin.documentreader" />
42
- <source-file src="src/android/JSONConstructor.java" target-dir="src/cordova.plugin.documentreader" />
43
- <source-file src="src/android/RegulaConfig.java" target-dir="src/cordova.plugin.documentreader" />
44
- <source-file src="src/android/Helpers.java" target-dir="src/cordova.plugin.documentreader" />
41
+ <source-file src="src/android/DocumentReader.kt" target-dir="java/cordova.plugin.documentreader" />
42
+ <source-file src="src/android/JSONConstructor.kt" target-dir="java/cordova.plugin.documentreader" />
43
+ <source-file src="src/android/Config.kt" target-dir="java/cordova.plugin.documentreader" />
44
+ <source-file src="src/android/Utils.kt" target-dir="java/cordova.plugin.documentreader" />
45
45
  <source-file src="src/android/BluetoothUtil.kt" target-dir="java/cordova.plugin.documentreader" />
46
46
  </platform>
47
47
  </plugin>