@regulaforensics/document-reader 8.3.242-beta → 8.3.272-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/README.md +2 -3
- package/RNDocumentReader.podspec +1 -1
- package/examples/capacitor/README.md +1 -3
- package/examples/capacitor/ios/App/App/App.entitlements +6 -1
- package/examples/capacitor/ios/App/App/Info.plist +60 -46
- package/examples/capacitor/package.json +3 -3
- package/examples/capacitor/src/extra/bt_device.tsx +2 -2
- package/examples/capacitor/src/extra/custom_rfid.tsx +8 -8
- package/examples/capacitor/src/main.css +14 -1
- package/examples/capacitor/src/main.html +1 -1
- package/examples/capacitor/src/main.tsx +25 -27
- package/examples/ionic/README.md +1 -3
- package/examples/ionic/angular.json +3 -3
- package/examples/ionic/config.xml +27 -3
- package/examples/ionic/package.json +3 -3
- package/examples/ionic/src/extra/{bt_device.ts → bt_device.tsx} +2 -2
- package/examples/ionic/src/extra/{custom_rfid.ts → custom_rfid.tsx} +8 -8
- package/examples/ionic/src/main.css +14 -1
- package/examples/ionic/src/main.html +1 -1
- package/examples/ionic/src/{main.ts → main.tsx} +25 -27
- package/examples/ionic/tsconfig.json +3 -2
- package/examples/react_native/README.md +1 -3
- package/examples/react_native/index.tsx +2 -1
- package/examples/react_native/package.json +3 -3
- package/examples/react_native/src/extra/bt_device.tsx +2 -3
- package/examples/react_native/src/extra/custom_rfid.tsx +8 -9
- package/examples/react_native/src/main.css +14 -1
- package/examples/react_native/src/main.html +1 -1
- package/examples/react_native/src/main.tsx +25 -28
- package/ios/RGLWMain.m +2 -2
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/test/json.tsx +866 -0
- package/test/package-lock.json +584 -0
- package/test/package.json +12 -0
- package/test/test.tsx +93 -0
- package/test/utils.tsx +34 -0
- package/www/capacitor/config/InitConfig.js +27 -0
- package/www/capacitor/config/RFIDConfig.js +1 -1
- package/www/capacitor/index.js +4 -4
- package/www/capacitor/params/process_params/ProcessParams.js +1 -1
- package/www/capacitor/params/rfid_scenario/RFIDScenario.js +1 -1
- package/www/capacitor/results/DocumentType.js +19 -2
- package/www/cordova.js +60 -16
- package/www/react-native/config/InitConfig.js +27 -0
- package/www/react-native/config/RFIDConfig.js +1 -1
- package/www/react-native/index.js +4 -4
- package/www/react-native/params/process_params/ProcessParams.js +1 -1
- package/www/react-native/params/rfid_scenario/RFIDScenario.js +1 -1
- package/www/react-native/results/DocumentType.js +19 -2
- package/www/types/index.d.ts +6 -6
- package/www/types/params/process_params/ProcessParams.d.ts +1 -1
- package/www/types/params/rfid_scenario/RFIDScenario.d.ts +1 -1
- package/examples/cordova/.vscode/launch.json +0 -28
- package/examples/cordova/.vscode/typings/cordova/cordova.d.ts +0 -80
- package/examples/cordova/README.md +0 -22
- package/examples/cordova/config.xml +0 -33
- package/examples/cordova/package-lock.json +0 -1772
- package/examples/cordova/package.json +0 -33
- package/examples/cordova/scripts/android.sh +0 -8
- package/examples/cordova/scripts/bundle.sh +0 -4
- package/examples/cordova/scripts/ios.sh +0 -8
- package/examples/cordova/scripts/setup.sh +0 -8
- package/examples/cordova/www/bootstrap.js +0 -30
- package/examples/cordova/www/images/logo.png +0 -0
- package/examples/cordova/www/index.html +0 -6
- package/examples/cordova/www/index.js +0 -30
- package/examples/cordova/www/src/extra/bt_device.js +0 -32
- package/examples/cordova/www/src/extra/custom_rfid.js +0 -60
- package/examples/cordova/www/src/main.css +0 -134
- package/examples/cordova/www/src/main.html +0 -38
- package/examples/cordova/www/src/main.js +0 -173
- package/examples/ionic/src/images/document.png +0 -0
- package/examples/ionic/src/images/portrait.png +0 -0
- /package/examples/ionic/{src/assets → assets}/.gitkeep +0 -0
- /package/examples/{cordova/www → ionic}/images/document.png +0 -0
- /package/examples/ionic/{src/images → images}/icon.png +0 -0
- /package/examples/{cordova/www → ionic}/images/portrait.png +0 -0
- /package/examples/ionic/{index.ts → index.tsx} +0 -0
- /package/www/capacitor/params/rfid_scenario/{DTCDataGroups.js → DTCDataGroup.js} +0 -0
- /package/www/react-native/params/rfid_scenario/{DTCDataGroups.js → DTCDataGroup.js} +0 -0
- /package/www/types/params/rfid_scenario/{DTCDataGroups.d.ts → DTCDataGroup.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
# Regula Document Reader plugin
|
|
2
|
-
Document Reader allows you to read various kinds of identification documents, passports, driving licenses, ID cards, etc. All processing is performed completely offline on your device. This plugin makes possible to use it with react-native, cordova and
|
|
2
|
+
Document Reader allows you to read various kinds of identification documents, passports, driving licenses, ID cards, etc. All processing is performed completely offline on your device. This plugin makes possible to use it with react-native, cordova and capacitor applications.
|
|
3
3
|
|
|
4
4
|
## Demo applications
|
|
5
|
-
In the [examples](examples/) folder you can find
|
|
5
|
+
In the [examples](examples/) folder you can find 3 demo applications:
|
|
6
6
|
* [React-native](examples/react-native)
|
|
7
|
-
* [Cordova](examples/cordova)
|
|
8
7
|
* [Ionic(ionic app with cordova, angular)](examples/ionic)
|
|
9
8
|
* [Capacitor(ionic app with capacitor, react)](examples/capacitor)
|
|
10
9
|
|
package/RNDocumentReader.podspec
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## How to build demo application
|
|
4
4
|
1. Download or the clone current repository using the command `git clone https://github.com/regulaforensics/npm-document-reader.git`.
|
|
5
|
-
|
|
6
5
|
2. Execute `npm run setup` within this directory.
|
|
7
|
-
|
|
8
6
|
3. Run the app:
|
|
9
7
|
* IOS: `npm run ios`.
|
|
10
8
|
* Android: `npm run android`.
|
|
@@ -15,7 +13,7 @@
|
|
|
15
13
|
|
|
16
14
|
### Bluetooth device
|
|
17
15
|
|
|
18
|
-
In order to connect to an external scanning device, change the `useBtDevice` constant to true in `src/extra/bt_device`, and set `btDeviceName` to the name of
|
|
16
|
+
In order to connect to an external scanning device, change the `useBtDevice` constant to true in `src/extra/bt_device`, and set `btDeviceName` to the name of your device. After running the app, click `Connect`.
|
|
19
17
|
|
|
20
18
|
### RFID self hosted UI
|
|
21
19
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
3
|
<plist version="1.0">
|
|
4
|
-
<dict
|
|
4
|
+
<dict>
|
|
5
|
+
<key>com.apple.developer.nfc.readersession.formats</key>
|
|
6
|
+
<array>
|
|
7
|
+
<string>TAG</string>
|
|
8
|
+
</array>
|
|
9
|
+
</dict>
|
|
5
10
|
</plist>
|
|
@@ -1,53 +1,67 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
3
|
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
-
<string>en</string>
|
|
7
|
-
<key>CFBundleDisplayName</key>
|
|
8
|
-
<string>DocumentReader</string>
|
|
9
|
-
<key>CFBundleExecutable</key>
|
|
10
|
-
<string>$(EXECUTABLE_NAME)</string>
|
|
11
|
-
<key>CFBundleIdentifier</key>
|
|
12
|
-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
13
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
|
14
|
-
<string>6.0</string>
|
|
15
|
-
<key>CFBundleName</key>
|
|
16
|
-
<string>$(PRODUCT_NAME)</string>
|
|
17
|
-
<key>CFBundlePackageType</key>
|
|
18
|
-
<string>APPL</string>
|
|
19
|
-
<key>CFBundleShortVersionString</key>
|
|
20
|
-
<string>$(MARKETING_VERSION)</string>
|
|
21
|
-
<key>CFBundleVersion</key>
|
|
22
|
-
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
23
|
-
<key>LSRequiresIPhoneOS</key>
|
|
24
|
-
<true/>
|
|
25
|
-
<key>NSAppTransportSecurity</key>
|
|
26
4
|
<dict>
|
|
27
|
-
<key>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>en</string>
|
|
7
|
+
<key>CFBundleDisplayName</key>
|
|
8
|
+
<string>DocumentReader</string>
|
|
9
|
+
<key>CFBundleExecutable</key>
|
|
10
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
11
|
+
<key>CFBundleIdentifier</key>
|
|
12
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
13
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
14
|
+
<string>6.0</string>
|
|
15
|
+
<key>CFBundleName</key>
|
|
16
|
+
<string>$(PRODUCT_NAME)</string>
|
|
17
|
+
<key>CFBundlePackageType</key>
|
|
18
|
+
<string>APPL</string>
|
|
19
|
+
<key>CFBundleShortVersionString</key>
|
|
20
|
+
<string>$(MARKETING_VERSION)</string>
|
|
21
|
+
<key>CFBundleVersion</key>
|
|
22
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
23
|
+
<key>LSRequiresIPhoneOS</key>
|
|
28
24
|
<true/>
|
|
25
|
+
<key>NSAppTransportSecurity</key>
|
|
26
|
+
<dict>
|
|
27
|
+
<key>NSAllowsArbitraryLoads</key>
|
|
28
|
+
<true/>
|
|
29
|
+
</dict>
|
|
30
|
+
<key>NSCameraUsageDescription</key>
|
|
31
|
+
<string></string>
|
|
32
|
+
<key>NSPhotoLibraryUsageDescription</key>
|
|
33
|
+
<string></string>
|
|
34
|
+
<key>NSBluetoothAlwaysUsageDescription</key>
|
|
35
|
+
<string></string>
|
|
36
|
+
<key>UILaunchStoryboardName</key>
|
|
37
|
+
<string>LaunchScreen</string>
|
|
38
|
+
<key>UIMainStoryboardFile</key>
|
|
39
|
+
<string>Main</string>
|
|
40
|
+
<key>UIRequiredDeviceCapabilities</key>
|
|
41
|
+
<array>
|
|
42
|
+
<string>armv7</string>
|
|
43
|
+
</array>
|
|
44
|
+
<key>UISupportedInterfaceOrientations</key>
|
|
45
|
+
<array>
|
|
46
|
+
<string>UIInterfaceOrientationPortrait</string>
|
|
47
|
+
</array>
|
|
48
|
+
<key>UISupportedInterfaceOrientations~ipad</key>
|
|
49
|
+
<array>
|
|
50
|
+
<string>UIInterfaceOrientationPortrait</string>
|
|
51
|
+
</array>
|
|
52
|
+
<key>UIViewControllerBasedStatusBarAppearance</key>
|
|
53
|
+
<true/>
|
|
54
|
+
<key>NFCReaderUsageDescription</key>
|
|
55
|
+
<string>To use NFC</string>
|
|
56
|
+
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
|
|
57
|
+
<array>
|
|
58
|
+
<string>A0000002471001</string>
|
|
59
|
+
<string>E80704007F00070302</string>
|
|
60
|
+
<string>A000000167455349474E</string>
|
|
61
|
+
<string>A0000002480100</string>
|
|
62
|
+
<string>A0000002480200</string>
|
|
63
|
+
<string>A0000002480300</string>
|
|
64
|
+
<string>A00000045645444C2D3031</string>
|
|
65
|
+
</array>
|
|
29
66
|
</dict>
|
|
30
|
-
<key>NSCameraUsageDescription</key>
|
|
31
|
-
<string></string>
|
|
32
|
-
<key>NSPhotoLibraryUsageDescription</key>
|
|
33
|
-
<string></string>
|
|
34
|
-
<key>UILaunchStoryboardName</key>
|
|
35
|
-
<string>LaunchScreen</string>
|
|
36
|
-
<key>UIMainStoryboardFile</key>
|
|
37
|
-
<string>Main</string>
|
|
38
|
-
<key>UIRequiredDeviceCapabilities</key>
|
|
39
|
-
<array>
|
|
40
|
-
<string>armv7</string>
|
|
41
|
-
</array>
|
|
42
|
-
<key>UISupportedInterfaceOrientations</key>
|
|
43
|
-
<array>
|
|
44
|
-
<string>UIInterfaceOrientationPortrait</string>
|
|
45
|
-
</array>
|
|
46
|
-
<key>UISupportedInterfaceOrientations~ipad</key>
|
|
47
|
-
<array>
|
|
48
|
-
<string>UIInterfaceOrientationPortrait</string>
|
|
49
|
-
</array>
|
|
50
|
-
<key>UIViewControllerBasedStatusBarAppearance</key>
|
|
51
|
-
<true/>
|
|
52
|
-
</dict>
|
|
53
67
|
</plist>
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"android": "scripts/android.sh"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@regulaforensics/document-reader": "8.3.
|
|
10
|
-
"@regulaforensics/document-reader-core-fullauthrfid": "8.
|
|
11
|
-
"@regulaforensics/document-reader-btdevice": "8.
|
|
9
|
+
"@regulaforensics/document-reader": "8.3.272-beta",
|
|
10
|
+
"@regulaforensics/document-reader-core-fullauthrfid": "8.2.8-beta",
|
|
11
|
+
"@regulaforensics/document-reader-btdevice": "8.2.8-beta",
|
|
12
12
|
"@awesome-cordova-plugins/file": "6.6.0",
|
|
13
13
|
"@awesome-cordova-plugins/camera": "6.6.0",
|
|
14
14
|
"@awesome-cordova-plugins/dialogs": "6.6.0",
|
|
@@ -5,7 +5,7 @@ export const useBtDevice = false
|
|
|
5
5
|
export const btDeviceName = "Regula 0000"
|
|
6
6
|
|
|
7
7
|
export function setupBTDevice() {
|
|
8
|
-
var connectButton = document.getElementById("connect")
|
|
8
|
+
var connectButton = document.getElementById("connect")!
|
|
9
9
|
connectButton.style.display = "flex"
|
|
10
10
|
connectButton.onclick = () => connect()
|
|
11
11
|
setStatus("Connect to a bluetooth device")
|
|
@@ -16,7 +16,7 @@ async function connect() {
|
|
|
16
16
|
if (await DocumentReader.instance.connectBluetoothDevice(btDeviceName)) {
|
|
17
17
|
await init()
|
|
18
18
|
DocumentReader.instance.functionality.useAuthenticator = true
|
|
19
|
-
document.getElementById("
|
|
19
|
+
document.getElementById("connect")!.style.display = "none"
|
|
20
20
|
} else
|
|
21
21
|
setStatus("Failed to connect")
|
|
22
22
|
}
|
|
@@ -28,7 +28,7 @@ function setup() {
|
|
|
28
28
|
setProgress(-1)
|
|
29
29
|
currentProgress = -1
|
|
30
30
|
setShowing(true)
|
|
31
|
-
document.getElementById("cancel-rfid")
|
|
31
|
+
document.getElementById("cancel-rfid")!.onclick = () => stop()
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function stop() {
|
|
@@ -37,13 +37,13 @@ function stop() {
|
|
|
37
37
|
setShowing(false)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function setDescription(data) {
|
|
41
|
-
document.getElementById("rfid-description")
|
|
40
|
+
function setDescription(data: string) {
|
|
41
|
+
document.getElementById("rfid-description")!.innerHTML = data
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
var currentProgress = -1
|
|
45
|
-
function setProgress(next) {
|
|
46
|
-
var progress = document.getElementById("progress")
|
|
45
|
+
function setProgress(next: number) {
|
|
46
|
+
var progress = document.getElementById("progress")!
|
|
47
47
|
// make progress bar look better
|
|
48
48
|
if (next == 0) return // ignore idle 0s, leave progress at 100 while its not moving
|
|
49
49
|
if (next < currentProgress) next = 0 // move to 0 if progress finaly started moving
|
|
@@ -55,7 +55,7 @@ function setProgress(next) {
|
|
|
55
55
|
currentProgress = next
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function setShowing(data) {
|
|
59
|
-
document.getElementById("main")
|
|
60
|
-
document.getElementById("custom-rfid")
|
|
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
61
|
}
|
|
@@ -8,6 +8,19 @@ body {
|
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
}
|
|
10
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
|
+
/* Prevent image dragging */
|
|
20
|
+
img {
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
.column {
|
|
12
25
|
display: flex;
|
|
13
26
|
flex-direction: column;
|
|
@@ -131,4 +144,4 @@ input[type="text"] {
|
|
|
131
144
|
height: 20px;
|
|
132
145
|
background-color: #4285F4;
|
|
133
146
|
border-radius: 5px;
|
|
134
|
-
}
|
|
147
|
+
}
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
<div class="progress-bar">
|
|
34
34
|
<div id="progress"></div>
|
|
35
35
|
</div>
|
|
36
|
-
<button id="cancel-rfid" class="text-button" style="margin-top: 50px;">X</button>
|
|
36
|
+
<button id="cancel-rfid" class="text-button" style="margin-top: 50px; padding-bottom: 100px;">X</button>
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario } from '@regulaforensics/document-reader'
|
|
1
|
+
import { DocumentReader, DocReaderAction, FieldType, GraphicFieldType, InitConfig, RecognizeConfig, ResultType, RFIDConfig, ScannerConfig, Scenario, Results, DocReaderException, DocReaderScenario } from '@regulaforensics/document-reader'
|
|
2
2
|
import { loadAsset, pickImage } from '../index'
|
|
3
3
|
import { initializeWithBTDevice, setupBTDevice, useBtDevice } from './extra/bt_device'
|
|
4
4
|
import { useRfidSelfHostedUI, rfidSelfHostedUI } from './extra/custom_rfid'
|
|
5
5
|
|
|
6
6
|
var documentReader = DocumentReader.instance
|
|
7
|
-
var selectedScenario
|
|
7
|
+
var selectedScenario = Scenario.MRZ
|
|
8
8
|
var doRfid = false
|
|
9
9
|
var isReadingRfid = false
|
|
10
10
|
|
|
@@ -36,7 +36,7 @@ async function recognize() {
|
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export function handleCompletion(action, results, error) {
|
|
39
|
+
export function handleCompletion(action: DocReaderAction, results: Results | null, error: DocReaderException | null) {
|
|
40
40
|
handleException(error)
|
|
41
41
|
if (DocReaderAction.stopped(action) && !shouldRfid(results)) {
|
|
42
42
|
displayResults(results)
|
|
@@ -46,7 +46,7 @@ export function handleCompletion(action, results, error) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export async function displayResults(results) {
|
|
49
|
+
export async function displayResults(results: Results | null) {
|
|
50
50
|
isReadingRfid = false
|
|
51
51
|
clearResults()
|
|
52
52
|
if (results == null) return
|
|
@@ -65,7 +65,7 @@ var readRfid = () => {
|
|
|
65
65
|
documentReader.rfid(new RFIDConfig(handleCompletion))
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
function shouldRfid(results) {
|
|
68
|
+
function shouldRfid(results: Results | null) {
|
|
69
69
|
return doRfid &&
|
|
70
70
|
!isReadingRfid &&
|
|
71
71
|
results != null && results.chipPage != 0
|
|
@@ -76,13 +76,14 @@ var initialize = async () => {
|
|
|
76
76
|
|
|
77
77
|
var license = await loadAsset("regula.license")
|
|
78
78
|
var initConfig = new InitConfig(license)
|
|
79
|
+
initConfig.delayedNNLoad = true
|
|
79
80
|
var [success, error] = await documentReader.initialize(initConfig)
|
|
80
81
|
|
|
81
82
|
handleException(error)
|
|
82
83
|
return success
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
export function handleException(error) {
|
|
86
|
+
export function handleException(error: DocReaderException | null) {
|
|
86
87
|
if (error != null) {
|
|
87
88
|
setStatus(error.message)
|
|
88
89
|
console.log(error.code + ": " + error.message)
|
|
@@ -91,13 +92,13 @@ export function handleException(error) {
|
|
|
91
92
|
|
|
92
93
|
// --------------------------------------------------------------------------------------------------------------------
|
|
93
94
|
|
|
94
|
-
var documentUIImage
|
|
95
|
-
var portraitUIImage
|
|
95
|
+
var documentUIImage: HTMLImageElement
|
|
96
|
+
var portraitUIImage: HTMLImageElement
|
|
96
97
|
export function main() {
|
|
97
|
-
documentUIImage = document.getElementById("document-image")
|
|
98
|
-
portraitUIImage = document.getElementById("portrait-image")
|
|
99
|
-
document.getElementById("scan")
|
|
100
|
-
document.getElementById("recognize")
|
|
98
|
+
documentUIImage = document.getElementById("document-image") as HTMLImageElement
|
|
99
|
+
portraitUIImage = document.getElementById("portrait-image") as HTMLImageElement
|
|
100
|
+
document.getElementById("scan")!.onclick = () => scan()
|
|
101
|
+
document.getElementById("recognize")!.onclick = () => recognize()
|
|
101
102
|
|
|
102
103
|
// custom rfid
|
|
103
104
|
if (useRfidSelfHostedUI) readRfid = () => rfidSelfHostedUI()
|
|
@@ -110,17 +111,17 @@ export function main() {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
export function setStatus(data) {
|
|
114
|
+
export function setStatus(data: string | null) {
|
|
114
115
|
if (data != null)
|
|
115
|
-
document.getElementById("status")
|
|
116
|
+
document.getElementById("status")!.innerHTML = data
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
function setPortrait(data) {
|
|
119
|
+
function setPortrait(data: string | null) {
|
|
119
120
|
if (data != null)
|
|
120
121
|
portraitUIImage.src = "data:image/png;base64," + data
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
function setDocImage(data) {
|
|
124
|
+
function setDocImage(data: string | null) {
|
|
124
125
|
if (data != null)
|
|
125
126
|
documentUIImage.src = "data:image/png;base64," + data
|
|
126
127
|
}
|
|
@@ -131,10 +132,9 @@ function clearResults() {
|
|
|
131
132
|
documentUIImage.src = "images/document.png"
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
function setCanRfid(data) {
|
|
135
|
-
var checkbox
|
|
136
|
-
|
|
137
|
-
var checkboxDescription = document.getElementById("rfid-checkbox-description")
|
|
135
|
+
function setCanRfid(data: boolean) {
|
|
136
|
+
var checkbox = document.getElementById('rfid-checkbox') as HTMLInputElement
|
|
137
|
+
var checkboxDescription = document.getElementById("rfid-checkbox-description")!
|
|
138
138
|
if (data) {
|
|
139
139
|
checkbox.disabled = false
|
|
140
140
|
checkboxDescription.innerHTML = "Process rfid reading"
|
|
@@ -147,9 +147,8 @@ function setCanRfid(data) {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
function setScenarios(data) {
|
|
151
|
-
|
|
152
|
-
var scenariosContainer = document.getElementById("scenarios")
|
|
150
|
+
function setScenarios(data: DocReaderScenario[]) {
|
|
151
|
+
var scenariosContainer = document.getElementById("scenarios")!
|
|
153
152
|
|
|
154
153
|
data.forEach(scenario => {
|
|
155
154
|
var checked = selectedScenario == scenario.name ? "checked" : ""
|
|
@@ -161,11 +160,10 @@ function setScenarios(data) {
|
|
|
161
160
|
})
|
|
162
161
|
|
|
163
162
|
data.forEach(scenario => {
|
|
164
|
-
var element
|
|
165
|
-
|
|
166
|
-
var elementCaption = document.getElementById(scenario.name + "-caption")
|
|
163
|
+
var element = document.getElementById(scenario.name) as HTMLInputElement
|
|
164
|
+
var elementCaption = document.getElementById(scenario.name + "-caption")!
|
|
167
165
|
var onclick = () => {
|
|
168
|
-
selectedScenario = scenario.name
|
|
166
|
+
selectedScenario = scenario.name as Scenario
|
|
169
167
|
element.checked = true
|
|
170
168
|
}
|
|
171
169
|
element.onclick = onclick
|
package/examples/ionic/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## How to build demo application
|
|
4
4
|
1. Download or the clone current repository using the command `git clone https://github.com/regulaforensics/npm-document-reader.git`.
|
|
5
|
-
|
|
6
5
|
2. Execute `npm run setup` within this directory.
|
|
7
|
-
|
|
8
6
|
3. Run the app:
|
|
9
7
|
* IOS: `npm run ios`.
|
|
10
8
|
* Android: `npm run android`.
|
|
@@ -15,7 +13,7 @@
|
|
|
15
13
|
|
|
16
14
|
### Bluetooth device
|
|
17
15
|
|
|
18
|
-
In order to connect to an external scanning device, change the `useBtDevice` constant to true in `src/extra/bt_device`, and set `btDeviceName` to the name of
|
|
16
|
+
In order to connect to an external scanning device, change the `useBtDevice` constant to true in `src/extra/bt_device`, and set `btDeviceName` to the name of your device. After running the app, click `Connect`.
|
|
19
17
|
|
|
20
18
|
### RFID self hosted UI
|
|
21
19
|
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"options": {
|
|
12
12
|
"outputPath": "www",
|
|
13
13
|
"index": "index.html",
|
|
14
|
-
"main": "index.
|
|
14
|
+
"main": "index.tsx",
|
|
15
15
|
"tsConfig": "tsconfig.json",
|
|
16
16
|
"assets": [
|
|
17
17
|
{
|
|
18
18
|
"glob": "**/*",
|
|
19
|
-
"input": "
|
|
19
|
+
"input": "assets",
|
|
20
20
|
"output": "assets"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"glob": "**/*",
|
|
24
|
-
"input": "
|
|
24
|
+
"input": "images",
|
|
25
25
|
"output": "images"
|
|
26
26
|
}
|
|
27
27
|
]
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<widget android-packageName="com.regula.dr.fullauthrfid" ios-CFBundleIdentifier="regula.DocumentReader" version="1.0.0"
|
|
3
3
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
4
4
|
<name>DocumentReader</name>
|
|
5
|
-
<icon src="
|
|
5
|
+
<icon src="images/icon.png" />
|
|
6
6
|
<platform name="android">
|
|
7
|
-
<resource-file src="
|
|
7
|
+
<resource-file src="assets/db.dat" target="app/src/main/assets/Regula/db.dat" />
|
|
8
8
|
<preference name="orientation" value="portrait" />
|
|
9
9
|
<preference name="android-minSdkVersion" value="24" />
|
|
10
10
|
<preference name="android-targetSdkVersion" value="35" />
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</edit-config>
|
|
19
19
|
</platform>
|
|
20
20
|
<platform name="ios">
|
|
21
|
-
<resource-file src="
|
|
21
|
+
<resource-file src="assets/db.dat" />
|
|
22
22
|
<preference name="orientation" value="portrait" />
|
|
23
23
|
<allow-intent href="itms:*" />
|
|
24
24
|
<allow-intent href="itms-apps:*" />
|
|
@@ -31,5 +31,29 @@
|
|
|
31
31
|
<config-file parent="NSBluetoothAlwaysUsageDescription" target="*-Info.plist">
|
|
32
32
|
<string>To use btdevice</string>
|
|
33
33
|
</config-file>
|
|
34
|
+
<config-file parent="NFCReaderUsageDescription" target="*-Info.plist">
|
|
35
|
+
<string>To use NFC</string>
|
|
36
|
+
</config-file>
|
|
37
|
+
<config-file parent="com.apple.developer.nfc.readersession.iso7816.select-identifiers" target="*-Info.plist">
|
|
38
|
+
<array>
|
|
39
|
+
<string>A0000002471001</string>
|
|
40
|
+
<string>E80704007F00070302</string>
|
|
41
|
+
<string>A000000167455349474E</string>
|
|
42
|
+
<string>A0000002480100</string>
|
|
43
|
+
<string>A0000002480200</string>
|
|
44
|
+
<string>A0000002480300</string>
|
|
45
|
+
<string>A00000045645444C2D3031</string>
|
|
46
|
+
</array>
|
|
47
|
+
</config-file>
|
|
48
|
+
<config-file parent="com.apple.developer.nfc.readersession.formats" target="*-Debug.plist">
|
|
49
|
+
<array>
|
|
50
|
+
<string>TAG</string>
|
|
51
|
+
</array>
|
|
52
|
+
</config-file>
|
|
53
|
+
<config-file parent="com.apple.developer.nfc.readersession.formats" target="*-Release.plist">
|
|
54
|
+
<array>
|
|
55
|
+
<string>TAG</string>
|
|
56
|
+
</array>
|
|
57
|
+
</config-file>
|
|
34
58
|
</platform>
|
|
35
59
|
</widget>
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"android": "scripts/android.sh"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@regulaforensics/document-reader": "8.3.
|
|
10
|
-
"@regulaforensics/document-reader-core-fullauthrfid": "8.
|
|
11
|
-
"@regulaforensics/document-reader-btdevice": "8.
|
|
9
|
+
"@regulaforensics/document-reader": "8.3.272-beta",
|
|
10
|
+
"@regulaforensics/document-reader-core-fullauthrfid": "8.2.8-beta",
|
|
11
|
+
"@regulaforensics/document-reader-btdevice": "8.2.8-beta",
|
|
12
12
|
"@awesome-cordova-plugins/file": "6.14.0",
|
|
13
13
|
"@awesome-cordova-plugins/camera": "6.14.0",
|
|
14
14
|
"cordova-ios": "7.1.1",
|
|
@@ -5,7 +5,7 @@ export const useBtDevice = false
|
|
|
5
5
|
export const btDeviceName = "Regula 0000"
|
|
6
6
|
|
|
7
7
|
export function setupBTDevice() {
|
|
8
|
-
var connectButton = document.getElementById("connect")
|
|
8
|
+
var connectButton = document.getElementById("connect")!
|
|
9
9
|
connectButton.style.display = "flex"
|
|
10
10
|
connectButton.onclick = () => connect()
|
|
11
11
|
setStatus("Connect to a bluetooth device")
|
|
@@ -16,7 +16,7 @@ async function connect() {
|
|
|
16
16
|
if (await DocumentReader.instance.connectBluetoothDevice(btDeviceName)) {
|
|
17
17
|
await init()
|
|
18
18
|
DocumentReader.instance.functionality.useAuthenticator = true
|
|
19
|
-
document.getElementById("
|
|
19
|
+
document.getElementById("connect")!.style.display = "none"
|
|
20
20
|
} else
|
|
21
21
|
setStatus("Failed to connect")
|
|
22
22
|
}
|
|
@@ -28,7 +28,7 @@ function setup() {
|
|
|
28
28
|
setProgress(-1)
|
|
29
29
|
currentProgress = -1
|
|
30
30
|
setShowing(true)
|
|
31
|
-
document.getElementById("cancel-rfid")
|
|
31
|
+
document.getElementById("cancel-rfid")!.onclick = () => stop()
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function stop() {
|
|
@@ -37,13 +37,13 @@ function stop() {
|
|
|
37
37
|
setShowing(false)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function setDescription(data) {
|
|
41
|
-
document.getElementById("rfid-description")
|
|
40
|
+
function setDescription(data: string) {
|
|
41
|
+
document.getElementById("rfid-description")!.innerHTML = data
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
var currentProgress = -1
|
|
45
|
-
function setProgress(next) {
|
|
46
|
-
var progress = document.getElementById("progress")
|
|
45
|
+
function setProgress(next: number) {
|
|
46
|
+
var progress = document.getElementById("progress")!
|
|
47
47
|
// make progress bar look better
|
|
48
48
|
if (next == 0) return // ignore idle 0s, leave progress at 100 while its not moving
|
|
49
49
|
if (next < currentProgress) next = 0 // move to 0 if progress finaly started moving
|
|
@@ -55,7 +55,7 @@ function setProgress(next) {
|
|
|
55
55
|
currentProgress = next
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function setShowing(data) {
|
|
59
|
-
document.getElementById("main")
|
|
60
|
-
document.getElementById("custom-rfid")
|
|
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
61
|
}
|
|
@@ -8,6 +8,19 @@ body {
|
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
}
|
|
10
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
|
+
/* Prevent image dragging */
|
|
20
|
+
img {
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
.column {
|
|
12
25
|
display: flex;
|
|
13
26
|
flex-direction: column;
|
|
@@ -131,4 +144,4 @@ input[type="text"] {
|
|
|
131
144
|
height: 20px;
|
|
132
145
|
background-color: #4285F4;
|
|
133
146
|
border-radius: 5px;
|
|
134
|
-
}
|
|
147
|
+
}
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
<div class="progress-bar">
|
|
34
34
|
<div id="progress"></div>
|
|
35
35
|
</div>
|
|
36
|
-
<button id="cancel-rfid" class="text-button" style="margin-top: 50px;">X</button>
|
|
36
|
+
<button id="cancel-rfid" class="text-button" style="margin-top: 50px; padding-bottom: 100px;">X</button>
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|