@regulaforensics/document-reader 8.2.186-beta → 8.3.242-beta
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/RNDocumentReader.podspec +2 -2
- package/android/build.gradle +1 -1
- package/android/cordova.gradle +1 -1
- package/android/src/main/java/com/regula/plugin/documentreader/Config.kt +4 -0
- package/android/src/main/java/com/regula/plugin/documentreader/Main.kt +6 -0
- package/examples/capacitor/README.md +10 -0
- package/examples/capacitor/index.html +2 -7
- package/examples/capacitor/index.tsx +39 -0
- package/examples/capacitor/package.json +3 -3
- package/examples/capacitor/scripts/setup.sh +4 -0
- package/examples/capacitor/src/extra/bt_device.tsx +7 -6
- package/examples/capacitor/src/extra/custom_rfid.tsx +29 -42
- package/examples/capacitor/src/main.css +4 -1
- package/examples/capacitor/src/main.html +1 -4
- package/examples/capacitor/src/main.tsx +85 -86
- package/examples/cordova/README.md +10 -0
- package/examples/cordova/config.xml +6 -2
- package/examples/cordova/package-lock.json +459 -1
- package/examples/cordova/package.json +5 -4
- package/examples/cordova/scripts/bundle.sh +4 -0
- package/examples/cordova/www/bootstrap.js +30 -0
- package/examples/cordova/www/images/portrait.png +0 -0
- package/examples/cordova/www/index.html +2 -17
- package/examples/cordova/www/index.js +30 -0
- package/examples/cordova/www/src/extra/bt_device.js +32 -0
- package/examples/cordova/www/src/extra/custom_rfid.js +60 -0
- package/examples/cordova/www/src/main.css +11 -7
- package/examples/cordova/www/src/main.html +7 -32
- package/examples/cordova/www/src/main.js +154 -31
- package/examples/ionic/README.md +10 -0
- package/examples/ionic/config.xml +11 -4
- package/examples/ionic/index.ts +41 -4
- package/examples/ionic/package-lock.json +1862 -1638
- package/examples/ionic/package.json +3 -6
- package/examples/ionic/src/extra/bt_device.ts +33 -0
- package/examples/ionic/src/extra/custom_rfid.ts +61 -0
- package/examples/ionic/src/images/portrait.png +0 -0
- package/examples/ionic/src/main.css +11 -7
- package/examples/ionic/src/main.html +36 -61
- package/examples/ionic/src/main.ts +158 -50
- package/examples/react_native/README.md +10 -0
- package/examples/react_native/app.config.ts +3 -1
- package/examples/react_native/images/portrait.png +0 -0
- package/examples/react_native/index.tsx +34 -6
- package/examples/react_native/package-lock.json +476 -421
- package/examples/react_native/package.json +10 -10
- package/examples/react_native/src/extra/bt_device.tsx +34 -0
- package/examples/react_native/src/extra/custom_rfid.tsx +62 -0
- package/examples/react_native/src/main.css +11 -7
- package/examples/react_native/src/main.html +7 -32
- package/examples/react_native/src/main.tsx +152 -27
- package/ios/RGLWConfig.m +4 -0
- package/ios/RGLWMain.m +10 -0
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/www/capacitor/index.js +32 -16
- package/www/capacitor/params/customization/Customization.js +7 -0
- package/www/capacitor/params/process_params/ProcessParams.js +7 -0
- package/www/capacitor/results/visual_results/FieldType.js +3 -1
- package/www/cordova.js +49 -17
- package/www/react-native/index.js +32 -16
- package/www/react-native/internal/bridge.js +1 -1
- package/www/react-native/params/customization/Customization.js +7 -0
- package/www/react-native/params/process_params/ProcessParams.js +7 -0
- package/www/react-native/results/visual_results/FieldType.js +3 -1
- package/www/types/index.d.ts +14 -8
- package/www/types/params/customization/Customization.d.ts +5 -0
- package/www/types/params/process_params/ProcessParams.d.ts +4 -0
- package/www/types/results/visual_results/FieldType.d.ts +5 -1
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
"start": "expo start"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@regulaforensics/document-reader": "8.
|
|
12
|
-
"@regulaforensics/document-reader-core-fullauthrfid": "8.
|
|
13
|
-
"@regulaforensics/document-reader-btdevice": "8.
|
|
14
|
-
"react-native": "0.79.
|
|
11
|
+
"@regulaforensics/document-reader": "8.3.242-beta",
|
|
12
|
+
"@regulaforensics/document-reader-core-fullauthrfid": "8.3.9-beta",
|
|
13
|
+
"@regulaforensics/document-reader-btdevice": "8.3.10-beta",
|
|
14
|
+
"react-native": "0.79.5",
|
|
15
15
|
"react-native-fs": "2.20.0",
|
|
16
16
|
"react-native-image-picker": "8.2.1",
|
|
17
|
-
"react-native-webview": "13.
|
|
18
|
-
"@react-native/metro-config": "0.79.
|
|
17
|
+
"react-native-webview": "13.15.0",
|
|
18
|
+
"@react-native/metro-config": "0.79.5",
|
|
19
19
|
"react": "19.1.0",
|
|
20
|
-
"@types/react": "19.1.
|
|
21
|
-
"expo": "53.0.
|
|
22
|
-
"expo-dev-client": "5.
|
|
20
|
+
"@types/react": "19.1.8",
|
|
21
|
+
"expo": "53.0.20",
|
|
22
|
+
"expo-dev-client": "5.2.4",
|
|
23
23
|
"expo-custom-assets": "1.4.1",
|
|
24
|
-
"expo-build-properties": "0.14.
|
|
24
|
+
"expo-build-properties": "0.14.8",
|
|
25
25
|
"typescript": "5.8.3"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { document } from '../../index'
|
|
2
|
+
import { DocumentReader, InitConfig } from "@regulaforensics/document-reader"
|
|
3
|
+
import { handleException, init, setStatus } from "../main"
|
|
4
|
+
|
|
5
|
+
export const useBtDevice = false
|
|
6
|
+
export const btDeviceName = "Regula 0000"
|
|
7
|
+
|
|
8
|
+
export function setupBTDevice() {
|
|
9
|
+
var connectButton = document.getElementById("connect")
|
|
10
|
+
connectButton.style.display = "flex"
|
|
11
|
+
connectButton.onclick = () => connect()
|
|
12
|
+
setStatus("Connect to a bluetooth device")
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function connect() {
|
|
16
|
+
setStatus("Searching for devices...")
|
|
17
|
+
if (await DocumentReader.instance.connectBluetoothDevice(btDeviceName)) {
|
|
18
|
+
await init()
|
|
19
|
+
DocumentReader.instance.functionality.useAuthenticator = true
|
|
20
|
+
document.getElementById("bt-device").style.display = "none"
|
|
21
|
+
} else
|
|
22
|
+
setStatus("Failed to connect")
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function initializeWithBTDevice() {
|
|
26
|
+
setStatus("Initializing...")
|
|
27
|
+
|
|
28
|
+
var initConfig = InitConfig.withBleDevice()
|
|
29
|
+
initConfig.delayedNNLoad = true
|
|
30
|
+
var [success, error] = await DocumentReader.instance.initialize(initConfig)
|
|
31
|
+
|
|
32
|
+
handleException(error)
|
|
33
|
+
return success
|
|
34
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { document } from '../../index'
|
|
2
|
+
import { DocReaderAction, DocumentReader, RFIDConfig, RFIDDataFileType, RFIDNotificationCodes } from "@regulaforensics/document-reader"
|
|
3
|
+
import { displayResults, setStatus } from "../main"
|
|
4
|
+
|
|
5
|
+
export const useRfidSelfHostedUI = false
|
|
6
|
+
|
|
7
|
+
export function rfidSelfHostedUI() {
|
|
8
|
+
var config = RFIDConfig.withoutUI((action, results, _) => {
|
|
9
|
+
if (DocReaderAction.stopped(action)) stop()
|
|
10
|
+
if (DocReaderAction.finished(action)) displayResults(results)
|
|
11
|
+
if (DocReaderAction.interrupted(action)) setStatus("Error reading RFID")
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
config.onProgress = async (notification) => {
|
|
15
|
+
if (notification.progress == 1) return
|
|
16
|
+
if (notification.notificationCode == RFIDNotificationCodes.PCSC_READING_DATAGROUP)
|
|
17
|
+
setDescription(await RFIDDataFileType.getTranslation(notification.dataFileType))
|
|
18
|
+
setStatus("Reading RFID")
|
|
19
|
+
setProgress(notification.progress)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
setup()
|
|
23
|
+
DocumentReader.instance.rfid(config)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function setup() {
|
|
27
|
+
setStatus("Reading RFID")
|
|
28
|
+
setDescription("Place your phone on top of the NFC tag")
|
|
29
|
+
setProgress(-1)
|
|
30
|
+
currentProgress = -1
|
|
31
|
+
setShowing(true)
|
|
32
|
+
document.getElementById("cancel-rfid").onclick = () => stop()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function stop() {
|
|
36
|
+
DocumentReader.instance.stopRFIDReader()
|
|
37
|
+
displayResults(null)
|
|
38
|
+
setShowing(false)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function setDescription(data) {
|
|
42
|
+
document.getElementById("rfid-description").innerHTML = data
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var currentProgress = -1
|
|
46
|
+
function setProgress(next) {
|
|
47
|
+
var progress = document.getElementById("progress")
|
|
48
|
+
// make progress bar look better
|
|
49
|
+
if (next == 0) return // ignore idle 0s, leave progress at 100 while its not moving
|
|
50
|
+
if (next < currentProgress) next = 0 // move to 0 if progress finaly started moving
|
|
51
|
+
if (next >= 95) next = 100 // rfid never returns 100 and it looks ugly, fix it
|
|
52
|
+
if (next < currentProgress) progress.style.transition = 'none' // instantly reset progress
|
|
53
|
+
else progress.style.transition = 'width 0.5s' // smoothly increase progress
|
|
54
|
+
|
|
55
|
+
progress.style.width = next + "%"
|
|
56
|
+
currentProgress = next
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function setShowing(data) {
|
|
60
|
+
document.getElementById("main").style.display = data ? "none" : "flex"
|
|
61
|
+
document.getElementById("custom-rfid").style.display = data ? "flex" : "none"
|
|
62
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
html,
|
|
2
2
|
body {
|
|
3
|
-
|
|
3
|
+
margin: 0;
|
|
4
|
+
width: 100%;
|
|
4
5
|
height: 99vh;
|
|
5
6
|
display: flex;
|
|
7
|
+
overflow: hidden;
|
|
6
8
|
flex-direction: column;
|
|
7
9
|
}
|
|
8
10
|
|
|
@@ -59,6 +61,7 @@ body {
|
|
|
59
61
|
color: white;
|
|
60
62
|
border: none;
|
|
61
63
|
padding: 10px 20px;
|
|
64
|
+
justify-content: center;
|
|
62
65
|
font-size: 16px;
|
|
63
66
|
border-radius: 100px;
|
|
64
67
|
cursor: pointer;
|
|
@@ -88,10 +91,12 @@ body {
|
|
|
88
91
|
top: 1px;
|
|
89
92
|
}
|
|
90
93
|
|
|
94
|
+
.radio {
|
|
95
|
+
align-items: baseline;
|
|
96
|
+
padding: 15px;
|
|
97
|
+
}
|
|
98
|
+
|
|
91
99
|
input[type="checkbox"] {
|
|
92
|
-
appearance: none;
|
|
93
|
-
-webkit-appearance: none;
|
|
94
|
-
-moz-appearance: none;
|
|
95
100
|
width: 20px;
|
|
96
101
|
height: 20px;
|
|
97
102
|
border: 2px solid black;
|
|
@@ -121,10 +126,9 @@ input[type="text"] {
|
|
|
121
126
|
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
122
127
|
}
|
|
123
128
|
|
|
124
|
-
|
|
129
|
+
#progress {
|
|
125
130
|
width: 0%;
|
|
126
131
|
height: 20px;
|
|
127
132
|
background-color: #4285F4;
|
|
128
133
|
border-radius: 5px;
|
|
129
|
-
|
|
130
|
-
}
|
|
134
|
+
}
|
|
@@ -7,50 +7,25 @@
|
|
|
7
7
|
<div class="row">
|
|
8
8
|
<div class="column" style="padding: 5px;">
|
|
9
9
|
<p>Portrait</p>
|
|
10
|
-
<img id="portrait-image" src="images/portrait.png" height="
|
|
10
|
+
<img id="portrait-image" src="images/portrait.png" height="160px" width="120px">
|
|
11
11
|
</div>
|
|
12
12
|
<div class="column" style="padding: 5px;">
|
|
13
13
|
<p>Document image</p>
|
|
14
|
-
<img id="document-image" src="images/document.png" height="
|
|
14
|
+
<img id="document-image" src="images/document.png" height="160px" width="200px">
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
|
-
<div id="scenario-container" class="column no-scroll"
|
|
18
|
-
|
|
19
|
-
<div id="scenarios" class="scroll">
|
|
20
|
-
<div class="row" style="align-items: baseline; padding: 15px;">
|
|
21
|
-
<input type="radio" name="scenario" value="Aaa">
|
|
22
|
-
<span style="width: 200px; padding-left: 5px;">Aaa</span>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="row" style="align-items: baseline; padding: 15px;">
|
|
25
|
-
<input type="radio" name="scenario" value="Aaa">
|
|
26
|
-
<span style="width: 200px; padding-left: 5px;">Aaa</span>
|
|
27
|
-
</div>
|
|
28
|
-
<div class="row" style="align-items: baseline; padding: 15px;">
|
|
29
|
-
<input type="radio" name="scenario" value="Aaa">
|
|
30
|
-
<span style="width: 200px; padding-left: 5px;">Aaa</span>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="row" style="align-items: baseline; padding: 15px;">
|
|
33
|
-
<input type="radio" name="scenario" value="Aaa">
|
|
34
|
-
<span style="width: 200px; padding-left: 5px;">Aaa</span>
|
|
35
|
-
</div>
|
|
36
|
-
<div class="row" style="align-items: baseline; padding: 15px;">
|
|
37
|
-
<input type="radio" name="scenario" value="Aaa">
|
|
38
|
-
<span style="width: 200px; padding-left: 5px;">Aaa</span>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
17
|
+
<div id="scenario-container" class="column no-scroll" style="margin-top: 15px; background-color: rgba(0, 0, 0, 0.03);">
|
|
18
|
+
<div id="scenarios" class="scroll"></div>
|
|
41
19
|
</div>
|
|
42
20
|
<div class="row" style="width: 360px; padding-top: 15px;">
|
|
43
|
-
<span id="rfid-checkbox-description" style="font-size: 18px;">Process rfid reading</span>
|
|
44
|
-
<input id="rfid-checkbox" type="checkbox" style="margin-left: auto;" />
|
|
45
|
-
</div>
|
|
46
|
-
<div id="bt-device" class="row" style="display: none;">
|
|
47
|
-
<input type="text" placeholder="Regula 0000" />
|
|
48
|
-
<button class="button">Connect</button>
|
|
21
|
+
<span id="rfid-checkbox-description" style="font-size: 18px;width: 100%;">Process rfid reading(unavailable)</span>
|
|
22
|
+
<input id="rfid-checkbox" type="checkbox" style="margin-left: auto;" disabled />
|
|
49
23
|
</div>
|
|
50
24
|
<div class="row">
|
|
51
25
|
<button id="scan" class="button">Scan document</button>
|
|
52
26
|
<button id="recognize" class="button">Scan image</button>
|
|
53
27
|
</div>
|
|
28
|
+
<button id="connect" class="button" style="width: 360px; display: none;">Connect</button>
|
|
54
29
|
<div style="padding-top: 20px;"></div>
|
|
55
30
|
</div>
|
|
56
31
|
<div id="custom-rfid" class="column no-scroll" style="display: none;">
|
|
@@ -1,50 +1,175 @@
|
|
|
1
1
|
import { document } from '../index'
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario } from '@regulaforensics/document-reader'
|
|
3
|
+
import { loadAsset, pickImage } from '../index'
|
|
4
|
+
import { initializeWithBTDevice, setupBTDevice, useBtDevice } from './extra/bt_device'
|
|
5
|
+
import { useRfidSelfHostedUI, rfidSelfHostedUI } from './extra/custom_rfid'
|
|
5
6
|
|
|
6
7
|
var documentReader = DocumentReader.instance
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var selectedScenario
|
|
9
|
+
var doRfid = false
|
|
10
|
+
var isReadingRfid = false
|
|
10
11
|
|
|
11
|
-
async function init() {
|
|
12
|
+
export async function init() {
|
|
12
13
|
if (!await initialize()) return
|
|
14
|
+
setScenarios(documentReader.availableScenarios)
|
|
15
|
+
setCanRfid(await documentReader.isRFIDAvailableForUse())
|
|
13
16
|
setStatus("Ready")
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
async function
|
|
19
|
+
async function scan() {
|
|
20
|
+
if (!await documentReader.isReady()) return
|
|
21
|
+
clearResults()
|
|
22
|
+
documentReader.startScanner(
|
|
23
|
+
ScannerConfig.withScenario(selectedScenario),
|
|
24
|
+
handleCompletion,
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function recognize() {
|
|
29
|
+
if (!await documentReader.isReady()) return
|
|
30
|
+
var image = await pickImage()
|
|
31
|
+
if (image == null) return
|
|
32
|
+
|
|
33
|
+
clearResults()
|
|
34
|
+
documentReader.recognize(
|
|
35
|
+
RecognizeConfig.withScenario(selectedScenario, { image: image }),
|
|
36
|
+
handleCompletion,
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function handleCompletion(action, results, error) {
|
|
41
|
+
handleException(error)
|
|
42
|
+
if (DocReaderAction.stopped(action) && !shouldRfid(results)) {
|
|
43
|
+
displayResults(results)
|
|
44
|
+
} else if (DocReaderAction.finished(action) && shouldRfid(results)) {
|
|
45
|
+
isReadingRfid = true
|
|
46
|
+
readRfid()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function displayResults(results) {
|
|
51
|
+
isReadingRfid = false
|
|
52
|
+
clearResults()
|
|
53
|
+
if (results == null) return
|
|
54
|
+
|
|
55
|
+
var name = await results.textFieldValueByType(FieldType.SURNAME_AND_GIVEN_NAMES)
|
|
56
|
+
var docImage = await results.graphicFieldImageByType(GraphicFieldType.DOCUMENT_IMAGE)
|
|
57
|
+
var portrait = await results.graphicFieldImageByType(GraphicFieldType.PORTRAIT)
|
|
58
|
+
portrait = await results.graphicFieldImageByTypeSource(GraphicFieldType.PORTRAIT, ResultType.RFID_IMAGE_DATA) ?? portrait
|
|
59
|
+
|
|
60
|
+
setStatus(name)
|
|
61
|
+
setPortrait(portrait)
|
|
62
|
+
setDocImage(docImage)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var readRfid = () => {
|
|
66
|
+
documentReader.rfid(new RFIDConfig(handleCompletion))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function shouldRfid(results) {
|
|
70
|
+
return doRfid &&
|
|
71
|
+
!isReadingRfid &&
|
|
72
|
+
results != null && results.chipPage != 0
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var initialize = async () => {
|
|
17
76
|
setStatus("Initializing...")
|
|
18
77
|
|
|
19
|
-
var license = await
|
|
20
|
-
var
|
|
21
|
-
var [success, error] = await documentReader.initialize(
|
|
78
|
+
var license = await loadAsset("regula.license")
|
|
79
|
+
var initConfig = new InitConfig(license)
|
|
80
|
+
var [success, error] = await documentReader.initialize(initConfig)
|
|
81
|
+
|
|
82
|
+
handleException(error)
|
|
83
|
+
return success
|
|
84
|
+
}
|
|
22
85
|
|
|
23
|
-
|
|
86
|
+
export function handleException(error) {
|
|
87
|
+
if (error != null) {
|
|
24
88
|
setStatus(error.message)
|
|
25
89
|
console.log(error.code + ": " + error.message)
|
|
26
90
|
}
|
|
27
|
-
return success
|
|
28
91
|
}
|
|
29
92
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
93
|
+
// --------------------------------------------------------------------------------------------------------------------
|
|
94
|
+
|
|
95
|
+
var documentUIImage
|
|
96
|
+
var portraitUIImage
|
|
97
|
+
export function main() {
|
|
98
|
+
documentUIImage = document.getElementById("document-image")
|
|
99
|
+
portraitUIImage = document.getElementById("portrait-image")
|
|
100
|
+
document.getElementById("scan").onclick = () => scan()
|
|
101
|
+
document.getElementById("recognize").onclick = () => recognize()
|
|
102
|
+
|
|
103
|
+
// custom rfid
|
|
104
|
+
if (useRfidSelfHostedUI) readRfid = () => rfidSelfHostedUI()
|
|
105
|
+
|
|
106
|
+
// bt device
|
|
107
|
+
if (!useBtDevice) init()
|
|
108
|
+
else {
|
|
109
|
+
setupBTDevice()
|
|
110
|
+
initialize = initializeWithBTDevice
|
|
37
111
|
}
|
|
38
112
|
}
|
|
39
113
|
|
|
40
|
-
|
|
114
|
+
export function setStatus(data) {
|
|
115
|
+
if (data != null)
|
|
116
|
+
document.getElementById("status").innerHTML = data
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function setPortrait(data) {
|
|
120
|
+
if (data != null)
|
|
121
|
+
portraitUIImage.src = "data:image/png;base64," + data
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function setDocImage(data) {
|
|
125
|
+
if (data != null)
|
|
126
|
+
documentUIImage.src = "data:image/png;base64," + data
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function clearResults() {
|
|
130
|
+
setStatus("Ready")
|
|
131
|
+
portraitUIImage.src = "images/portrait.png"
|
|
132
|
+
documentUIImage.src = "images/document.png"
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function setCanRfid(data) {
|
|
136
|
+
var checkbox // implicitly any, since cordova sample is pure js
|
|
137
|
+
checkbox = document.getElementById('rfid-checkbox')
|
|
138
|
+
var checkboxDescription = document.getElementById("rfid-checkbox-description")
|
|
139
|
+
if (data) {
|
|
140
|
+
checkbox.disabled = false
|
|
141
|
+
checkboxDescription.innerHTML = "Process rfid reading"
|
|
142
|
+
var onclick = () => {
|
|
143
|
+
doRfid = !doRfid
|
|
144
|
+
checkbox.checked = doRfid
|
|
145
|
+
}
|
|
146
|
+
checkbox.onclick = onclick
|
|
147
|
+
checkboxDescription.onclick = onclick
|
|
148
|
+
}
|
|
149
|
+
}
|
|
41
150
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
document.getElementById("
|
|
45
|
-
document.getElementById("bt-device").style.display = (useBtDevice && !ready) ? "flex" : "none"
|
|
151
|
+
function setScenarios(data) {
|
|
152
|
+
selectedScenario = Scenario.MRZ
|
|
153
|
+
var scenariosContainer = document.getElementById("scenarios")
|
|
46
154
|
|
|
47
|
-
|
|
155
|
+
data.forEach(scenario => {
|
|
156
|
+
var checked = selectedScenario == scenario.name ? "checked" : ""
|
|
157
|
+
var scenarioElement = `<div class="row radio">
|
|
158
|
+
<input type="radio" name="scenario" id="${scenario.name}" value="${scenario.name}" ${checked}>
|
|
159
|
+
<span id="${scenario.name}-caption" style="width: 200px; padding-left: 5px;">${scenario.caption}</span>
|
|
160
|
+
</div>`
|
|
161
|
+
scenariosContainer.insertAdjacentHTML("beforeend", scenarioElement)
|
|
162
|
+
})
|
|
48
163
|
|
|
49
|
-
|
|
164
|
+
data.forEach(scenario => {
|
|
165
|
+
var element
|
|
166
|
+
element = document.getElementById(scenario.name)
|
|
167
|
+
var elementCaption = document.getElementById(scenario.name + "-caption")
|
|
168
|
+
var onclick = () => {
|
|
169
|
+
selectedScenario = scenario.name
|
|
170
|
+
element.checked = true
|
|
171
|
+
}
|
|
172
|
+
element.onclick = onclick
|
|
173
|
+
elementCaption.onclick = onclick
|
|
174
|
+
})
|
|
50
175
|
}
|
package/ios/RGLWConfig.m
CHANGED
|
@@ -184,6 +184,7 @@
|
|
|
184
184
|
if (options[@"generateDTCVC"]) processParams.generateDTCVC = options[@"generateDTCVC"];
|
|
185
185
|
if (options[@"strictDLCategoryExpiry"]) processParams.strictDLCategoryExpiry = options[@"strictDLCategoryExpiry"];
|
|
186
186
|
if (options[@"generateAlpha2Codes"]) processParams.generateAlpha2Codes = options[@"generateAlpha2Codes"];
|
|
187
|
+
if (options[@"disableAuthResolutionFilter"]) processParams.disableAuthResolutionFilter = options[@"disableAuthResolutionFilter"];
|
|
187
188
|
|
|
188
189
|
// Int
|
|
189
190
|
if([options valueForKey:@"measureSystem"] != nil)
|
|
@@ -314,6 +315,7 @@
|
|
|
314
315
|
result[@"generateDTCVC"] = processParams.generateDTCVC;
|
|
315
316
|
result[@"strictDLCategoryExpiry"] = processParams.strictDLCategoryExpiry;
|
|
316
317
|
result[@"generateAlpha2Codes"] = processParams.generateAlpha2Codes;
|
|
318
|
+
result[@"disableAuthResolutionFilter"] = processParams.disableAuthResolutionFilter;
|
|
317
319
|
|
|
318
320
|
// Int
|
|
319
321
|
result[@"measureSystem"] = [NSNumber numberWithInteger:processParams.measureSystem];
|
|
@@ -475,6 +477,7 @@
|
|
|
475
477
|
customization.torchButtonOffImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"torchButtonOffImage"]];
|
|
476
478
|
if([options valueForKey:@"livenessAnimationImage"] != nil)
|
|
477
479
|
customization.livenessAnimationImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"livenessAnimationImage"]];
|
|
480
|
+
if(options[@"multipageButtonImage"]) customization.multipageButtonImage = [RGLWJSONConstructor imageWithBase64:options[@"multipageButtonImage"]];
|
|
478
481
|
|
|
479
482
|
// Font
|
|
480
483
|
if([options valueForKey:@"statusTextFont"] != nil)
|
|
@@ -576,6 +579,7 @@
|
|
|
576
579
|
result[@"torchButtonOnImage"] = [RGLWJSONConstructor base64WithImage:customization.torchButtonOnImage];
|
|
577
580
|
result[@"torchButtonOffImage"] = [RGLWJSONConstructor base64WithImage:customization.torchButtonOffImage];
|
|
578
581
|
result[@"livenessAnimationImage"] = [RGLWJSONConstructor base64WithImage:customization.livenessAnimationImage];
|
|
582
|
+
result[@"multipageButtonImage"] = [RGLWJSONConstructor base64WithImage:customization.multipageButtonImage];
|
|
579
583
|
|
|
580
584
|
// Font
|
|
581
585
|
result[@"statusTextFont"] = [self generateUIFont:customization.statusTextFont];
|
package/ios/RGLWMain.m
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
@"setTenant": ^{ [self setTenant :args[0]]; },
|
|
17
17
|
@"getEnv": ^{ [self getEnv :callback]; },
|
|
18
18
|
@"setEnv": ^{ [self setEnv :args[0]]; },
|
|
19
|
+
@"getLocale": ^{ [self getLocale :callback]; },
|
|
20
|
+
@"setLocale": ^{ [self setLocale :args[0]]; },
|
|
19
21
|
@"getFunctionality": ^{ [self getFunctionality :callback]; },
|
|
20
22
|
@"setFunctionality": ^{ [self setFunctionality :args[0]]; },
|
|
21
23
|
@"getProcessParams": ^{ [self getProcessParams :callback]; },
|
|
@@ -129,6 +131,14 @@ static NSDictionary* headers;
|
|
|
129
131
|
[RGLDocReader.shared setEnv:tag];
|
|
130
132
|
}
|
|
131
133
|
|
|
134
|
+
+(void)getLocale:(RGLWCallback)callback {
|
|
135
|
+
callback([RGLDocReader.shared languageLocaleCode]);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
+(void)setLocale:(NSString*)locale {
|
|
139
|
+
[RGLDocReader.shared setLanguageLocaleCode:locale];
|
|
140
|
+
}
|
|
141
|
+
|
|
132
142
|
+(void)getFunctionality:(RGLWCallback)callback {
|
|
133
143
|
callback([RGLWJSONConstructor dictToString: [RGLWConfig getFunctionality: RGLDocReader.shared.functionality]]);
|
|
134
144
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/document-reader",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.242-beta",
|
|
4
4
|
"description": "This is an npm module for Regula Document Reader SDK. It allows you to read various kinds of identification documents using your phone's camera.",
|
|
5
5
|
"main": "www/react-native/index.js",
|
|
6
6
|
"module": "www/capacitor/index.js",
|
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="@regulaforensics/document-reader" version="8.
|
|
2
|
+
<plugin id="@regulaforensics/document-reader" version="8.3.242-beta" xmlns="http://apache.org/cordova/ns/plugins/1.0">
|
|
3
3
|
<name>DocumentReader</name>
|
|
4
4
|
<description>Cordova plugin for Regula Document Reader SDK</description>
|
|
5
5
|
<license>commercial</license>
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<source url="https://github.com/CocoaPods/Specs.git" />
|
|
30
30
|
</config>
|
|
31
31
|
<pods>
|
|
32
|
-
<pod name="DocumentReader" spec="8.
|
|
32
|
+
<pod name="DocumentReader" spec="8.2.4934" />
|
|
33
33
|
</pods>
|
|
34
34
|
</podspec>
|
|
35
35
|
</platform>
|
package/www/capacitor/index.js
CHANGED
|
@@ -184,6 +184,13 @@ export class DocumentReader {
|
|
|
184
184
|
this._setEnv(val);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
get locale() { return this._locale }
|
|
188
|
+
_locale = null
|
|
189
|
+
set locale(val) {
|
|
190
|
+
this._locale = val;
|
|
191
|
+
this._setLocale(val);
|
|
192
|
+
}
|
|
193
|
+
|
|
187
194
|
get localizationDictionary() { return this._localizationDictionary }
|
|
188
195
|
_localizationDictionary = null
|
|
189
196
|
set localizationDictionary(val) {
|
|
@@ -257,8 +264,8 @@ export class DocumentReader {
|
|
|
257
264
|
return await exec("connectBluetoothDevice", [deviceName]);
|
|
258
265
|
}
|
|
259
266
|
|
|
260
|
-
|
|
261
|
-
|
|
267
|
+
deinitializeReader() {
|
|
268
|
+
exec("deinitializeReader", []);
|
|
262
269
|
}
|
|
263
270
|
|
|
264
271
|
async prepareDatabase(databaseID, prepareCompletion) {
|
|
@@ -286,12 +293,12 @@ export class DocumentReader {
|
|
|
286
293
|
return await exec("removeDatabase", []);
|
|
287
294
|
}
|
|
288
295
|
|
|
289
|
-
|
|
290
|
-
|
|
296
|
+
startNewPage() {
|
|
297
|
+
exec("startNewPage", []);
|
|
291
298
|
}
|
|
292
299
|
|
|
293
|
-
|
|
294
|
-
|
|
300
|
+
startNewSession() {
|
|
301
|
+
exec("startNewSession", []);
|
|
295
302
|
}
|
|
296
303
|
|
|
297
304
|
scan(config, completion) {
|
|
@@ -330,20 +337,20 @@ export class DocumentReader {
|
|
|
330
337
|
]);
|
|
331
338
|
}
|
|
332
339
|
|
|
333
|
-
|
|
334
|
-
|
|
340
|
+
stopScanner() {
|
|
341
|
+
exec("stopScanner", []);
|
|
335
342
|
}
|
|
336
343
|
|
|
337
|
-
|
|
338
|
-
|
|
344
|
+
stopRFIDReader() {
|
|
345
|
+
exec("stopRFIDReader", []);
|
|
339
346
|
}
|
|
340
347
|
|
|
341
|
-
|
|
342
|
-
|
|
348
|
+
addPKDCertificates(certificates) {
|
|
349
|
+
exec("addPKDCertificates", [certificates]);
|
|
343
350
|
}
|
|
344
351
|
|
|
345
|
-
|
|
346
|
-
|
|
352
|
+
clearPKDCertificates() {
|
|
353
|
+
exec("clearPKDCertificates", []);
|
|
347
354
|
}
|
|
348
355
|
|
|
349
356
|
async setTCCParams(params) {
|
|
@@ -361,8 +368,8 @@ export class DocumentReader {
|
|
|
361
368
|
return [action, info, error];
|
|
362
369
|
}
|
|
363
370
|
|
|
364
|
-
|
|
365
|
-
|
|
371
|
+
endBackendTransaction() {
|
|
372
|
+
exec("endBackendTransaction", []);
|
|
366
373
|
}
|
|
367
374
|
|
|
368
375
|
_successOrErrorFromJson(jsonString) {
|
|
@@ -379,6 +386,7 @@ export class DocumentReader {
|
|
|
379
386
|
this._tag = await this._getTag();
|
|
380
387
|
this._tenant = await this._getTenant();
|
|
381
388
|
this._env = await this._getEnv();
|
|
389
|
+
this._locale = await this._getLocale();
|
|
382
390
|
this._rfidSessionStatus = await this._getRfidSessionStatus();
|
|
383
391
|
this._functionality = await this._getFunctionality();
|
|
384
392
|
this._processParams = await this._getProcessParams();
|
|
@@ -457,6 +465,14 @@ export class DocumentReader {
|
|
|
457
465
|
exec("setEnv", [env]);
|
|
458
466
|
}
|
|
459
467
|
|
|
468
|
+
async _getLocale() {
|
|
469
|
+
return await exec("getLocale", []);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
_setLocale(locale) {
|
|
473
|
+
exec("setLocale", [locale]);
|
|
474
|
+
}
|
|
475
|
+
|
|
460
476
|
_setLocalizationDictionary(dictionary) {
|
|
461
477
|
exec("setLocalizationDictionary", [dictionary]);
|
|
462
478
|
}
|
|
@@ -312,6 +312,12 @@ export class Customization {
|
|
|
312
312
|
this._set({ "livenessAnimationImage": val });
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
+
get multipageButtonImage() { return this._multipageButtonImage; }
|
|
316
|
+
set multipageButtonImage(val) {
|
|
317
|
+
this._multipageButtonImage = val;
|
|
318
|
+
this._set({ "multipageButtonImage": val });
|
|
319
|
+
}
|
|
320
|
+
|
|
315
321
|
get statusTextFont() { return this._statusTextFont; }
|
|
316
322
|
set statusTextFont(val) {
|
|
317
323
|
this._statusTextFont = val;
|
|
@@ -482,6 +488,7 @@ export class Customization {
|
|
|
482
488
|
result._changeFrameButtonExpandImage = jsonObject["changeFrameButtonExpandImage"];
|
|
483
489
|
result._changeFrameButtonCollapseImage = jsonObject["changeFrameButtonCollapseImage"];
|
|
484
490
|
result._livenessAnimationImage = jsonObject["livenessAnimationImage"];
|
|
491
|
+
result._multipageButtonImage = jsonObject["multipageButtonImage"];
|
|
485
492
|
result._customLabelStatus = jsonObject["customLabelStatus"];
|
|
486
493
|
result._cameraFrameLineCap = jsonObject["cameraFrameLineCap"];
|
|
487
494
|
result._uiCustomizationLayer = jsonObject["uiCustomizationLayer"];
|
|
@@ -229,6 +229,12 @@ export class ProcessParams {
|
|
|
229
229
|
this._set({ "generateAlpha2Codes": val });
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
get disableAuthResolutionFilter() { return this._disableAuthResolutionFilter; }
|
|
233
|
+
set disableAuthResolutionFilter(val) {
|
|
234
|
+
this._disableAuthResolutionFilter = val;
|
|
235
|
+
this._set({ "disableAuthResolutionFilter": val });
|
|
236
|
+
}
|
|
237
|
+
|
|
232
238
|
get barcodeParserType() { return this._barcodeParserType; }
|
|
233
239
|
set barcodeParserType(val) {
|
|
234
240
|
this._barcodeParserType = val;
|
|
@@ -492,6 +498,7 @@ export class ProcessParams {
|
|
|
492
498
|
result._generateDTCVC = jsonObject["generateDTCVC"];
|
|
493
499
|
result._strictDLCategoryExpiry = jsonObject["strictDLCategoryExpiry"];
|
|
494
500
|
result._generateAlpha2Codes = jsonObject["generateAlpha2Codes"];
|
|
501
|
+
result._disableAuthResolutionFilter = jsonObject["disableAuthResolutionFilter"];
|
|
495
502
|
result._barcodeParserType = jsonObject["barcodeParserType"];
|
|
496
503
|
result._perspectiveAngle = jsonObject["perspectiveAngle"];
|
|
497
504
|
result._minDPI = jsonObject["minDPI"];
|