@regulaforensics/document-reader 9.9.1100-nightly → 9.9.1116-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/Package.swift +27 -0
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/examples/capacitor/package.json +1 -1
- package/examples/ionic/config.xml +1 -1
- package/examples/ionic/package.json +1 -1
- package/examples/ionic-cocoapods/README.md +22 -0
- package/examples/ionic-cocoapods/angular.json +39 -0
- package/examples/ionic-cocoapods/assets/.gitkeep +0 -0
- package/examples/ionic-cocoapods/config.xml +63 -0
- package/examples/ionic-cocoapods/images/document.png +0 -0
- package/examples/ionic-cocoapods/images/icon.png +0 -0
- package/examples/ionic-cocoapods/images/portrait.png +0 -0
- package/examples/ionic-cocoapods/index.html +19 -0
- package/examples/ionic-cocoapods/index.tsx +58 -0
- package/examples/ionic-cocoapods/ionic.config.json +7 -0
- package/examples/ionic-cocoapods/package-lock.json +16579 -0
- package/examples/ionic-cocoapods/package.json +58 -0
- package/examples/ionic-cocoapods/scripts/android.sh +8 -0
- package/examples/ionic-cocoapods/scripts/ios.sh +8 -0
- package/examples/ionic-cocoapods/scripts/setup.sh +8 -0
- package/examples/ionic-cocoapods/src/extra/bt_device.tsx +33 -0
- package/examples/ionic-cocoapods/src/extra/custom_rfid.tsx +61 -0
- package/examples/ionic-cocoapods/src/main.css +148 -0
- package/examples/ionic-cocoapods/src/main.html +38 -0
- package/examples/ionic-cocoapods/src/main.tsx +172 -0
- package/examples/ionic-cocoapods/tsconfig.json +14 -0
- package/examples/react_native/app.config.ts +1 -2
- package/examples/react_native/package.json +10 -11
- package/package.json +1 -1
- package/plugin.xml +11 -11
- package/react-native-document-reader.podspec +14 -0
- package/test/package-lock.json +5 -2
- package/RNDocumentReader.podspec +0 -21
- /package/{ios → Sources/document-reader}/CVDDocumentReader.m +0 -0
- /package/{ios → Sources/document-reader}/RGLWConfig.m +0 -0
- /package/{ios → Sources/document-reader}/RGLWJSONConstructor.m +0 -0
- /package/{ios → Sources/document-reader}/RGLWMain.m +0 -0
- /package/{ios → Sources/document-reader/include/document-reader}/CVDDocumentReader.h +0 -0
- /package/{ios → Sources/document-reader/include/document-reader}/RGLWConfig.h +0 -0
- /package/{ios → Sources/document-reader/include/document-reader}/RGLWJSONConstructor.h +0 -0
- /package/{ios → Sources/document-reader/include/document-reader}/RGLWMain.h +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "document-reader",
|
|
3
|
+
"scripts": {
|
|
4
|
+
"setup": "scripts/setup.sh",
|
|
5
|
+
"ios": "scripts/ios.sh",
|
|
6
|
+
"android": "scripts/android.sh"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@angular-devkit/build-angular": "^21.2.16",
|
|
10
|
+
"@angular/cli": "^21.2.16",
|
|
11
|
+
"@angular/common": "^21.2.17",
|
|
12
|
+
"@angular/compiler-cli": "^21.2.17",
|
|
13
|
+
"@angular/core": "^21.2.17",
|
|
14
|
+
"@angular/forms": "^21.2.17",
|
|
15
|
+
"@angular/platform-browser-dynamic": "^21.2.17",
|
|
16
|
+
"@angular/router": "^21.2.17",
|
|
17
|
+
"@ionic/angular": "^8.8.11",
|
|
18
|
+
"@ionic/cordova-builders": "^12.3.0",
|
|
19
|
+
"@awesome-cordova-plugins/camera": "^8.1.0",
|
|
20
|
+
"@awesome-cordova-plugins/file": "^8.1.0",
|
|
21
|
+
"@regulaforensics/document-reader": "9.9.1116-beta",
|
|
22
|
+
"@regulaforensics/document-reader-core-fullauthrfid": "9.8.2974",
|
|
23
|
+
"@regulaforensics/document-reader-btdevice": "9.8.68",
|
|
24
|
+
"cordova-android": "^14.0.1",
|
|
25
|
+
"cordova-ios": "^7.1.1",
|
|
26
|
+
"cordova-plugin-camera": "^8.0.0",
|
|
27
|
+
"cordova-plugin-file": "^8.1.3",
|
|
28
|
+
"cordova-plugin-ionic-webview": "^5.0.1"
|
|
29
|
+
},
|
|
30
|
+
"overrides": {
|
|
31
|
+
"ajv": "^8.18.0",
|
|
32
|
+
"serialize-javascript": "^7.0.4",
|
|
33
|
+
"undici": "^7.24.0",
|
|
34
|
+
"picomatch": "^4.0.4",
|
|
35
|
+
"postcss": "^8.5.10",
|
|
36
|
+
"uuid": "^14.0.0",
|
|
37
|
+
"vite": "^7.3.2",
|
|
38
|
+
"webpack-dev-server": "^5.2.4",
|
|
39
|
+
"@babel/core": "^7.29.0",
|
|
40
|
+
"esbuild": "^0.28.1",
|
|
41
|
+
"http-proxy-middleware": "^3.0.7",
|
|
42
|
+
"piscina": "^5.2.0"
|
|
43
|
+
},
|
|
44
|
+
"cordova": {
|
|
45
|
+
"plugins": {
|
|
46
|
+
"@regulaforensics/document-reader": {},
|
|
47
|
+
"@regulaforensics/document-reader-core-fullauthrfid": {},
|
|
48
|
+
"@regulaforensics/document-reader-btdevice": {},
|
|
49
|
+
"cordova-plugin-file": {},
|
|
50
|
+
"cordova-plugin-camera": {},
|
|
51
|
+
"cordova-plugin-ionic-webview": {}
|
|
52
|
+
},
|
|
53
|
+
"platforms": [
|
|
54
|
+
"android",
|
|
55
|
+
"ios"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { DocumentReader, InitConfig } from "@regulaforensics/document-reader"
|
|
2
|
+
import { handleException, init, setStatus } from "../main"
|
|
3
|
+
|
|
4
|
+
export const useBtDevice = false
|
|
5
|
+
export const btDeviceName = "Regula 0000"
|
|
6
|
+
|
|
7
|
+
export function setupBTDevice() {
|
|
8
|
+
var connectButton = document.getElementById("connect")!
|
|
9
|
+
connectButton.style.display = "flex"
|
|
10
|
+
connectButton.onclick = () => connect()
|
|
11
|
+
setStatus("Connect to a bluetooth device")
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async function connect() {
|
|
15
|
+
setStatus("Searching for devices...")
|
|
16
|
+
if (await DocumentReader.instance.connectBluetoothDevice(btDeviceName)) {
|
|
17
|
+
await init()
|
|
18
|
+
DocumentReader.instance.functionality.useAuthenticator = true
|
|
19
|
+
document.getElementById("connect")!.style.display = "none"
|
|
20
|
+
} else
|
|
21
|
+
setStatus("Failed to connect")
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function initializeWithBTDevice() {
|
|
25
|
+
setStatus("Initializing...")
|
|
26
|
+
|
|
27
|
+
var initConfig = InitConfig.withBleDevice()
|
|
28
|
+
initConfig.delayedNNLoad = true
|
|
29
|
+
var [success, error] = await DocumentReader.instance.initialize(initConfig)
|
|
30
|
+
|
|
31
|
+
handleException(error)
|
|
32
|
+
return success
|
|
33
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DocReaderAction, DocumentReader, RFIDConfig, RFIDDataFileType, RFIDNotificationCodes } from "@regulaforensics/document-reader"
|
|
2
|
+
import { displayResults, setStatus } from "../main"
|
|
3
|
+
|
|
4
|
+
export const useRfidSelfHostedUI = false
|
|
5
|
+
|
|
6
|
+
export function rfidSelfHostedUI() {
|
|
7
|
+
var config = RFIDConfig.withoutUI((action, results, _) => {
|
|
8
|
+
if (DocReaderAction.stopped(action)) stop()
|
|
9
|
+
if (DocReaderAction.finished(action)) displayResults(results)
|
|
10
|
+
if (DocReaderAction.interrupted(action)) setStatus("Error reading RFID")
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
config.onProgress = async (notification) => {
|
|
14
|
+
if (notification.progress == 1) return
|
|
15
|
+
if (notification.notificationCode == RFIDNotificationCodes.PCSC_READING_DATAGROUP)
|
|
16
|
+
setDescription(await RFIDDataFileType.getTranslation(notification.dataFileType))
|
|
17
|
+
setStatus("Reading RFID")
|
|
18
|
+
setProgress(notification.progress)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
setup()
|
|
22
|
+
DocumentReader.instance.rfid(config)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function setup() {
|
|
26
|
+
setStatus("Reading RFID")
|
|
27
|
+
setDescription("Place your phone on top of the NFC tag")
|
|
28
|
+
setProgress(-1)
|
|
29
|
+
currentProgress = -1
|
|
30
|
+
setShowing(true)
|
|
31
|
+
document.getElementById("cancel-rfid")!.onclick = () => stop()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function stop() {
|
|
35
|
+
DocumentReader.instance.stopRFIDReader()
|
|
36
|
+
displayResults(null)
|
|
37
|
+
setShowing(false)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function setDescription(data: string) {
|
|
41
|
+
document.getElementById("rfid-description")!.innerHTML = data
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var currentProgress = -1
|
|
45
|
+
function setProgress(next: number) {
|
|
46
|
+
var progress = document.getElementById("progress")!
|
|
47
|
+
// make progress bar look better
|
|
48
|
+
if (next == 0) return // ignore idle 0s, leave progress at 100 while its not moving
|
|
49
|
+
if (next < currentProgress) next = 0 // move to 0 if progress finaly started moving
|
|
50
|
+
if (next >= 95) next = 100 // rfid never returns 100 and it looks ugly, fix it
|
|
51
|
+
if (next < currentProgress) progress.style.transition = 'none' // instantly reset progress
|
|
52
|
+
else progress.style.transition = 'width 0.5s' // smoothly increase progress
|
|
53
|
+
|
|
54
|
+
progress.style.width = next + "%"
|
|
55
|
+
currentProgress = next
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function setShowing(data: boolean) {
|
|
59
|
+
document.getElementById("main")!.style.display = data ? "none" : "flex"
|
|
60
|
+
document.getElementById("custom-rfid")!.style.display = data ? "flex" : "none"
|
|
61
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
html,
|
|
2
|
+
body {
|
|
3
|
+
margin: 0;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 99vh;
|
|
6
|
+
display: flex;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Prevent text selection */
|
|
12
|
+
* {
|
|
13
|
+
user-select: none !important;
|
|
14
|
+
-webkit-user-select: none !important;
|
|
15
|
+
-webkit-user-drag: none !important;
|
|
16
|
+
-webkit-touch-callout: none !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.column {
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.row {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header {
|
|
35
|
+
text-align: center;
|
|
36
|
+
padding-top: 80px;
|
|
37
|
+
margin-top: -10px;
|
|
38
|
+
background-color: rgba(0, 0, 0, 0.03);
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
font-size: 18px;
|
|
41
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sub-header {
|
|
45
|
+
background-color: rgba(0, 0, 0, 0.03);
|
|
46
|
+
width: 100%;
|
|
47
|
+
padding-top: 13px;
|
|
48
|
+
text-align: center;
|
|
49
|
+
font-weight: 550;
|
|
50
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.divider {
|
|
54
|
+
height: 1px;
|
|
55
|
+
background-color: rgba(0, 0, 0, 0.075);
|
|
56
|
+
margin-top: 13px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.scroll {
|
|
60
|
+
flex-grow: 1;
|
|
61
|
+
overflow-y: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.no-scroll {
|
|
65
|
+
flex-grow: 1;
|
|
66
|
+
overflow-y: hidden;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.button {
|
|
70
|
+
width: 175px;
|
|
71
|
+
height: 40px;
|
|
72
|
+
margin: 5px;
|
|
73
|
+
margin-top: 10px;
|
|
74
|
+
background-color: #4285F4;
|
|
75
|
+
color: white;
|
|
76
|
+
border: none;
|
|
77
|
+
padding: 10px 20px;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
font-size: 16px;
|
|
80
|
+
border-radius: 100px;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
transition: all 0.3s ease;
|
|
83
|
+
user-select: none;
|
|
84
|
+
-webkit-user-select: none;
|
|
85
|
+
-moz-user-select: none;
|
|
86
|
+
-ms-user-select: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.button:active {
|
|
90
|
+
position: relative;
|
|
91
|
+
top: 1px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.text-button {
|
|
95
|
+
background: none;
|
|
96
|
+
border: none;
|
|
97
|
+
color: #2196f3;
|
|
98
|
+
font-size: 20px;
|
|
99
|
+
font-weight: bold;
|
|
100
|
+
padding: 5px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.text-button:active {
|
|
104
|
+
position: relative;
|
|
105
|
+
top: 1px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.radio {
|
|
109
|
+
align-items: baseline;
|
|
110
|
+
padding: 15px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
input[type="checkbox"] {
|
|
114
|
+
width: 20px;
|
|
115
|
+
height: 20px;
|
|
116
|
+
border: 2px solid black;
|
|
117
|
+
background-color: white;
|
|
118
|
+
display: inline-block;
|
|
119
|
+
position: relative;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
input[type="text"] {
|
|
124
|
+
width: 173px;
|
|
125
|
+
height: 40px;
|
|
126
|
+
font-size: 15px;
|
|
127
|
+
margin: 5px;
|
|
128
|
+
border-radius: 100px;
|
|
129
|
+
padding-left: 10px;
|
|
130
|
+
padding-right: 10px;
|
|
131
|
+
margin-top: 10px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.progress-bar {
|
|
135
|
+
width: 75%;
|
|
136
|
+
padding: 3px;
|
|
137
|
+
margin-top: 40px;
|
|
138
|
+
background-color: #eee;
|
|
139
|
+
border-radius: 8px;
|
|
140
|
+
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
#progress {
|
|
144
|
+
width: 0%;
|
|
145
|
+
height: 20px;
|
|
146
|
+
background-color: #4285F4;
|
|
147
|
+
border-radius: 5px;
|
|
148
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<div class="column" style="height: 100%">
|
|
2
|
+
<div class="column header">
|
|
3
|
+
<span id="status">Loading...</span>
|
|
4
|
+
<div class="column divider"></div>
|
|
5
|
+
</div>
|
|
6
|
+
<div id="main" class="column no-scroll">
|
|
7
|
+
<div class="row">
|
|
8
|
+
<div class="column" style="padding: 5px;">
|
|
9
|
+
<p>Portrait</p>
|
|
10
|
+
<img id="portrait-image" src="images/portrait.png" height="160px" width="120px">
|
|
11
|
+
</div>
|
|
12
|
+
<div class="column" style="padding: 5px;">
|
|
13
|
+
<p>Document image</p>
|
|
14
|
+
<img id="document-image" src="images/document.png" height="160px" width="200px">
|
|
15
|
+
</div>
|
|
16
|
+
</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>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="row" style="width: 360px; padding-top: 15px;">
|
|
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 />
|
|
23
|
+
</div>
|
|
24
|
+
<div class="row">
|
|
25
|
+
<button id="scan" class="button">Scan document</button>
|
|
26
|
+
<button id="recognize" class="button">Scan image</button>
|
|
27
|
+
</div>
|
|
28
|
+
<button id="connect" class="button" style="width: 360px; display: none;">Connect</button>
|
|
29
|
+
<div style="padding-top: 20px;"></div>
|
|
30
|
+
</div>
|
|
31
|
+
<div id="custom-rfid" class="column no-scroll" style="display: none;">
|
|
32
|
+
<span id="rfid-description" style="font-size: 22px">Place your phone on top of the NFC tag</span>
|
|
33
|
+
<div class="progress-bar">
|
|
34
|
+
<div id="progress"></div>
|
|
35
|
+
</div>
|
|
36
|
+
<button id="cancel-rfid" class="text-button" style="margin-top: 50px; padding-bottom: 100px;">X</button>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario, Results, DocReaderException, DocReaderScenario } from '@regulaforensics/document-reader'
|
|
2
|
+
import { loadAsset, pickImage } from '../index'
|
|
3
|
+
import { initializeWithBTDevice, setupBTDevice, useBtDevice } from './extra/bt_device'
|
|
4
|
+
import { useRfidSelfHostedUI, rfidSelfHostedUI } from './extra/custom_rfid'
|
|
5
|
+
|
|
6
|
+
var documentReader = DocumentReader.instance
|
|
7
|
+
var selectedScenario = Scenario.MRZ
|
|
8
|
+
var doRfid = false
|
|
9
|
+
var isReadingRfid = false
|
|
10
|
+
|
|
11
|
+
export async function init() {
|
|
12
|
+
if (!await initialize()) return
|
|
13
|
+
setScenarios(documentReader.availableScenarios)
|
|
14
|
+
setCanRfid(await documentReader.isRFIDAvailableForUse())
|
|
15
|
+
setStatus("Ready")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function scan() {
|
|
19
|
+
if (!await documentReader.isReady()) return
|
|
20
|
+
clearResults()
|
|
21
|
+
documentReader.startScanner(
|
|
22
|
+
ScannerConfig.withScenario(selectedScenario),
|
|
23
|
+
handleCompletion,
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function recognize() {
|
|
28
|
+
if (!await documentReader.isReady()) return
|
|
29
|
+
var image = await pickImage()
|
|
30
|
+
if (image == null) return
|
|
31
|
+
|
|
32
|
+
clearResults()
|
|
33
|
+
documentReader.recognize(
|
|
34
|
+
RecognizeConfig.withScenario(selectedScenario, { image: image }),
|
|
35
|
+
handleCompletion,
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function handleCompletion(action: DocReaderAction, results: Results | null, error: DocReaderException | null) {
|
|
40
|
+
handleException(error)
|
|
41
|
+
if (DocReaderAction.stopped(action) && !shouldRfid(results)) {
|
|
42
|
+
displayResults(results)
|
|
43
|
+
} else if (DocReaderAction.finished(action) && shouldRfid(results)) {
|
|
44
|
+
isReadingRfid = true
|
|
45
|
+
readRfid()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function displayResults(results: Results | null) {
|
|
50
|
+
isReadingRfid = false
|
|
51
|
+
clearResults()
|
|
52
|
+
if (results == null) return
|
|
53
|
+
|
|
54
|
+
var name = await results.textFieldValueByType(FieldType.SURNAME_AND_GIVEN_NAMES)
|
|
55
|
+
var docImage = await results.graphicFieldImageByType(GraphicFieldType.DOCUMENT_IMAGE)
|
|
56
|
+
var portrait = await results.graphicFieldImageByType(GraphicFieldType.PORTRAIT)
|
|
57
|
+
portrait = await results.graphicFieldImageByTypeSource(GraphicFieldType.PORTRAIT, ResultType.RFID_IMAGE_DATA) ?? portrait
|
|
58
|
+
|
|
59
|
+
setStatus(name)
|
|
60
|
+
setPortrait(portrait)
|
|
61
|
+
setDocImage(docImage)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var readRfid = () => {
|
|
65
|
+
documentReader.rfid(new RFIDConfig(handleCompletion))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function shouldRfid(results: Results | null) {
|
|
69
|
+
return doRfid &&
|
|
70
|
+
!isReadingRfid &&
|
|
71
|
+
results != null && results.chipPage != 0
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var initialize = async () => {
|
|
75
|
+
setStatus("Initializing...")
|
|
76
|
+
|
|
77
|
+
var license = await loadAsset("regula.license")
|
|
78
|
+
var initConfig = new InitConfig(license)
|
|
79
|
+
initConfig.delayedNNLoad = true
|
|
80
|
+
var [success, error] = await documentReader.initialize(initConfig)
|
|
81
|
+
|
|
82
|
+
handleException(error)
|
|
83
|
+
return success
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function handleException(error: DocReaderException | null) {
|
|
87
|
+
if (error != null) {
|
|
88
|
+
setStatus(error.message)
|
|
89
|
+
console.log(error.code + ": " + error.message)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// --------------------------------------------------------------------------------------------------------------------
|
|
94
|
+
|
|
95
|
+
export function main() {
|
|
96
|
+
documentUIImage = document.getElementById("document-image") as HTMLImageElement
|
|
97
|
+
portraitUIImage = document.getElementById("portrait-image") as HTMLImageElement
|
|
98
|
+
document.getElementById("scan")!.onclick = () => scan()
|
|
99
|
+
document.getElementById("recognize")!.onclick = () => recognize()
|
|
100
|
+
|
|
101
|
+
// custom rfid
|
|
102
|
+
if (useRfidSelfHostedUI) readRfid = () => rfidSelfHostedUI()
|
|
103
|
+
|
|
104
|
+
// bt device
|
|
105
|
+
if (!useBtDevice) init()
|
|
106
|
+
else {
|
|
107
|
+
setupBTDevice()
|
|
108
|
+
initialize = initializeWithBTDevice
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function setStatus(data: string | null) {
|
|
113
|
+
if (data != null)
|
|
114
|
+
document.getElementById("status")!.innerHTML = data
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var portraitUIImage: HTMLImageElement
|
|
118
|
+
function setPortrait(data: string | null) {
|
|
119
|
+
if (data != null)
|
|
120
|
+
portraitUIImage.src = "data:image/png;base64," + data
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
var documentUIImage: HTMLImageElement
|
|
124
|
+
function setDocImage(data: string | null) {
|
|
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: boolean) {
|
|
136
|
+
var checkbox = document.getElementById('rfid-checkbox') as HTMLInputElement
|
|
137
|
+
var checkboxDescription = document.getElementById("rfid-checkbox-description")!
|
|
138
|
+
if (data) {
|
|
139
|
+
checkbox.disabled = false
|
|
140
|
+
checkboxDescription.innerHTML = "Process rfid reading"
|
|
141
|
+
var onclick = () => {
|
|
142
|
+
doRfid = !doRfid
|
|
143
|
+
checkbox.checked = doRfid
|
|
144
|
+
}
|
|
145
|
+
checkbox.onclick = onclick
|
|
146
|
+
checkboxDescription.onclick = onclick
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function setScenarios(data: DocReaderScenario[]) {
|
|
151
|
+
var scenariosContainer = document.getElementById("scenarios")!
|
|
152
|
+
|
|
153
|
+
data.forEach(scenario => {
|
|
154
|
+
var checked = selectedScenario == scenario.name ? "checked" : ""
|
|
155
|
+
var scenarioElement = `<div class="row radio">
|
|
156
|
+
<input type="radio" name="scenario" id="${scenario.name}" value="${scenario.name}" ${checked}>
|
|
157
|
+
<span id="${scenario.name}-caption" style="width: 200px; padding-left: 5px;">${scenario.caption}</span>
|
|
158
|
+
</div>`
|
|
159
|
+
scenariosContainer.insertAdjacentHTML("beforeend", scenarioElement)
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
data.forEach(scenario => {
|
|
163
|
+
var element = document.getElementById(scenario.name) as HTMLInputElement
|
|
164
|
+
var elementCaption = document.getElementById(scenario.name + "-caption")!
|
|
165
|
+
var onclick = () => {
|
|
166
|
+
selectedScenario = scenario.name as Scenario
|
|
167
|
+
element.checked = true
|
|
168
|
+
}
|
|
169
|
+
element.onclick = onclick
|
|
170
|
+
elementCaption.onclick = onclick
|
|
171
|
+
})
|
|
172
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": [
|
|
3
|
+
"*.tsx"
|
|
4
|
+
],
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"types": [],
|
|
7
|
+
"module": "esnext",
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"target": "es2022",
|
|
11
|
+
"jsx": "react-jsx",
|
|
12
|
+
"skipLibCheck": true, // Temp fix for https://github.com/ionic-team/ionic-framework/issues/30650
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -32,8 +32,7 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
|
|
|
32
32
|
package: 'com.regula.example.dr.react',
|
|
33
33
|
permissions: [
|
|
34
34
|
'android.permission.BLUETOOTH_CONNECT',
|
|
35
|
-
'android.permission.NFC']
|
|
36
|
-
edgeToEdgeEnabled: true
|
|
35
|
+
'android.permission.NFC']
|
|
37
36
|
},
|
|
38
37
|
plugins: [
|
|
39
38
|
'@regulaforensics/document-reader',
|
|
@@ -8,21 +8,20 @@
|
|
|
8
8
|
"start": "expo start"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@regulaforensics/document-reader": "9.9.
|
|
11
|
+
"@regulaforensics/document-reader": "9.9.1116-beta",
|
|
12
12
|
"@regulaforensics/document-reader-core-fullauthrfid": "9.8.2974",
|
|
13
13
|
"@regulaforensics/document-reader-btdevice": "9.8.68",
|
|
14
|
-
"react-native": "
|
|
14
|
+
"react-native": "0.88.0-rc.0",
|
|
15
15
|
"react-native-fs": "^2.20.0",
|
|
16
16
|
"react-native-image-picker": "^8.2.1",
|
|
17
|
-
"react-native-webview": "
|
|
18
|
-
"
|
|
19
|
-
"react": "
|
|
20
|
-
"
|
|
21
|
-
"expo": "
|
|
22
|
-
"expo-dev-client": "^6.0.12",
|
|
17
|
+
"react-native-webview": "14.0.1",
|
|
18
|
+
"react": "19.2.3",
|
|
19
|
+
"@types/react": "~19.2.18",
|
|
20
|
+
"expo": "58.0.0-preview.3",
|
|
21
|
+
"expo-dev-client": "~58.0.3",
|
|
23
22
|
"expo-custom-assets": "^1.5.0",
|
|
24
|
-
"expo-build-properties": "
|
|
25
|
-
"typescript": "
|
|
23
|
+
"expo-build-properties": "~58.0.3",
|
|
24
|
+
"typescript": "7.0.2",
|
|
26
25
|
"image-size": "file:vendor/image-size-metro-compat"
|
|
27
26
|
},
|
|
28
27
|
"overrides": {
|
|
@@ -35,4 +34,4 @@
|
|
|
35
34
|
"minimatch": "10.2.6"
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
|
-
}
|
|
37
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@regulaforensics/document-reader",
|
|
3
|
-
"version": "9.9.
|
|
3
|
+
"version": "9.9.1116-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="9.9.
|
|
2
|
+
<plugin id="@regulaforensics/document-reader" version="9.9.1116-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>
|
|
@@ -9,27 +9,27 @@
|
|
|
9
9
|
<clobbers target="DocumentReaderPlugin" />
|
|
10
10
|
</js-module>
|
|
11
11
|
|
|
12
|
-
<platform name="ios">
|
|
12
|
+
<platform name="ios" package="swift">
|
|
13
13
|
<config-file target="config.xml" parent="/widget">
|
|
14
14
|
<feature name="DocumentReader">
|
|
15
15
|
<param name="ios-package" value="CVDDocumentReader" />
|
|
16
16
|
</feature>
|
|
17
17
|
<preference name="deployment-target" value="13.0" />
|
|
18
18
|
</config-file>
|
|
19
|
-
<header-file src="
|
|
20
|
-
<source-file src="
|
|
21
|
-
<header-file src="
|
|
22
|
-
<source-file src="
|
|
23
|
-
<header-file src="
|
|
24
|
-
<source-file src="
|
|
25
|
-
<header-file src="
|
|
26
|
-
<source-file src="
|
|
19
|
+
<header-file src="Sources/document-reader/include/document-reader/CVDDocumentReader.h" />
|
|
20
|
+
<source-file src="Sources/document-reader/CVDDocumentReader.m" />
|
|
21
|
+
<header-file src="Sources/document-reader/include/document-reader/RGLWMain.h" />
|
|
22
|
+
<source-file src="Sources/document-reader/RGLWMain.m" />
|
|
23
|
+
<header-file src="Sources/document-reader/include/document-reader/RGLWJSONConstructor.h" />
|
|
24
|
+
<source-file src="Sources/document-reader/RGLWJSONConstructor.m" />
|
|
25
|
+
<header-file src="Sources/document-reader/include/document-reader/RGLWConfig.h" />
|
|
26
|
+
<source-file src="Sources/document-reader/RGLWConfig.m" />
|
|
27
27
|
<podspec>
|
|
28
28
|
<config>
|
|
29
29
|
<source url="https://github.com/regulaforensics/podspecs.git" />
|
|
30
30
|
</config>
|
|
31
31
|
<pods>
|
|
32
|
-
<pod name="
|
|
32
|
+
<pod name="DocumentReader" spec="9.8.6944" nospm="true" />
|
|
33
33
|
</pods>
|
|
34
34
|
</podspec>
|
|
35
35
|
</platform>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Pod::Spec.new do |s|
|
|
2
|
+
s.name = 'react-native-document-reader'
|
|
3
|
+
s.version = '9.9.1116-beta'
|
|
4
|
+
s.summary = 'Regula React Native plugin.'
|
|
5
|
+
s.license = 'commercial'
|
|
6
|
+
s.authors = { 'RegulaForensics' => 'support@regulaforensics.com' }
|
|
7
|
+
s.homepage = 'https://regulaforensics.com'
|
|
8
|
+
s.source = { :path => '.' }
|
|
9
|
+
s.ios.deployment_target = '15.0'
|
|
10
|
+
s.source_files = [ 'ios/**/*.{h,m}', 'Sources/document-reader/**/*.{h,m}' ]
|
|
11
|
+
s.exclude_files = [ 'Sources/document-reader/include/document-reader/CVDDocumentReader.h', 'Sources/document-reader/CVDDocumentReader.m' ]
|
|
12
|
+
s.dependency 'DocumentReader', '9.8.6944'
|
|
13
|
+
s.dependency 'React'
|
|
14
|
+
end
|