@regulaforensics/ionic-native-document-reader 6.9.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/example/README.md +8 -6
- package/example/config.xml +5 -8
- package/example/package.json +14 -23
- package/example/src/app/home/home.module.ts +2 -4
- package/example/src/app/home/home.page.ts +82 -159
- package/index.d.ts +324 -342
- package/index.js +250 -96
- package/ngx/index.d.ts +324 -342
- package/ngx/index.js +254 -100
- package/package.json +1 -1
- package/reactExample/.browserslistrc +6 -0
- package/reactExample/.eslintrc.js +17 -0
- package/reactExample/README.md +9 -6
- package/reactExample/android/app/build.gradle +3 -0
- package/reactExample/android/app/capacitor.build.gradle +22 -0
- package/reactExample/android/app/src/main/AndroidManifest.xml +4 -7
- package/reactExample/android/app/src/main/assets/Regula/.gitkeep +0 -0
- package/reactExample/android/app/src/main/res/values/styles.xml +2 -2
- package/reactExample/android/build.gradle +9 -5
- package/reactExample/android/capacitor.settings.gradle +15 -0
- package/reactExample/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/reactExample/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/reactExample/android/gradle.properties +0 -2
- package/reactExample/android/gradlew +164 -105
- package/reactExample/android/gradlew.bat +92 -89
- package/reactExample/android/variables.gradle +14 -12
- package/reactExample/capacitor.config.ts +4 -2
- package/reactExample/cypress/e2e/test.cy.ts +6 -0
- package/reactExample/cypress/fixtures/example.json +5 -0
- package/reactExample/cypress/support/commands.ts +37 -0
- package/reactExample/cypress/support/e2e.ts +20 -0
- package/reactExample/cypress.config.ts +10 -0
- package/reactExample/index.html +116 -0
- package/reactExample/ionic.config.json +6 -6
- package/reactExample/ios/App/App/App.entitlements +0 -1
- package/reactExample/ios/App/App/AppDelegate.swift +0 -11
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +6 -108
- package/reactExample/ios/App/App/Info.plist +4 -4
- package/reactExample/ios/App/App.xcodeproj/project.pbxproj +14 -22
- package/reactExample/ios/App/Podfile +7 -3
- package/reactExample/package.json +58 -82
- package/reactExample/public/assets/.gitkeep +0 -0
- package/reactExample/src/components/ExploreContainer.css +24 -0
- package/reactExample/src/components/ExploreContainer.tsx +14 -0
- package/reactExample/src/main.tsx +11 -0
- package/reactExample/src/pages/Home.tsx +91 -162
- package/reactExample/src/theme/variables.css +6 -0
- package/reactExample/src/vite-env.d.ts +1 -0
- package/reactExample/tsconfig.json +10 -16
- package/reactExample/tsconfig.node.json +9 -0
- package/reactExample/vite.config.ts +16 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png +0 -0
- package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png +0 -0
- package/reactExample/ios/App/App/capacitor.config.json +0 -6
- package/reactExample/ios/App/App/config.xml +0 -19
- package/reactExample/ios/App/App.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/reactExample/public/assets/icon/icon.png +0 -0
- package/reactExample/public/assets/shapes.svg +0 -1
- package/reactExample/public/index.html +0 -114
- package/reactExample/src/assets/img/id.png +0 -0
- package/reactExample/src/assets/img/portrait.png +0 -0
- package/reactExample/src/index.tsx +0 -22
- package/reactExample/src/react-app-env.d.ts +0 -1
- package/reactExample/src/reportWebVitals.ts +0 -15
- package/reactExample/src/service-worker.ts +0 -80
- package/reactExample/src/serviceWorkerRegistration.ts +0 -142
- /package/reactExample/public/{assets/icon/favicon.png → favicon.png} +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { IonPage
|
|
2
|
-
import { DocumentReader, DocumentReaderScenario, Enum, DocumentReaderCompletion, DocumentReaderResults, DocumentReaderNotification, ScannerConfig, RecognizeConfig } from '@regulaforensics/ionic-native-document-reader'
|
|
1
|
+
import { IonPage } from '@ionic/react'
|
|
2
|
+
import { DocumentReader, DocumentReaderScenario, Enum, DocumentReaderCompletion, DocumentReaderResults, DocumentReaderNotification, ScannerConfig, RecognizeConfig, DocReaderConfig } from '@regulaforensics/ionic-native-document-reader'
|
|
3
3
|
import React from "react"
|
|
4
|
-
import { DirectoryEntry,
|
|
5
|
-
import {
|
|
6
|
-
import { ImagePicker } from "@awesome-cordova-plugins/image-picker"
|
|
4
|
+
import { DirectoryEntry, File, FileEntry, IFile } from '@awesome-cordova-plugins/file'
|
|
5
|
+
import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera'
|
|
7
6
|
|
|
8
7
|
var selectedScenario = "Mrz"
|
|
9
8
|
var doRfid: boolean = false
|
|
@@ -29,59 +28,42 @@ const rfidDescriptionRef = document.querySelector('.rfidDescription') as HTMLEle
|
|
|
29
28
|
const rfidProgressRef = document.querySelector('.rfidProgress') as HTMLIonProgressBarElement
|
|
30
29
|
const cancelButtonRef = document.querySelector('.cancelButton') as HTMLElement
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
status.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
console.log(e)
|
|
40
|
-
alert(e)
|
|
31
|
+
function onInitialized() {
|
|
32
|
+
status.innerHTML = "Ready"
|
|
33
|
+
status.style.backgroundColor = "green"
|
|
34
|
+
|
|
35
|
+
DocumentReader.setFunctionality({
|
|
36
|
+
showCaptureButton: true
|
|
37
|
+
})
|
|
41
38
|
}
|
|
42
39
|
|
|
43
|
-
cancelButtonRef.addEventListener("click",
|
|
40
|
+
cancelButtonRef.addEventListener("click", hideRfidUI)
|
|
44
41
|
updateUI()
|
|
45
42
|
status.innerHTML = "loading......"
|
|
46
43
|
status.style.backgroundColor = "grey"
|
|
47
44
|
document.addEventListener("deviceready", onDeviceReady, false)
|
|
48
45
|
|
|
49
46
|
function onDeviceReady() {
|
|
50
|
-
readFile("public/assets", "regula.license", (license:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function addCertificates() {
|
|
66
|
-
File.resolveDirectoryUrl(File.applicationDirectory + "certificates").then((dir: DirectoryEntry) => {
|
|
67
|
-
dir.createReader().readEntries((entries: Entry[]) => {
|
|
68
|
-
for (let i = 0; i < entries.length; i++) {
|
|
69
|
-
if (entries[i].isFile) {
|
|
70
|
-
var findExt = entries[i].name.split('.')
|
|
71
|
-
var pkdResourceType = 0
|
|
72
|
-
if (findExt.length > 0)
|
|
73
|
-
pkdResourceType = Enum.PKDResourceType.getType(findExt[findExt.length - 1].toLowerCase())
|
|
74
|
-
readFile("certificates", entries[i].name, (file: any, resType: any) => {
|
|
75
|
-
resType = resType[0]
|
|
76
|
-
var certificates = []
|
|
77
|
-
certificates.push({
|
|
78
|
-
'binaryData': file,
|
|
79
|
-
'resourceType': resType
|
|
80
|
-
})
|
|
81
|
-
DocumentReader.addPKDCertificates(certificates).then((_r: string) => console.log("certificate added")).catch(error1)
|
|
82
|
-
}, pkdResourceType)
|
|
83
|
-
}
|
|
47
|
+
readFile("public/assets", "regula.license", (license: string) => {
|
|
48
|
+
var config = new DocReaderConfig()
|
|
49
|
+
config.license = license
|
|
50
|
+
config.delayedNNLoad = true
|
|
51
|
+
DocumentReader.initializeReader(config).then((message: string) => {
|
|
52
|
+
var callback = JSON.parse(message)
|
|
53
|
+
if (!callback.success) {
|
|
54
|
+
var error = "Init error: " + callback.error.message
|
|
55
|
+
console.log(error)
|
|
56
|
+
status.innerHTML = error
|
|
57
|
+
status.style.backgroundColor = "red"
|
|
58
|
+
return
|
|
84
59
|
}
|
|
60
|
+
console.log("Init complete")
|
|
61
|
+
showScannerButton.addEventListener("click", scan)
|
|
62
|
+
showImagePicker.addEventListener("click", recognize)
|
|
63
|
+
DocumentReader.getAvailableScenarios().then((sc: string) =>
|
|
64
|
+
DocumentReader.getIsRFIDAvailableForUse().then((canRfid: boolean) =>
|
|
65
|
+
postInitialize(JSON.parse(sc), canRfid)))
|
|
66
|
+
onInitialized()
|
|
85
67
|
})
|
|
86
68
|
})
|
|
87
69
|
}
|
|
@@ -89,7 +71,7 @@ function addCertificates() {
|
|
|
89
71
|
function readFile(dirPath: string, fileName: string, callback: any, ...items: any) {
|
|
90
72
|
File.resolveDirectoryUrl(File.applicationDirectory + dirPath).then((dir: DirectoryEntry) => File.getFile(dir, fileName, {})).then((fileEntry: FileEntry) => fileEntry.file((file: IFile) => {
|
|
91
73
|
var reader = new FileReader()
|
|
92
|
-
reader.onloadend = (
|
|
74
|
+
reader.onloadend = (_) => {
|
|
93
75
|
var data = reader.result as String
|
|
94
76
|
data = data.substring(data.indexOf(',') + 1)
|
|
95
77
|
callback(data, items)
|
|
@@ -107,33 +89,27 @@ function updateUI() {
|
|
|
107
89
|
rfidProgressRef.value = rfidProgress
|
|
108
90
|
}
|
|
109
91
|
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (completion == undefined) return
|
|
117
|
-
console.log("DocReaderAction: " + completion.action)
|
|
118
|
-
if (isReadingRfidCustomUi && (completion.action === Enum.DocReaderAction.CANCEL || completion.action === Enum.DocReaderAction.ERROR))
|
|
119
|
-
hideRfidUI()
|
|
120
|
-
if (isReadingRfidCustomUi && completion.action === Enum.DocReaderAction.NOTIFICATION)
|
|
121
|
-
updateRfidUI(completion.results!.documentReaderNotification!)
|
|
122
|
-
if (completion.action === Enum.DocReaderAction.COMPLETE)
|
|
123
|
-
if (isReadingRfidCustomUi) {
|
|
124
|
-
if (completion.results!.rfidResult !== 1)
|
|
125
|
-
restartRfidUI()
|
|
126
|
-
else {
|
|
127
|
-
hideRfidUI()
|
|
128
|
-
displayResults(completion.results!)
|
|
129
|
-
}
|
|
92
|
+
function handleCompletion(completion: DocumentReaderCompletion) {
|
|
93
|
+
if (isReadingRfidCustomUi) {
|
|
94
|
+
if (completion.action == Enum.DocReaderAction.ERROR) restartRfidUI()
|
|
95
|
+
if (actionSuccess(completion.action!) || actionError(completion.action!)) {
|
|
96
|
+
hideRfidUI()
|
|
97
|
+
displayResults(completion.results!)
|
|
130
98
|
}
|
|
131
|
-
|
|
132
|
-
handleResults(completion.results!)
|
|
133
|
-
if (completion.action === Enum.DocReaderAction.TIMEOUT)
|
|
99
|
+
} else if (actionSuccess(completion.action!))
|
|
134
100
|
handleResults(completion.results!)
|
|
135
101
|
}
|
|
136
102
|
|
|
103
|
+
function actionSuccess(action: number) {
|
|
104
|
+
if (action == Enum.DocReaderAction.COMPLETE || action == Enum.DocReaderAction.TIMEOUT) return true
|
|
105
|
+
return false
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function actionError(action: number) {
|
|
109
|
+
if (action == Enum.DocReaderAction.CANCEL || action == Enum.DocReaderAction.ERROR) return true
|
|
110
|
+
return false
|
|
111
|
+
}
|
|
112
|
+
|
|
137
113
|
function showRfidUI() {
|
|
138
114
|
// show animation
|
|
139
115
|
isReadingRfidCustomUi = true
|
|
@@ -142,6 +118,7 @@ function showRfidUI() {
|
|
|
142
118
|
|
|
143
119
|
function hideRfidUI() {
|
|
144
120
|
// show animation
|
|
121
|
+
DocumentReader.stopRFIDReader()
|
|
145
122
|
restartRfidUI()
|
|
146
123
|
isReadingRfidCustomUi = false
|
|
147
124
|
rfidUIHeader = "Reading RFID"
|
|
@@ -159,72 +136,36 @@ function restartRfidUI() {
|
|
|
159
136
|
|
|
160
137
|
function updateRfidUI(notification: DocumentReaderNotification) {
|
|
161
138
|
if (notification.notificationCode === Enum.eRFID_NotificationCodes.RFID_NOTIFICATION_PCSC_READING_DATAGROUP)
|
|
162
|
-
rfidDescription = notification.dataFileType
|
|
139
|
+
rfidDescription = "ERFIDDataFileType: " + notification.dataFileType
|
|
163
140
|
rfidUIHeader = "Reading RFID"
|
|
164
141
|
rfidUIHeaderColor = "black"
|
|
165
|
-
|
|
142
|
+
if (notification.progress != undefined)
|
|
143
|
+
rfidProgress = notification.progress
|
|
166
144
|
updateUI()
|
|
167
|
-
if (isPlatform("ios"))
|
|
168
|
-
DocumentReader.setRfidSessionStatus(rfidDescription + "\n" + notification.progress + "%")
|
|
169
145
|
}
|
|
170
146
|
|
|
171
147
|
function customRFID() {
|
|
172
148
|
showRfidUI()
|
|
173
|
-
DocumentReader.readRFID().subscribe((m: string) =>
|
|
174
|
-
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m))))
|
|
149
|
+
DocumentReader.readRFID(false, false, false).subscribe((m: string) => handleRfidCompletion(m))
|
|
175
150
|
}
|
|
176
151
|
|
|
177
152
|
function usualRFID() {
|
|
178
153
|
isReadingRfid = true
|
|
179
|
-
|
|
180
|
-
var paCert = "paCertificateCompletionEvent"
|
|
181
|
-
var taCert = "taCertificateCompletionEvent"
|
|
182
|
-
var taSig = "taSignatureCompletionEvent"
|
|
183
|
-
DocumentReader.startRFIDReader().subscribe((m: string) => {
|
|
184
|
-
if (m.substring(0, notification.length) === notification) {
|
|
185
|
-
m = m.substring(notification.length, m.length)
|
|
186
|
-
console.log(notification + ": " + m)
|
|
187
|
-
} else if (m.substring(0, paCert.length) === paCert) {
|
|
188
|
-
m = m.substring(paCert.length, m.length)
|
|
189
|
-
console.log(paCert + ": " + m)
|
|
190
|
-
} else if (m.substring(0, taCert.length) === taCert) {
|
|
191
|
-
m = m.substring(taCert.length, m.length)
|
|
192
|
-
console.log(taCert + ": " + m)
|
|
193
|
-
} else if (m.substring(0, taSig.length) === taSig) {
|
|
194
|
-
m = m.substring(taSig.length, m.length)
|
|
195
|
-
console.log(taSig + ": " + m)
|
|
196
|
-
} else
|
|
197
|
-
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m)))
|
|
198
|
-
})
|
|
154
|
+
DocumentReader.startRFIDReader(false, false, false).subscribe((m: string) => handleRfidCompletion(m))
|
|
199
155
|
}
|
|
200
156
|
|
|
201
|
-
function
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (
|
|
206
|
-
|
|
207
|
-
if (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
customization: {
|
|
215
|
-
showResultStatusMessages: true,
|
|
216
|
-
showStatusMessages: true
|
|
217
|
-
},
|
|
218
|
-
processParams: {
|
|
219
|
-
scenario: "Mrz",
|
|
220
|
-
doRfid: false
|
|
221
|
-
},
|
|
222
|
-
})
|
|
223
|
-
DocumentReader.getAvailableScenarios().then((sc: string) =>
|
|
224
|
-
DocumentReader.isRFIDAvailableForUse().then((canRfid: boolean) =>
|
|
225
|
-
postInitialize(JSON.parse(sc), canRfid)))
|
|
226
|
-
DocumentReader.setRfidDelegate(Enum.RFIDDelegate.NO_PA)
|
|
227
|
-
// addCertificates()
|
|
157
|
+
function handleRfidCompletion(raw: string) {
|
|
158
|
+
var idDetected = "rfidOnChipDetectedEvent"
|
|
159
|
+
var idProgress = "rfidOnProgressCompletion"
|
|
160
|
+
var idRetry = "rfidOnRetryReadChipEvent"
|
|
161
|
+
if (raw.substring(0, idDetected.length) === idDetected)
|
|
162
|
+
console.log("chip detected")
|
|
163
|
+
else if (raw.substring(0, idRetry.length) === idRetry)
|
|
164
|
+
console.log("error reading chip, retrying...")
|
|
165
|
+
else if (raw.substring(0, idProgress.length) === idProgress)
|
|
166
|
+
updateRfidUI(DocumentReaderNotification.fromJson(JSON.parse(raw.substring(idProgress.length, raw.length)))!)
|
|
167
|
+
else
|
|
168
|
+
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(raw))!)
|
|
228
169
|
}
|
|
229
170
|
|
|
230
171
|
function postInitialize(scenarios: Array<any>, canRfid: boolean) {
|
|
@@ -259,8 +200,7 @@ function postInitialize(scenarios: Array<any>, canRfid: boolean) {
|
|
|
259
200
|
}
|
|
260
201
|
|
|
261
202
|
function handleResults(results: DocumentReaderResults) {
|
|
262
|
-
|
|
263
|
-
if (doRfid && !isReadingRfid && results != null && results.chipPage != 0) {
|
|
203
|
+
if (doRfid && !isReadingRfid && results != null) {
|
|
264
204
|
// customRFID()
|
|
265
205
|
usualRFID()
|
|
266
206
|
} else {
|
|
@@ -292,49 +232,38 @@ function displayResults(results: DocumentReaderResults) {
|
|
|
292
232
|
|
|
293
233
|
function clearResults() {
|
|
294
234
|
status.innerHTML = "Ready"
|
|
295
|
-
|
|
296
|
-
|
|
235
|
+
status.style.backgroundColor = "green"
|
|
236
|
+
readFile("public/assets/img", "id.png", (img: string) => {
|
|
237
|
+
documentImage.src = "data:image/png;base64," + img
|
|
238
|
+
})
|
|
239
|
+
readFile("public/assets/img", "portrait.png", (img: string) => {
|
|
240
|
+
portraitImage.src = "data:image/png;base64," + img
|
|
241
|
+
})
|
|
297
242
|
}
|
|
298
243
|
|
|
299
244
|
function scan() {
|
|
245
|
+
clearResults()
|
|
300
246
|
var config = new ScannerConfig()
|
|
301
247
|
config.scenario = selectedScenario
|
|
302
248
|
DocumentReader.scan(config).subscribe((m: string) =>
|
|
303
|
-
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m))))
|
|
249
|
+
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m))!))
|
|
304
250
|
}
|
|
305
251
|
|
|
306
252
|
function recognize() {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m))))
|
|
322
|
-
})).catch(error2)
|
|
323
|
-
}, error2)
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function recognizeAndroid() {
|
|
327
|
-
AndroidPermissions.checkPermission(AndroidPermissions.PERMISSION.READ_EXTERNAL_STORAGE).then((result: any) => {
|
|
328
|
-
if (result.hasPermission)
|
|
329
|
-
recognize()
|
|
330
|
-
else
|
|
331
|
-
AndroidPermissions.requestPermission(AndroidPermissions.PERMISSION.READ_EXTERNAL_STORAGE).then((result: any) => {
|
|
332
|
-
if (result.hasPermission)
|
|
333
|
-
recognize()
|
|
334
|
-
else
|
|
335
|
-
console.log("storage permission denied")
|
|
336
|
-
}, (err: any) => console.log(JSON.stringify(err)))
|
|
337
|
-
}, (err: any) => console.log(JSON.stringify(err)))
|
|
253
|
+
Camera.getPicture({
|
|
254
|
+
destinationType: DestinationType.DATA_URL,
|
|
255
|
+
mediaType: MediaType.PICTURE,
|
|
256
|
+
sourceType: PictureSourceType.PHOTOLIBRARY
|
|
257
|
+
}).then((result: string) => {
|
|
258
|
+
clearResults()
|
|
259
|
+
status.innerHTML = "processing image......"
|
|
260
|
+
status.style.backgroundColor = "grey"
|
|
261
|
+
var config = new RecognizeConfig()
|
|
262
|
+
config.scenario = selectedScenario
|
|
263
|
+
config.image = result
|
|
264
|
+
DocumentReader.recognize(config).subscribe((m: string) =>
|
|
265
|
+
handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(m))!))
|
|
266
|
+
})
|
|
338
267
|
}
|
|
339
268
|
|
|
340
269
|
const Home: React.FC = () => {
|
|
@@ -234,3 +234,9 @@ http://ionicframework.com/docs/theming/ */
|
|
|
234
234
|
--ion-card-background: #1e1e1e;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
+
|
|
238
|
+
html {
|
|
239
|
+
/* For more information on dynamic font scaling, visit the documentation:
|
|
240
|
+
https://ionicframework.com/docs/layout/dynamic-font-scaling */
|
|
241
|
+
--ion-dynamic-font: var(--ion-default-dynamic-font);
|
|
242
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"esnext"
|
|
8
|
-
],
|
|
9
|
-
"allowJs": true,
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
6
|
+
"allowJs": false,
|
|
10
7
|
"skipLibCheck": true,
|
|
11
|
-
"esModuleInterop":
|
|
8
|
+
"esModuleInterop": false,
|
|
12
9
|
"allowSyntheticDefaultImports": true,
|
|
13
10
|
"strict": true,
|
|
14
11
|
"forceConsistentCasingInFileNames": true,
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"moduleResolution": "node",
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "Node",
|
|
18
14
|
"resolveJsonModule": true,
|
|
19
15
|
"isolatedModules": true,
|
|
20
16
|
"noEmit": true,
|
|
21
|
-
"jsx": "react-jsx"
|
|
22
|
-
"experimentalDecorators": true,
|
|
17
|
+
"jsx": "react-jsx"
|
|
23
18
|
},
|
|
24
|
-
"include": [
|
|
25
|
-
|
|
26
|
-
]
|
|
19
|
+
"include": ["src"],
|
|
20
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
27
21
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import legacy from '@vitejs/plugin-legacy'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import { defineConfig } from 'vite'
|
|
4
|
+
|
|
5
|
+
// https://vitejs.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [
|
|
8
|
+
react(),
|
|
9
|
+
legacy()
|
|
10
|
+
],
|
|
11
|
+
test: {
|
|
12
|
+
globals: true,
|
|
13
|
+
environment: 'jsdom',
|
|
14
|
+
setupFiles: './src/setupTests.ts',
|
|
15
|
+
}
|
|
16
|
+
})
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/reactExample/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png
DELETED
|
Binary file
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
|
3
|
-
<access origin="*" />
|
|
4
|
-
|
|
5
|
-
<feature name="DocumentReader">
|
|
6
|
-
<param name="ios-package" value="RGLDocumentReader"/>
|
|
7
|
-
</feature>
|
|
8
|
-
|
|
9
|
-
<feature name="File">
|
|
10
|
-
<param name="ios-package" value="CDVFile"/>
|
|
11
|
-
<param name="onload" value="true"/>
|
|
12
|
-
</feature>
|
|
13
|
-
|
|
14
|
-
<feature name="ImagePicker">
|
|
15
|
-
<param name="ios-package" value="SOSPicker"/>
|
|
16
|
-
</feature>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</widget>
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="350" height="140" xmlns="http://www.w3.org/2000/svg" style="background:#f6f7f9"><g fill="none" fill-rule="evenodd"><path fill="#F04141" style="mix-blend-mode:multiply" d="M61.905-34.23l96.194 54.51-66.982 54.512L22 34.887z"/><circle fill="#10DC60" style="mix-blend-mode:multiply" cx="155.5" cy="135.5" r="57.5"/><path fill="#3880FF" style="mix-blend-mode:multiply" d="M208.538 9.513l84.417 15.392L223.93 93.93z"/><path fill="#FFCE00" style="mix-blend-mode:multiply" d="M268.625 106.557l46.332-26.75 46.332 26.75v53.5l-46.332 26.75-46.332-26.75z"/><circle fill="#7044FF" style="mix-blend-mode:multiply" cx="299.5" cy="9.5" r="38.5"/><rect fill="#11D3EA" style="mix-blend-mode:multiply" transform="rotate(-60 148.47 37.886)" x="143.372" y="-7.056" width="10.196" height="89.884" rx="5.098"/><path d="M-25.389 74.253l84.86 8.107c5.498.525 9.53 5.407 9.004 10.905a10 10 0 0 1-.057.477l-12.36 85.671a10.002 10.002 0 0 1-11.634 8.42l-86.351-15.226c-5.44-.959-9.07-6.145-8.112-11.584l13.851-78.551a10 10 0 0 1 10.799-8.219z" fill="#7044FF" style="mix-blend-mode:multiply"/><circle fill="#0CD1E8" style="mix-blend-mode:multiply" cx="273.5" cy="106.5" r="20.5"/></g></svg>
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<title>Ionic App</title>
|
|
7
|
-
|
|
8
|
-
<base href="/" />
|
|
9
|
-
|
|
10
|
-
<meta name="color-scheme" content="light dark" />
|
|
11
|
-
<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
|
12
|
-
<meta name="format-detection" content="telephone=no" />
|
|
13
|
-
<meta name="msapplication-tap-highlight" content="no" />
|
|
14
|
-
|
|
15
|
-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
16
|
-
|
|
17
|
-
<link rel="shortcut icon" type="image/png" href="%PUBLIC_URL%/assets/icon/favicon.png" />
|
|
18
|
-
|
|
19
|
-
<!-- add to homescreen for ios -->
|
|
20
|
-
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
21
|
-
<meta name="apple-mobile-web-app-title" content="Ionic App" />
|
|
22
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
23
|
-
</head>
|
|
24
|
-
|
|
25
|
-
<body>
|
|
26
|
-
<div class="rfidUI" style="text-align: center; background-color: #F5FCFF; height: 100%; width:100%; display: none;">
|
|
27
|
-
<div style="position: absolute; top: 50%; left: 50%; width:100%; -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); ">
|
|
28
|
-
<p class="rfidUIHeader">Reading RFID</p>
|
|
29
|
-
<p class="rfidDescription">Place your phone on top of the NFC tag</p>
|
|
30
|
-
<progress class="rfidProgress" value="0" max="100"></progress>
|
|
31
|
-
<br><br><br>
|
|
32
|
-
<button class="cancelButton">X</button>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
<div class="mainUI" style="text-align: center;background-color: #F5FCFF;height: 100%;">
|
|
36
|
-
<div style="align-items: center; text-align: center; width: 100%">
|
|
37
|
-
<br>
|
|
38
|
-
<p class="status">Ready</p>
|
|
39
|
-
</div>
|
|
40
|
-
<div style=" align-items:center; text-align: center;display: inline-block;">
|
|
41
|
-
<p style="margin-bottom: 5px">Portrait</p>
|
|
42
|
-
<img style="height: 133px; width: 100px" src="assets/img/portrait.png" resizeMode="contain" class="portraitImage" />
|
|
43
|
-
</div>
|
|
44
|
-
<div style="align-items: center; text-align: center; display: inline-block;">
|
|
45
|
-
<p style="margin-bottom: 5px">Document</p>
|
|
46
|
-
<img style="height: 133px;" src="assets/img/id.png" resizeMode="contain" class="documentImage" />
|
|
47
|
-
</div>
|
|
48
|
-
<br><br>
|
|
49
|
-
<div class="scenariosRadioGroup" style="position: absolute; bottom: 100px; top: 230px; left: 75px; padding: 5px; text-align:left; overflow: auto">
|
|
50
|
-
</div>
|
|
51
|
-
|
|
52
|
-
<div style="position: absolute; bottom: 10px; width: 100%; text-align: center; align-items: center">
|
|
53
|
-
<div id="rfidDiv" style="flex-direction: row; padding: 5px">
|
|
54
|
-
<input type="checkbox" class="rfidCheckbox" name="rfid" disabled=true></input><span class="rfidCheckboxText" style="color: lightgrey"> Process rfid reading(unavailable)</span><br>
|
|
55
|
-
</div>
|
|
56
|
-
<div style="flex-direction: row; padding: 10px">
|
|
57
|
-
<button class="showScannerButton" style="margin-right: 20px">scan doc</button>
|
|
58
|
-
<button class="showImagePicker" style="margin-left: 20px">scan image</button>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<style type="text/css">
|
|
65
|
-
button {
|
|
66
|
-
width: 40%;
|
|
67
|
-
-moz-box-shadow: inset 0px -3px 7px 0px #29bbff;
|
|
68
|
-
-webkit-box-shadow: inset 0px -3px 7px 0px #29bbff;
|
|
69
|
-
box-shadow: inset 0px -3px 7px 0px #29bbff;
|
|
70
|
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #2dabf9), color-stop(1, #0688fa));
|
|
71
|
-
background: -moz-linear-gradient(top, #2dabf9 5%, #0688fa 100%);
|
|
72
|
-
background: -webkit-linear-gradient(top, #2dabf9 5%, #0688fa 100%);
|
|
73
|
-
background: -o-linear-gradient(top, #2dabf9 5%, #0688fa 100%);
|
|
74
|
-
background: -ms-linear-gradient(top, #2dabf9 5%, #0688fa 100%);
|
|
75
|
-
background: linear-gradient(to bottom, #2dabf9 5%, #0688fa 100%);
|
|
76
|
-
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#2dabf9', endColorstr='#0688fa', GradientType=0);
|
|
77
|
-
background-color: #2dabf9;
|
|
78
|
-
-moz-border-radius: 3px;
|
|
79
|
-
-webkit-border-radius: 3px;
|
|
80
|
-
border-radius: 3px;
|
|
81
|
-
border: 1px solid #0b0e07;
|
|
82
|
-
display: inline-block;
|
|
83
|
-
cursor: pointer;
|
|
84
|
-
color: #ffffff;
|
|
85
|
-
font-family: Arial;
|
|
86
|
-
font-size: 15px;
|
|
87
|
-
padding: 9px 23px;
|
|
88
|
-
text-decoration: none;
|
|
89
|
-
text-shadow: 0px 1px 0px #263666;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
button:hover {
|
|
93
|
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #0688fa), color-stop(1, #2dabf9));
|
|
94
|
-
background: -moz-linear-gradient(top, #0688fa 5%, #2dabf9 100%);
|
|
95
|
-
background: -webkit-linear-gradient(top, #0688fa 5%, #2dabf9 100%);
|
|
96
|
-
background: -o-linear-gradient(top, #0688fa 5%, #2dabf9 100%);
|
|
97
|
-
background: -ms-linear-gradient(top, #0688fa 5%, #2dabf9 100%);
|
|
98
|
-
background: linear-gradient(to bottom, #0688fa 5%, #2dabf9 100%);
|
|
99
|
-
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#0688fa', endColorstr='#2dabf9', GradientType=0);
|
|
100
|
-
background-color: #0688fa;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
button:active {
|
|
104
|
-
position: relative;
|
|
105
|
-
top: 1px;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
div {
|
|
109
|
-
color: black;
|
|
110
|
-
}
|
|
111
|
-
</style>
|
|
112
|
-
</body>
|
|
113
|
-
|
|
114
|
-
</html>
|
|
Binary file
|
|
Binary file
|