@regulaforensics/react-native-document-reader-api 6.8.0 → 6.9.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/RNDocumentReaderApi.podspec +1 -1
- package/android/build.gradle +18 -1
- package/android/src/main/java/com/regula/documentreader/BluetoothUtil.kt +6 -6
- package/android/src/main/java/com/regula/documentreader/Helpers.java +117 -3
- package/android/src/main/java/com/regula/documentreader/JSONConstructor.java +182 -261
- package/android/src/main/java/com/regula/documentreader/RNRegulaDocumentReaderModule.java +142 -125
- package/android/src/main/java/com/regula/documentreader/RegulaConfig.java +114 -26
- package/example/.bundle/config +2 -0
- package/example/.eslintrc.js +1 -1
- package/example/.prettierrc.js +2 -2
- package/example/.watchmanconfig +1 -1
- package/example/App.tsx +358 -0
- package/example/Gemfile +6 -0
- package/example/Gemfile.lock +98 -0
- package/example/__tests__/{App-test.js → App.test.tsx} +3 -0
- package/example/android/app/build.gradle +77 -59
- package/example/android/app/src/debug/AndroidManifest.xml +1 -1
- package/example/android/app/src/debug/java/com/regula/dr/fullrfid/ReactNativeFlipper.java +7 -4
- package/example/android/app/src/main/AndroidManifest.xml +4 -9
- package/example/android/app/src/main/java/com/regula/dr/fullrfid/MainActivity.java +17 -0
- package/example/android/app/src/main/java/com/regula/dr/fullrfid/MainApplication.java +17 -36
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
- package/example/android/app/src/main/res/values/styles.xml +2 -2
- package/example/android/app/src/release/java/com/regula/dr/fullrfid/ReactNativeFlipper.java +20 -0
- package/example/android/build.gradle +7 -18
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/example/android/gradle.properties +42 -2
- package/example/android/gradlew +164 -105
- package/example/android/gradlew.bat +92 -89
- package/example/android/settings.gradle +2 -1
- package/example/app.json +1 -1
- package/example/ios/.xcode.env +11 -0
- package/example/ios/DocumentReader/AppDelegate.h +2 -4
- package/example/ios/DocumentReader/AppDelegate.mm +26 -0
- package/example/ios/DocumentReader/DocumentReader.entitlements +0 -1
- package/example/ios/DocumentReader/Images.xcassets/AppIcon.appiconset/Contents.json +30 -15
- package/example/ios/DocumentReader/Info.plist +8 -4
- package/example/ios/DocumentReader/main.m +2 -1
- package/example/ios/DocumentReader.xcodeproj/project.pbxproj +134 -96
- package/example/ios/DocumentReaderTests/DocumentReaderTests.m +14 -13
- package/example/ios/Podfile +45 -15
- package/example/jest.config.js +3 -0
- package/example/metro.config.js +18 -15
- package/example/package-lock.json +13091 -0
- package/example/package.json +32 -22
- package/example/tsconfig.json +3 -0
- package/index.d.ts +426 -3015
- package/index.js +253 -2954
- package/ios/RGLWJSONConstructor.h +8 -6
- package/ios/RGLWJSONConstructor.m +109 -92
- package/ios/RGLWRegulaConfig.h +2 -1
- package/ios/RGLWRegulaConfig.m +139 -41
- package/ios/RNRegulaDocumentReader.m +55 -42
- package/package.json +1 -1
- package/example/.buckconfig +0 -6
- package/example/.editorconfig +0 -3
- package/example/.flowconfig +0 -65
- package/example/.gitattributes +0 -3
- package/example/App.js +0 -399
- package/example/android/app/BUCK +0 -55
- package/example/android/app/_BUCK +0 -55
- package/example/android/app/build_defs.bzl +0 -19
- package/example/android/app/src/main/assets/index.android.bundle +0 -636
- package/example/android/app/src/main/res/drawable-mdpi/images_id.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/images_portrait.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
- package/example/android/app/src/main/res/drawable-mdpi/node_modules_reactnativecheckbox_img_ic_indeterminate_check_box.png +0 -0
- package/example/android/app/src/main/res/drawable-xhdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
- package/example/android/app/src/main/res/drawable-xhdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
- package/example/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnativecheckbox_img_ic_check_box.png +0 -0
- package/example/android/app/src/main/res/drawable-xxhdpi/node_modules_reactnativecheckbox_img_ic_check_box_outline_blank.png +0 -0
- package/example/ios/DocumentReader/AppDelegate.m +0 -62
- package/example/ios/DocumentReader/Base.lproj/LaunchScreen.xib +0 -42
package/example/App.js
DELETED
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react'
|
|
2
|
-
import { StyleSheet, View, Button, Text, Image, ScrollView, NativeEventEmitter, Platform, TouchableOpacity } from 'react-native'
|
|
3
|
-
import DocumentReader, { Enum, DocumentReaderCompletion, DocumentReaderScenario, RNRegulaDocumentReader } from '@regulaforensics/react-native-document-reader-api'
|
|
4
|
-
import * as RNFS from 'react-native-fs'
|
|
5
|
-
import RadioGroup from 'react-native-radio-buttons-group'
|
|
6
|
-
import { launchImageLibrary } from 'react-native-image-picker';
|
|
7
|
-
import * as Progress from 'react-native-progress'
|
|
8
|
-
import CheckBox from 'react-native-check-box'
|
|
9
|
-
import { LogBox } from 'react-native';
|
|
10
|
-
|
|
11
|
-
LogBox.ignoreLogs(['new NativeEventEmitter']);
|
|
12
|
-
const eventManager = new NativeEventEmitter(RNRegulaDocumentReader)
|
|
13
|
-
|
|
14
|
-
var licPath = Platform.OS === 'ios' ? (RNFS.MainBundlePath + "/regula.license") : "regula.license"
|
|
15
|
-
var certDir = Platform.OS === 'ios' ? (RNFS.MainBundlePath + "/certificates") : "certificates"
|
|
16
|
-
var readDir = Platform.OS === 'ios' ? RNFS.readDir : RNFS.readDirAssets
|
|
17
|
-
var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileAssets
|
|
18
|
-
|
|
19
|
-
var isReadingRfid = false;
|
|
20
|
-
|
|
21
|
-
async function addCertificates() {
|
|
22
|
-
var certificates = []
|
|
23
|
-
var items = await readDir(certDir, 'base64')
|
|
24
|
-
|
|
25
|
-
for (var i in items) {
|
|
26
|
-
var item = items[i]
|
|
27
|
-
if (item.isFile()) {
|
|
28
|
-
var findExt = item.name.split('.')
|
|
29
|
-
var pkdResourceType = 0
|
|
30
|
-
if (findExt.length > 0)
|
|
31
|
-
pkdResourceType = Enum.PKDResourceType.getType(findExt[findExt.length - 1].toLowerCase())
|
|
32
|
-
|
|
33
|
-
var file = await readFile(item.path, 'base64')
|
|
34
|
-
certificates.push({
|
|
35
|
-
'binaryData': file,
|
|
36
|
-
'resourceType': pkdResourceType
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
DocumentReader.addPKDCertificates(certificates, s => {
|
|
41
|
-
console.log("certificates added")
|
|
42
|
-
}, e => console.log(e))
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default class App extends Component {
|
|
46
|
-
constructor(props) {
|
|
47
|
-
super(props)
|
|
48
|
-
eventManager.addListener('prepareDatabaseProgressChangeEvent', e => this.setState({ fullName: "Downloading database: " + e["msg"] + "%" }))
|
|
49
|
-
eventManager.addListener('completionEvent', e => this.handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(e["msg"]))))
|
|
50
|
-
eventManager.addListener('rfidNotificationCompletionEvent', e => console.log("rfidNotificationCompletionEvent: " + e["msg"]))
|
|
51
|
-
eventManager.addListener('paCertificateCompletionEvent', e => console.log("paCertificateCompletionEvent: " + e["msg"]))
|
|
52
|
-
eventManager.addListener('onCustomButtonTappedEvent', e => console.log("onCustomButtonTappedEvent: " + e["msg"]))
|
|
53
|
-
DocumentReader.prepareDatabase("Full", (respond) => {
|
|
54
|
-
console.log(respond)
|
|
55
|
-
readFile(licPath, 'base64').then((res) => {
|
|
56
|
-
this.setState({ fullName: "Initializing..." })
|
|
57
|
-
DocumentReader.initializeReader({
|
|
58
|
-
license: res,
|
|
59
|
-
delayedNNLoad: true
|
|
60
|
-
}, (respond) => {
|
|
61
|
-
console.log(respond)
|
|
62
|
-
DocumentReader.isRFIDAvailableForUse((canRfid) => {
|
|
63
|
-
if (canRfid) {
|
|
64
|
-
this.setState({ canRfid: true, rfidUIHeader: "Reading RFID", rfidDescription: "Place your phone on top of the NFC tag", rfidUIHeaderColor: "black" })
|
|
65
|
-
this.setState({ canRfidTitle: '' })
|
|
66
|
-
}
|
|
67
|
-
}, error => console.log(error))
|
|
68
|
-
DocumentReader.getAvailableScenarios((jstring) => {
|
|
69
|
-
var scenariosTemp = JSON.parse(jstring)
|
|
70
|
-
var scenariosL = []
|
|
71
|
-
for (var i in scenariosTemp) {
|
|
72
|
-
scenariosL.push({
|
|
73
|
-
label: DocumentReaderScenario.fromJson(typeof scenariosTemp[i] === "string" ? JSON.parse(scenariosTemp[i]) : scenariosTemp[i]).name,
|
|
74
|
-
id: i
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
this.setState({ scenarios: scenariosL })
|
|
78
|
-
this.setState({ selectedScenario: this.state.scenarios[0]['label'] })
|
|
79
|
-
this.setState({ radio: null })
|
|
80
|
-
this.setState({
|
|
81
|
-
radio: < RadioGroup containerStyle={styles.radio}
|
|
82
|
-
radioButtons={this.state.scenarios}
|
|
83
|
-
onPress={
|
|
84
|
-
(data) => {
|
|
85
|
-
var selectedItem
|
|
86
|
-
for (var index in data)
|
|
87
|
-
if (data[index]['selected'])
|
|
88
|
-
selectedItem = data[index]['label']
|
|
89
|
-
this.setState({ selectedScenario: selectedItem })
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/>
|
|
93
|
-
})
|
|
94
|
-
DocumentReader.getDocumentReaderIsReady((isReady) => {
|
|
95
|
-
if (isReady) {
|
|
96
|
-
this.setState({ fullName: "Ready" })
|
|
97
|
-
DocumentReader.setRfidDelegate(Enum.RFIDDelegate.NO_PA, (r) => { }, error => console.log(error))
|
|
98
|
-
// addCertificates()
|
|
99
|
-
} else
|
|
100
|
-
this.setState({ fullName: "Failed" })
|
|
101
|
-
}, error => console.log(error))
|
|
102
|
-
}, error => console.log(error))
|
|
103
|
-
}, error => console.log(error))
|
|
104
|
-
})
|
|
105
|
-
}, error => console.log(error))
|
|
106
|
-
|
|
107
|
-
this.state = {
|
|
108
|
-
fullName: "Please wait...",
|
|
109
|
-
doRfid: false,
|
|
110
|
-
isReadingRfidCustomUi: false,
|
|
111
|
-
rfidProgress: -1,
|
|
112
|
-
canRfid: false,
|
|
113
|
-
canRfidTitle: '(unavailable)',
|
|
114
|
-
scenarios: [],
|
|
115
|
-
selectedScenario: "",
|
|
116
|
-
portrait: require('./images/portrait.png'),
|
|
117
|
-
docFront: require('./images/id.png'),
|
|
118
|
-
radio: < RadioGroup containerStyle={styles.radio}
|
|
119
|
-
radioButtons={
|
|
120
|
-
[{ label: 'Loading', id: 0 }]}
|
|
121
|
-
onPress={null}
|
|
122
|
-
/>
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
handleCompletion(completion) {
|
|
127
|
-
if (this.state.isReadingRfidCustomUi && (completion.action === Enum.DocReaderAction.CANCEL || completion.action === Enum.DocReaderAction.ERROR))
|
|
128
|
-
this.hideRfidUI()
|
|
129
|
-
if (this.state.isReadingRfidCustomUi && completion.action === Enum.DocReaderAction.NOTIFICATION)
|
|
130
|
-
this.updateRfidUI(completion.results.documentReaderNotification)
|
|
131
|
-
if (completion.action === Enum.DocReaderAction.COMPLETE)
|
|
132
|
-
if (this.state.isReadingRfidCustomUi)
|
|
133
|
-
if (completion.results.rfidResult !== 1)
|
|
134
|
-
this.restartRfidUI()
|
|
135
|
-
else {
|
|
136
|
-
this.hideRfidUI()
|
|
137
|
-
this.displayResults(completion.results)
|
|
138
|
-
}
|
|
139
|
-
else
|
|
140
|
-
this.handleResults(completion.results)
|
|
141
|
-
if (completion.action === Enum.DocReaderAction.TIMEOUT)
|
|
142
|
-
this.handleResults(completion.results)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
showRfidUI() {
|
|
146
|
-
// show animation
|
|
147
|
-
this.setState({ isReadingRfidCustomUi: true })
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
hideRfidUI() {
|
|
151
|
-
// show animation
|
|
152
|
-
this.restartRfidUI()
|
|
153
|
-
this.setState({ isReadingRfidCustomUi: false, rfidUIHeader: "Reading RFID", rfidUIHeaderColor: "black" })
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
restartRfidUI() {
|
|
157
|
-
this.setState({ rfidUIHeaderColor: "red", rfidUIHeader: "Failed!", rfidDescription: "Place your phone on top of the NFC tag", rfidProgress: -1 })
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
updateRfidUI(results) {
|
|
161
|
-
if (results.code === Enum.eRFID_NotificationCodes.RFID_NOTIFICATION_PCSC_READING_DATAGROUP)
|
|
162
|
-
this.setState({ rfidDescription: Enum.eRFID_DataFile_Type.getTranslation(results.dataFileType) })
|
|
163
|
-
this.setState({ rfidUIHeader: "Reading RFID", rfidUIHeaderColor: "black" })
|
|
164
|
-
if (results.value != null)
|
|
165
|
-
this.setState({ rfidProgress: results.value / 100 })
|
|
166
|
-
if (Platform.OS === 'ios')
|
|
167
|
-
DocumentReader.setRfidSessionStatus(this.state.rfidDescription + "\n" + results.value + "%", e => { }, e => { })
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
clearResults() {
|
|
171
|
-
this.setState({ fullName: "Ready", docFront: require('./images/id.png'), portrait: require('./images/portrait.png') })
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
displayResults(results) {
|
|
175
|
-
if (results == null) return
|
|
176
|
-
|
|
177
|
-
results.textFieldValueByType(Enum.eVisualFieldType.FT_SURNAME_AND_GIVEN_NAMES, (value) => {
|
|
178
|
-
this.setState({ fullName: value })
|
|
179
|
-
}, error => console.log(error))
|
|
180
|
-
|
|
181
|
-
results.graphicFieldImageByType(Enum.eGraphicFieldType.GF_DOCUMENT_IMAGE, (value) => {
|
|
182
|
-
if (value != null && value != "")
|
|
183
|
-
this.setState({ docFront: { uri: "data:image/png;base64," + value } })
|
|
184
|
-
}, error => console.log(error))
|
|
185
|
-
|
|
186
|
-
results.graphicFieldImageByType(Enum.eGraphicFieldType.GF_PORTRAIT, (value) => {
|
|
187
|
-
if (value != null && value != "")
|
|
188
|
-
this.setState({ portrait: { uri: "data:image/png;base64," + value } })
|
|
189
|
-
}, error => console.log(error))
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
customRFID() {
|
|
193
|
-
this.showRfidUI()
|
|
194
|
-
DocumentReader.readRFID(e => { }, e => { })
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
usualRFID() {
|
|
198
|
-
isReadingRfid = true
|
|
199
|
-
DocumentReader.startRFIDReader(e => { }, e => { })
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
handleResults(results) {
|
|
203
|
-
if (this.state.doRfid && !isReadingRfid && results != null && results.chipPage != 0) {
|
|
204
|
-
// this.customRFID()
|
|
205
|
-
this.usualRFID()
|
|
206
|
-
} else {
|
|
207
|
-
isReadingRfid = false
|
|
208
|
-
this.displayResults(results)
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
render() {
|
|
213
|
-
return (
|
|
214
|
-
<View style={styles.container}>
|
|
215
|
-
{(this.state.isReadingRfidCustomUi) && <View style={styles.container}>
|
|
216
|
-
<Text style={{ paddingBottom: 30, fontSize: 23, color: this.state.rfidUIHeaderColor }}>{this.state.rfidUIHeader}</Text>
|
|
217
|
-
<Text style={{ paddingBottom: 50, fontSize: 20 }}>{this.state.rfidDescription}</Text>
|
|
218
|
-
<Progress.Bar width={200} useNativeDriver={true} color="#4285F4" progress={this.state.rfidProgress} />
|
|
219
|
-
<TouchableOpacity style={styles.cancelButton} onPress={() => { this.hideRfidUI() }}>
|
|
220
|
-
<Text style={{ fontSize: 20 }}>X</Text>
|
|
221
|
-
</TouchableOpacity>
|
|
222
|
-
</View>
|
|
223
|
-
}
|
|
224
|
-
{!this.state.isReadingRfidCustomUi && <View style={styles.container}>
|
|
225
|
-
<Text /><Text />
|
|
226
|
-
<Text style={{
|
|
227
|
-
top: 1,
|
|
228
|
-
left: 1,
|
|
229
|
-
padding: 30,
|
|
230
|
-
fontSize: 20,
|
|
231
|
-
}}>
|
|
232
|
-
{this.state.fullName}
|
|
233
|
-
</Text>
|
|
234
|
-
<View style={{ flexDirection: "row", padding: 5 }}>
|
|
235
|
-
<View style={{ flexDirection: "column", alignItems: "center" }}>
|
|
236
|
-
<Text style={{
|
|
237
|
-
top: 1,
|
|
238
|
-
right: 1,
|
|
239
|
-
padding: 5,
|
|
240
|
-
}}>
|
|
241
|
-
Portrait
|
|
242
|
-
</Text>
|
|
243
|
-
<Image
|
|
244
|
-
style={{
|
|
245
|
-
height: 150,
|
|
246
|
-
width: 150,
|
|
247
|
-
}}
|
|
248
|
-
source={this.state.portrait}
|
|
249
|
-
resizeMode="contain"
|
|
250
|
-
/>
|
|
251
|
-
</View>
|
|
252
|
-
<View style={{ flexDirection: "column", alignItems: "center", padding: 5 }}>
|
|
253
|
-
<Text style={{
|
|
254
|
-
top: 1,
|
|
255
|
-
right: 1,
|
|
256
|
-
padding: 5,
|
|
257
|
-
}}>
|
|
258
|
-
Document image
|
|
259
|
-
</Text>
|
|
260
|
-
<Image
|
|
261
|
-
style={{
|
|
262
|
-
height: 150,
|
|
263
|
-
width: 200,
|
|
264
|
-
}}
|
|
265
|
-
source={this.state.docFront}
|
|
266
|
-
resizeMode="contain"
|
|
267
|
-
/>
|
|
268
|
-
</View>
|
|
269
|
-
</View>
|
|
270
|
-
|
|
271
|
-
<ScrollView style={{ padding: 5, alignSelf: 'center' }} showsVerticalScrollIndicator={false}>
|
|
272
|
-
{this.state.radio}
|
|
273
|
-
</ScrollView>
|
|
274
|
-
|
|
275
|
-
<View style={{ flexDirection: 'row', padding: 5 }}>
|
|
276
|
-
<CheckBox
|
|
277
|
-
isChecked={this.state.doRfid}
|
|
278
|
-
onClick={() => {
|
|
279
|
-
if (this.state.canRfid) {
|
|
280
|
-
this.setState({ doRfid: !this.state.doRfid })
|
|
281
|
-
}
|
|
282
|
-
}}
|
|
283
|
-
disabled={!this.state.canRfid}
|
|
284
|
-
/>
|
|
285
|
-
<Text
|
|
286
|
-
style={{ padding: 5 }}
|
|
287
|
-
onPress={() => {
|
|
288
|
-
if (this.state.canRfid) {
|
|
289
|
-
this.setState({ doRfid: !this.state.doRfid })
|
|
290
|
-
}
|
|
291
|
-
}}>
|
|
292
|
-
{'Process rfid reading' + this.state.canRfidTitle}
|
|
293
|
-
</Text>
|
|
294
|
-
</View>
|
|
295
|
-
|
|
296
|
-
<View style={{ flexDirection: 'row' }}>
|
|
297
|
-
<Button color="#4285F4"
|
|
298
|
-
onPress={() => {
|
|
299
|
-
this.clearResults()
|
|
300
|
-
DocumentReader.setConfig({
|
|
301
|
-
functionality: {
|
|
302
|
-
videoCaptureMotionControl: true,
|
|
303
|
-
showCaptureButton: true
|
|
304
|
-
},
|
|
305
|
-
customization: {
|
|
306
|
-
showResultStatusMessages: true,
|
|
307
|
-
showStatusMessages: true
|
|
308
|
-
},
|
|
309
|
-
processParams: {
|
|
310
|
-
scenario: this.state.selectedScenario,
|
|
311
|
-
doRfid: this.state.doRfid,
|
|
312
|
-
},
|
|
313
|
-
}, e => { }, error => console.log(error))
|
|
314
|
-
|
|
315
|
-
DocumentReader.showScanner(s => { }, e => console.log(e))
|
|
316
|
-
}}
|
|
317
|
-
title="Scan document"
|
|
318
|
-
/>
|
|
319
|
-
<Text style={{ padding: 5 }}></Text>
|
|
320
|
-
<Button color="#4285F4"
|
|
321
|
-
onPress={() => {
|
|
322
|
-
launchImageLibrary({
|
|
323
|
-
mediaType: 'photo',
|
|
324
|
-
includeBase64: true,
|
|
325
|
-
selectionLimit: 10
|
|
326
|
-
}, r => {
|
|
327
|
-
if (r.errorCode != null) {
|
|
328
|
-
console.log("error code: " + r.errorCode)
|
|
329
|
-
console.log("error message: " + r.errorMessage)
|
|
330
|
-
this.setState({ fullName: r.errorMessage })
|
|
331
|
-
return
|
|
332
|
-
}
|
|
333
|
-
if (r.didCancel) return
|
|
334
|
-
this.clearResults()
|
|
335
|
-
this.setState({ fullName: "COPYING IMAGE..." })
|
|
336
|
-
var response = r.assets
|
|
337
|
-
DocumentReader.setConfig({
|
|
338
|
-
functionality: {
|
|
339
|
-
videoCaptureMotionControl: true,
|
|
340
|
-
showCaptureButton: true
|
|
341
|
-
},
|
|
342
|
-
customization: {
|
|
343
|
-
showResultStatusMessages: true,
|
|
344
|
-
showStatusMessages: true
|
|
345
|
-
},
|
|
346
|
-
processParams: {
|
|
347
|
-
scenario: this.state.selectedScenario,
|
|
348
|
-
doRfid: this.state.doRfid,
|
|
349
|
-
},
|
|
350
|
-
}, e => { }, error => console.log(error))
|
|
351
|
-
|
|
352
|
-
var images = []
|
|
353
|
-
|
|
354
|
-
for (var i = 0; i < response.length; i++) {
|
|
355
|
-
images.push(response[i].base64)
|
|
356
|
-
}
|
|
357
|
-
this.setState({ fullName: "PROCESSING..." })
|
|
358
|
-
DocumentReader.recognizeImages(images, s => { }, e => console.log(e))
|
|
359
|
-
})
|
|
360
|
-
}}
|
|
361
|
-
title=" Scan image "
|
|
362
|
-
/>
|
|
363
|
-
</View>
|
|
364
|
-
</View>
|
|
365
|
-
}
|
|
366
|
-
</View>
|
|
367
|
-
)
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const styles = StyleSheet.create({
|
|
372
|
-
container: {
|
|
373
|
-
width: '100%',
|
|
374
|
-
height: '100%',
|
|
375
|
-
flex: 1,
|
|
376
|
-
justifyContent: 'center',
|
|
377
|
-
alignItems: 'center',
|
|
378
|
-
backgroundColor: '#F5FCFF',
|
|
379
|
-
marginBottom: 12,
|
|
380
|
-
},
|
|
381
|
-
radio: {
|
|
382
|
-
alignItems: 'flex-start'
|
|
383
|
-
},
|
|
384
|
-
welcome: {
|
|
385
|
-
fontSize: 20,
|
|
386
|
-
textAlign: 'center',
|
|
387
|
-
margin: 10,
|
|
388
|
-
},
|
|
389
|
-
instructions: {
|
|
390
|
-
textAlign: 'center',
|
|
391
|
-
color: '#333333',
|
|
392
|
-
marginBottom: 5,
|
|
393
|
-
},
|
|
394
|
-
cancelButton: {
|
|
395
|
-
position: 'absolute',
|
|
396
|
-
bottom: 0,
|
|
397
|
-
right: 20
|
|
398
|
-
}
|
|
399
|
-
})
|
package/example/android/app/BUCK
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# To learn about Buck see [Docs](https://buckbuild.com/).
|
|
2
|
-
# To run your application with Buck:
|
|
3
|
-
# - install Buck
|
|
4
|
-
# - `npm start` - to start the packager
|
|
5
|
-
# - `cd android`
|
|
6
|
-
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
|
|
7
|
-
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
|
|
8
|
-
# - `buck install -r android/app` - compile, install and run application
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
|
|
12
|
-
|
|
13
|
-
lib_deps = []
|
|
14
|
-
|
|
15
|
-
create_aar_targets(glob(["libs/*.aar"]))
|
|
16
|
-
|
|
17
|
-
create_jar_targets(glob(["libs/*.jar"]))
|
|
18
|
-
|
|
19
|
-
android_library(
|
|
20
|
-
name = "all-libs",
|
|
21
|
-
exported_deps = lib_deps,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
android_library(
|
|
25
|
-
name = "app-code",
|
|
26
|
-
srcs = glob([
|
|
27
|
-
"src/main/java/**/*.java",
|
|
28
|
-
]),
|
|
29
|
-
deps = [
|
|
30
|
-
":all-libs",
|
|
31
|
-
":build_config",
|
|
32
|
-
":res",
|
|
33
|
-
],
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
android_build_config(
|
|
37
|
-
name = "build_config",
|
|
38
|
-
package = "com.regula.dr.fullrfid",
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
android_resource(
|
|
42
|
-
name = "res",
|
|
43
|
-
package = "com.regula.dr.fullrfid",
|
|
44
|
-
res = "src/main/res",
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
android_binary(
|
|
48
|
-
name = "app",
|
|
49
|
-
keystore = "//android/keystores:debug",
|
|
50
|
-
manifest = "src/main/AndroidManifest.xml",
|
|
51
|
-
package_type = "debug",
|
|
52
|
-
deps = [
|
|
53
|
-
":app-code",
|
|
54
|
-
],
|
|
55
|
-
)
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# To learn about Buck see [Docs](https://buckbuild.com/).
|
|
2
|
-
# To run your application with Buck:
|
|
3
|
-
# - install Buck
|
|
4
|
-
# - `npm start` - to start the packager
|
|
5
|
-
# - `cd android`
|
|
6
|
-
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
|
|
7
|
-
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
|
|
8
|
-
# - `buck install -r android/app` - compile, install and run application
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
|
|
12
|
-
|
|
13
|
-
lib_deps = []
|
|
14
|
-
|
|
15
|
-
create_aar_targets(glob(["libs/*.aar"]))
|
|
16
|
-
|
|
17
|
-
create_jar_targets(glob(["libs/*.jar"]))
|
|
18
|
-
|
|
19
|
-
android_library(
|
|
20
|
-
name = "all-libs",
|
|
21
|
-
exported_deps = lib_deps,
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
android_library(
|
|
25
|
-
name = "app-code",
|
|
26
|
-
srcs = glob([
|
|
27
|
-
"src/main/java/**/*.java",
|
|
28
|
-
]),
|
|
29
|
-
deps = [
|
|
30
|
-
":all-libs",
|
|
31
|
-
":build_config",
|
|
32
|
-
":res",
|
|
33
|
-
],
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
android_build_config(
|
|
37
|
-
name = "build_config",
|
|
38
|
-
package = "com.documentreader",
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
android_resource(
|
|
42
|
-
name = "res",
|
|
43
|
-
package = "com.documentreader",
|
|
44
|
-
res = "src/main/res",
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
android_binary(
|
|
48
|
-
name = "app",
|
|
49
|
-
keystore = "//android/keystores:debug",
|
|
50
|
-
manifest = "src/main/AndroidManifest.xml",
|
|
51
|
-
package_type = "debug",
|
|
52
|
-
deps = [
|
|
53
|
-
":app-code",
|
|
54
|
-
],
|
|
55
|
-
)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"""Helper definitions to glob .aar and .jar targets"""
|
|
2
|
-
|
|
3
|
-
def create_aar_targets(aarfiles):
|
|
4
|
-
for aarfile in aarfiles:
|
|
5
|
-
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
|
|
6
|
-
lib_deps.append(":" + name)
|
|
7
|
-
android_prebuilt_aar(
|
|
8
|
-
name = name,
|
|
9
|
-
aar = aarfile,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
def create_jar_targets(jarfiles):
|
|
13
|
-
for jarfile in jarfiles:
|
|
14
|
-
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
|
|
15
|
-
lib_deps.append(":" + name)
|
|
16
|
-
prebuilt_jar(
|
|
17
|
-
name = name,
|
|
18
|
-
binary_jar = jarfile,
|
|
19
|
-
)
|