@regulaforensics/document-reader 9.9.1155-beta → 9.9.1161-nightly
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 +1 -3
- package/RNDocumentReader.podspec +21 -0
- package/android/CVDDocumentReader.kt +3 -4
- package/android/build.gradle +36 -0
- package/android/cordova.gradle +12 -0
- package/android/src/main/kotlin/com/regula/plugin/{document/reader → documentreader}/BluetoothUtil.kt +1 -1
- package/android/src/main/kotlin/com/regula/plugin/{document/reader → documentreader}/Config.kt +3 -3
- package/android/src/main/kotlin/com/regula/plugin/{document/reader → documentreader}/JSONConstructor.kt +4 -4
- package/android/src/main/kotlin/com/regula/plugin/{document/reader → documentreader}/Main.kt +3 -3
- package/android/src/main/kotlin/com/regula/plugin/{document/reader → documentreader}/RNDocumentReaderModule.kt +3 -4
- package/android/src/main/kotlin/com/regula/plugin/{document/reader → documentreader}/Utils.kt +1 -1
- package/app.plugin.js +7 -10
- package/examples/capacitor/README.md +0 -2
- package/examples/capacitor/android/app/build.gradle +10 -1
- package/examples/capacitor/android/app/src/main/AndroidManifest.xml +0 -9
- package/examples/capacitor/android/build.gradle +3 -12
- package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/examples/capacitor/android/gradle.properties +0 -4
- package/examples/capacitor/android/gradlew +7 -4
- package/examples/capacitor/android/gradlew.bat +24 -12
- package/examples/capacitor/android/variables.gradle +9 -13
- package/examples/capacitor/index.tsx +23 -15
- package/examples/capacitor/ios/App/App/AppDelegate.swift +40 -5
- package/examples/capacitor/ios/App/App/Info.plist +2 -19
- package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +86 -30
- package/examples/capacitor/package.json +18 -13
- package/examples/capacitor/scripts/android.sh +8 -5
- package/examples/capacitor/scripts/ios.sh +7 -5
- package/examples/capacitor/scripts/setup.sh +7 -2
- package/examples/capacitor/src/main.css +0 -5
- package/examples/capacitor/vite.config.ts +12 -0
- package/examples/ionic/README.md +0 -2
- package/examples/ionic/config.xml +1 -1
- package/examples/ionic/index.tsx +3 -8
- package/examples/ionic/package-lock.json +7536 -6029
- package/examples/ionic/package.json +33 -24
- package/examples/ionic/scripts/android.sh +2 -0
- package/examples/ionic/scripts/ios.sh +2 -0
- package/examples/ionic/scripts/setup.sh +2 -0
- package/examples/ionic/tsconfig.json +1 -0
- package/examples/react_native/README.md +0 -2
- package/examples/react_native/app.config.ts +2 -1
- package/examples/react_native/package-lock.json +4015 -2002
- package/examples/react_native/package.json +19 -14
- package/examples/react_native/scripts/android.sh +3 -3
- package/examples/react_native/scripts/ios.sh +3 -3
- package/examples/react_native/scripts/setup.sh +3 -4
- package/examples/react_native/vendor/image-size-metro-compat/index.cjs +16 -0
- package/examples/react_native/vendor/image-size-metro-compat/package.json +8 -0
- package/package.json +1 -1
- package/plugin.xml +12 -12
- package/test/package-lock.json +2 -5
- package/Package.swift +0 -28
- package/android/build.gradle.kts +0 -37
- package/android/cordova.gradle.kts +0 -13
- package/examples/capacitor/android/app/src/main/res/xml/file_paths.xml +0 -5
- package/examples/capacitor/capacitor.config.json +0 -15
- package/examples/capacitor/ios/App/App/SceneDelegate.swift +0 -23
- package/examples/capacitor/ios/App/CapApp-SPM/Sources/CapApp-SPM/CapApp-SPM.swift +0 -1
- package/examples/capacitor-cocoapods/README.md +0 -22
- package/examples/capacitor-cocoapods/android/app/build.gradle +0 -50
- package/examples/capacitor-cocoapods/android/app/proguard-rules.pro +0 -21
- package/examples/capacitor-cocoapods/android/app/src/main/AndroidManifest.xml +0 -27
- package/examples/capacitor-cocoapods/android/app/src/main/assets/Regula/.gitkeep +0 -0
- package/examples/capacitor-cocoapods/android/app/src/main/java/com/regula/example/dr/capacitor/MainActivity.java +0 -5
- package/examples/capacitor-cocoapods/android/app/src/main/res/drawable/ic_launcher.png +0 -0
- package/examples/capacitor-cocoapods/android/app/src/main/res/drawable/ic_launcher_foreground.png +0 -0
- package/examples/capacitor-cocoapods/android/app/src/main/res/drawable/ic_launcher_round.png +0 -0
- package/examples/capacitor-cocoapods/android/app/src/main/res/drawable/launcher.xml +0 -4
- package/examples/capacitor-cocoapods/android/app/src/main/res/drawable/launcher_round.xml +0 -4
- package/examples/capacitor-cocoapods/android/app/src/main/res/drawable/splash.png +0 -0
- package/examples/capacitor-cocoapods/android/app/src/main/res/layout/activity_main.xml +0 -12
- package/examples/capacitor-cocoapods/android/app/src/main/res/values/styles.xml +0 -22
- package/examples/capacitor-cocoapods/android/build.gradle +0 -30
- package/examples/capacitor-cocoapods/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/capacitor-cocoapods/android/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/examples/capacitor-cocoapods/android/gradle.properties +0 -22
- package/examples/capacitor-cocoapods/android/gradlew +0 -251
- package/examples/capacitor-cocoapods/android/gradlew.bat +0 -94
- package/examples/capacitor-cocoapods/android/settings.gradle +0 -5
- package/examples/capacitor-cocoapods/android/variables.gradle +0 -16
- package/examples/capacitor-cocoapods/index.html +0 -5
- package/examples/capacitor-cocoapods/index.tsx +0 -39
- package/examples/capacitor-cocoapods/ios/App/App/App.entitlements +0 -10
- package/examples/capacitor-cocoapods/ios/App/App/AppDelegate.swift +0 -49
- package/examples/capacitor-cocoapods/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
- package/examples/capacitor-cocoapods/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -14
- package/examples/capacitor-cocoapods/ios/App/App/Assets.xcassets/Contents.json +0 -6
- package/examples/capacitor-cocoapods/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +0 -23
- package/examples/capacitor-cocoapods/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
- package/examples/capacitor-cocoapods/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
- package/examples/capacitor-cocoapods/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
- package/examples/capacitor-cocoapods/ios/App/App/Base.lproj/LaunchScreen.storyboard +0 -32
- package/examples/capacitor-cocoapods/ios/App/App/Info.plist +0 -69
- package/examples/capacitor-cocoapods/ios/App/App.xcodeproj/project.pbxproj +0 -430
- package/examples/capacitor-cocoapods/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/examples/capacitor-cocoapods/package.json +0 -30
- package/examples/capacitor-cocoapods/public/assets/.gitkeep +0 -0
- package/examples/capacitor-cocoapods/public/images/document.png +0 -0
- package/examples/capacitor-cocoapods/public/images/portrait.png +0 -0
- package/examples/capacitor-cocoapods/scripts/android.sh +0 -11
- package/examples/capacitor-cocoapods/scripts/ios.sh +0 -10
- package/examples/capacitor-cocoapods/scripts/setup.sh +0 -14
- package/examples/capacitor-cocoapods/src/extra/bt_device.tsx +0 -33
- package/examples/capacitor-cocoapods/src/extra/custom_rfid.tsx +0 -61
- package/examples/capacitor-cocoapods/src/main.css +0 -148
- package/examples/capacitor-cocoapods/src/main.html +0 -38
- package/examples/capacitor-cocoapods/src/main.tsx +0 -172
- package/examples/capacitor-cocoapods/tsconfig.json +0 -5
- package/examples/capacitor-cocoapods/vite.config.ts +0 -17
- package/examples/ionic-cocoapods/README.md +0 -22
- package/examples/ionic-cocoapods/angular.json +0 -39
- package/examples/ionic-cocoapods/assets/.gitkeep +0 -0
- package/examples/ionic-cocoapods/config.xml +0 -63
- 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 +0 -19
- package/examples/ionic-cocoapods/index.tsx +0 -58
- package/examples/ionic-cocoapods/ionic.config.json +0 -7
- package/examples/ionic-cocoapods/package-lock.json +0 -16579
- package/examples/ionic-cocoapods/package.json +0 -58
- package/examples/ionic-cocoapods/scripts/android.sh +0 -8
- package/examples/ionic-cocoapods/scripts/ios.sh +0 -8
- package/examples/ionic-cocoapods/scripts/setup.sh +0 -8
- package/examples/ionic-cocoapods/src/extra/bt_device.tsx +0 -33
- package/examples/ionic-cocoapods/src/extra/custom_rfid.tsx +0 -61
- package/examples/ionic-cocoapods/src/main.css +0 -148
- package/examples/ionic-cocoapods/src/main.html +0 -38
- package/examples/ionic-cocoapods/src/main.tsx +0 -172
- package/examples/ionic-cocoapods/tsconfig.json +0 -14
- package/ios/module.modulemap +0 -7
- package/react-native-document-reader.podspec +0 -14
- /package/examples/{capacitor-cocoapods → capacitor}/android/app/capacitor.build.gradle +0 -0
- /package/examples/{capacitor-cocoapods → capacitor}/android/capacitor.settings.gradle +0 -0
- /package/examples/{capacitor-cocoapods → capacitor}/ionic.config.json +0 -0
- /package/examples/{capacitor-cocoapods → capacitor}/ios/App/App/Base.lproj/Main.storyboard +0 -0
- /package/examples/{capacitor-cocoapods → capacitor}/ios/App/App.xcworkspace/contents.xcworkspacedata +0 -0
- /package/examples/{capacitor-cocoapods → capacitor}/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- /package/examples/{capacitor-cocoapods → capacitor}/ios/App/Podfile +0 -0
- /package/examples/{capacitor-cocoapods → capacitor}/ios/App/Podfile.lock +0 -0
- /package/examples/{capacitor-cocoapods → capacitor}/package-lock.json +0 -0
|
@@ -1,58 +0,0 @@
|
|
|
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.1155-beta",
|
|
22
|
-
"@regulaforensics/document-reader-core-fullauthrfid": "9.8.2852-beta",
|
|
23
|
-
"@regulaforensics/document-reader-btdevice": "9.9.90-beta",
|
|
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
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
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>
|
|
@@ -1,172 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
}
|
package/ios/module.modulemap
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
Pod::Spec.new do |s|
|
|
2
|
-
s.name = 'react-native-document-reader'
|
|
3
|
-
s.version = '9.9.1155-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}'
|
|
11
|
-
s.exclude_files = [ 'ios/CVDDocumentReader.h', 'ios/CVDDocumentReader.m' ]
|
|
12
|
-
s.dependency 'DocumentReader', '9.8.6944'
|
|
13
|
-
s.dependency 'React'
|
|
14
|
-
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/examples/{capacitor-cocoapods → capacitor}/ios/App/App.xcworkspace/contents.xcworkspacedata
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|