@regulaforensics/react-native-document-reader-api 9.10.916-rc → 9.10.918-rc
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/src/main/java/com/regula/plugin/document/reader/Config.kt +2 -0
- package/android/src/main/java/com/regula/plugin/document/reader/JSONConstructor.kt +10 -18
- package/android/src/main/java/com/regula/plugin/document/reader/Main.kt +14 -4
- package/example/App.tsx +53 -39
- package/example/README.md +2 -8
- package/example/android/app/build.gradle +5 -31
- package/example/android/app/src/main/java/com/regula/dr/fullauthrfid/MainActivity.kt +22 -0
- package/example/android/app/src/main/java/com/regula/dr/fullauthrfid/MainApplication.kt +28 -0
- package/example/android/build.gradle +7 -5
- 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 +6 -5
- package/example/babel.config.js +3 -0
- package/example/ios/DocumentReader/AppDelegate.mm +10 -5
- package/example/ios/DocumentReader/Info.plist +21 -24
- package/example/ios/DocumentReader/SceneDelegate.h +7 -0
- package/example/ios/DocumentReader/SceneDelegate.mm +27 -0
- package/example/ios/DocumentReader.xcodeproj/project.pbxproj +17 -238
- package/example/ios/DocumentReader.xcodeproj/xcshareddata/xcschemes/DocumentReader.xcscheme +0 -18
- package/example/ios/Podfile +5 -9
- package/example/metro.config.js +2 -20
- package/example/package-lock.json +2687 -9340
- package/example/package.json +19 -40
- package/example/tsconfig.json +6 -0
- package/index.d.ts +20 -10
- package/index.js +13 -5
- package/ios/RGLWConfig.m +2 -0
- package/ios/RGLWJSONConstructor.m +1 -0
- package/ios/RGLWMain.h +1 -0
- package/ios/RGLWMain.m +16 -0
- package/ios/RNRegulaDocumentReader.m +1 -0
- package/package.json +1 -1
- package/example/android/app/src/debug/AndroidManifest.xml +0 -13
- package/example/android/app/src/debug/java/com/regula/dr/fullrfid/ReactNativeFlipper.java +0 -75
- package/example/android/app/src/main/java/com/regula/dr/fullauthrfid/MainActivity.java +0 -32
- package/example/android/app/src/main/java/com/regula/dr/fullauthrfid/MainApplication.java +0 -68
- package/example/android/app/src/release/java/com/regula/dr/fullrfid/ReactNativeFlipper.java +0 -20
- package/example/ios/DocumentReaderTests/DocumentReaderTests.m +0 -66
- package/example/ios/DocumentReaderTests/Info.plist +0 -24
- package/example/react-native.config.js +0 -5
- package/example/vendor/image-size-metro-compat/index.cjs +0 -16
- package/example/vendor/image-size-metro-compat/package.json +0 -8
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.homepage = 'https://regulaforensics.com'
|
|
13
13
|
|
|
14
14
|
s.source = { :http => 'file:' + __dir__ }
|
|
15
|
-
s.ios.deployment_target = '
|
|
15
|
+
s.ios.deployment_target = '16.0'
|
|
16
16
|
s.source_files = "ios/*.{h,m}"
|
|
17
17
|
s.dependency 'DocumentReaderStage', '9.10.7309'
|
|
18
18
|
s.dependency 'React'
|
|
@@ -789,12 +789,14 @@ fun getLivenessParams(input: LivenessParams?) = input?.let {
|
|
|
789
789
|
fun setAuthenticityPropertiesParams(input: AuthenticityPropertiesParams, opts: JSONObject) = opts.forEach { k, v ->
|
|
790
790
|
when (k) {
|
|
791
791
|
"checkHoldersSignature" -> input.checkHoldersSignature = v as Boolean
|
|
792
|
+
"checkDocumentDamage" -> input.checkDocumentDamage = v as Boolean
|
|
792
793
|
}
|
|
793
794
|
}
|
|
794
795
|
|
|
795
796
|
fun getAuthenticityPropertiesParams(input: AuthenticityPropertiesParams?) = input?.let {
|
|
796
797
|
mapOf(
|
|
797
798
|
"checkHoldersSignature" to it.checkHoldersSignature,
|
|
799
|
+
"checkDocumentDamage" to it.checkDocumentDamage,
|
|
798
800
|
).toJson()
|
|
799
801
|
}
|
|
800
802
|
|
|
@@ -260,8 +260,10 @@ fun generateScannerConfig(input: ScannerConfig?) = input?.let {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
fun recognizeConfigFromJSON(input: JSONObject) = input.let {
|
|
263
|
-
val builder =
|
|
264
|
-
|
|
263
|
+
val builder =
|
|
264
|
+
if (it.has("scenario") && it.has("onlineProcessingConfig")) RecognizeConfig.Builder(it.getString("scenario"), onlineProcessingConfigFromJSON(it.getJSONObject("onlineProcessingConfig"))!!)
|
|
265
|
+
else if (it.has("scenario")) RecognizeConfig.Builder(it.getString("scenario"))
|
|
266
|
+
else RecognizeConfig.Builder(onlineProcessingConfigFromJSON(it.getJSONObject("onlineProcessingConfig"))!!)
|
|
265
267
|
|
|
266
268
|
if (it.has("oneShotIdentification")) builder.setOneShotIdentification(it.getBoolean("oneShotIdentification"))
|
|
267
269
|
if (it.has("dtc")) builder.setDTC(it.getString("dtc").toByteArray()!!)
|
|
@@ -560,25 +562,15 @@ fun generateOcclusionCheckParams(input: OcclusionCheckParams?) = input?.let {
|
|
|
560
562
|
|
|
561
563
|
@SuppressLint("DiscouragedApi")
|
|
562
564
|
fun typefaceFromJSON(it: JSONObject): Pair<Typeface?, Int?> {
|
|
565
|
+
val name = it.getString("name")
|
|
563
566
|
val font = try {
|
|
564
567
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
565
|
-
context.resources.getFont(
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
"font",
|
|
569
|
-
context.packageName
|
|
570
|
-
)
|
|
571
|
-
)
|
|
572
|
-
else throw Exception("")
|
|
573
|
-
} catch (_: Exception) {
|
|
574
|
-
Typeface.create(
|
|
575
|
-
it.getString("name"),
|
|
576
|
-
it.optInt("style", Typeface.NORMAL)
|
|
577
|
-
)
|
|
578
|
-
}
|
|
568
|
+
context.resources.getFont(context.resources.getIdentifier(name, "font", context.packageName))
|
|
569
|
+
else null
|
|
570
|
+
} catch (_: Exception) { null }
|
|
579
571
|
return Pair(
|
|
580
|
-
font,
|
|
581
|
-
|
|
572
|
+
font ?: Typeface.create(name, it.optInt("style", Typeface.NORMAL)),
|
|
573
|
+
it.getIntOrNull("size")
|
|
582
574
|
)
|
|
583
575
|
}
|
|
584
576
|
|
|
@@ -21,6 +21,7 @@ import com.regula.documentreader.api.completions.IVideoEncoderCompletion
|
|
|
21
21
|
import com.regula.documentreader.api.completions.model.PrepareProgress
|
|
22
22
|
import com.regula.documentreader.api.completions.rfid.ICaProtocolCompletion
|
|
23
23
|
import com.regula.documentreader.api.completions.rfid.IPaceProtocolCompletion
|
|
24
|
+
import com.regula.documentreader.api.completions.rfid.IRfidAaChallengeCompletion
|
|
24
25
|
import com.regula.documentreader.api.completions.rfid.IRfidPKDCertificateCompletion
|
|
25
26
|
import com.regula.documentreader.api.completions.rfid.IRfidReaderCompletion
|
|
26
27
|
import com.regula.documentreader.api.completions.rfid.IRfidReaderRequest
|
|
@@ -92,6 +93,7 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
|
|
|
92
93
|
"providePACertificates" -> providePACertificates(argsNullable(0))
|
|
93
94
|
"provideTACertificates" -> provideTACertificates(argsNullable(0))
|
|
94
95
|
"provideTASignature" -> provideTASignature(args(0))
|
|
96
|
+
"provideAAChallenge" -> provideAAChallenge(args(0))
|
|
95
97
|
"selectPACEProtocol" -> selectPACEProtocol(args(0))
|
|
96
98
|
"selectCAProtocol" -> selectCAProtocol(args(0))
|
|
97
99
|
"setTCCParams" -> setTCCParams(callback, args(0))
|
|
@@ -154,6 +156,7 @@ const val rfidOnRetryReadChipEvent = "rfidOnRetryReadChipEvent"
|
|
|
154
156
|
const val paCertificateCompletionEvent = "pa_certificate_completion"
|
|
155
157
|
const val taCertificateCompletionEvent = "ta_certificate_completion"
|
|
156
158
|
const val taSignatureCompletionEvent = "ta_signature_completion"
|
|
159
|
+
const val aaChallengeCompletionEvent = "aaChallengeCompletionEvent"
|
|
157
160
|
const val paceProtocolCompletionEvent = "paceProtocolCompletionEvent"
|
|
158
161
|
const val caProtocolCompletionEvent = "caProtocolCompletionEvent"
|
|
159
162
|
|
|
@@ -281,6 +284,8 @@ fun provideTASignature(signature: String?) = taSignatureCompletion.onSignatureRe
|
|
|
281
284
|
signature.toByteArray()
|
|
282
285
|
)
|
|
283
286
|
|
|
287
|
+
fun provideAAChallenge(challenge: String?) = aaChallengeCompletion.onChallengeReceived(challenge)
|
|
288
|
+
|
|
284
289
|
fun selectPACEProtocol(protocol: JSONObject) = paceProtocolCompletion.onPaceProtocolSelected(
|
|
285
290
|
paceProtocolFromJSON(protocol)!!
|
|
286
291
|
)
|
|
@@ -550,6 +555,7 @@ fun initCompletion(callback: Callback) = IDocumentReaderInitCompletion { success
|
|
|
550
555
|
lateinit var paCertificateCompletion: IRfidPKDCertificateCompletion
|
|
551
556
|
lateinit var taCertificateCompletion: IRfidPKDCertificateCompletion
|
|
552
557
|
lateinit var taSignatureCompletion: IRfidTASignatureCompletion
|
|
558
|
+
lateinit var aaChallengeCompletion: IRfidAaChallengeCompletion
|
|
553
559
|
lateinit var paceProtocolCompletion: IPaceProtocolCompletion
|
|
554
560
|
lateinit var caProtocolCompletion: ICaProtocolCompletion
|
|
555
561
|
|
|
@@ -559,19 +565,23 @@ fun getRfidReaderRequest(config: JSONObject? = null): IRfidReaderRequest {
|
|
|
559
565
|
val result = IRfidReaderRequest()
|
|
560
566
|
if (config == null) return result
|
|
561
567
|
|
|
562
|
-
if (config.
|
|
568
|
+
if (config.getBooleanOrNull("paCertificates") == true) result.setPACertificates { serialNumber, issuer, completion ->
|
|
563
569
|
paCertificateCompletion = completion
|
|
564
570
|
sendEvent(paCertificateCompletionEvent, generatePACertificateCompletion(serialNumber, issuer))
|
|
565
571
|
}
|
|
566
|
-
if (config.
|
|
572
|
+
if (config.getBooleanOrNull("taCertificates") == true) result.setTACertificates { keyCAR, completion ->
|
|
567
573
|
taCertificateCompletion = completion
|
|
568
574
|
sendEvent(taCertificateCompletionEvent, keyCAR)
|
|
569
575
|
}
|
|
570
|
-
if (config.
|
|
576
|
+
if (config.getBooleanOrNull("taSignature") == true) result.setTASignature { challenge, completion ->
|
|
571
577
|
taSignatureCompletion = completion
|
|
572
578
|
sendEvent(taSignatureCompletionEvent, generateTAChallenge(challenge))
|
|
573
579
|
}
|
|
574
|
-
if (config.
|
|
580
|
+
if (config.getBooleanOrNull("aaChallenge") == true) result.setRfidAaChallenge { challenge, completion ->
|
|
581
|
+
aaChallengeCompletion = completion
|
|
582
|
+
sendEvent(aaChallengeCompletionEvent, challenge)
|
|
583
|
+
}
|
|
584
|
+
if (config.getBooleanOrNull("paceProtocol") == true || config.getBooleanOrNull("caProtocol") == true) result.setRfidAccessControl(object : IRfidAccessControl {
|
|
575
585
|
override fun onRequestPaceProtocol(list: List<PaceProtocol?>, completion: IPaceProtocolCompletion) {
|
|
576
586
|
paceProtocolCompletion = completion
|
|
577
587
|
sendEvent(paceProtocolCompletionEvent, list.toJson(::generatePaceProtocol))
|
package/example/App.tsx
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { ScrollView, StyleSheet, Text, View, NativeEventEmitter, Platform, TouchableOpacity, Image, Button } from 'react-native'
|
|
2
|
+
import { ScrollView, StyleSheet, Text, View, NativeEventEmitter, EmitterSubscription, Platform, TouchableOpacity, Image, Button } from 'react-native'
|
|
3
3
|
import DocumentReader, { Enum, DocumentReaderCompletion, DocumentReaderScenario, RNRegulaDocumentReader, DocumentReaderResults, DocumentReaderNotification, ScannerConfig, RecognizeConfig, DocReaderConfig, Functionality } from '@regulaforensics/react-native-document-reader-api'
|
|
4
4
|
import * as RNFS from 'react-native-fs'
|
|
5
5
|
import RadioGroup, { RadioButtonProps } from 'react-native-radio-buttons-group'
|
|
6
|
-
import { CheckBox } from '@rneui/themed'
|
|
7
|
-
import Icon from 'react-native-vector-icons/FontAwesome'
|
|
8
6
|
import { launchImageLibrary } from 'react-native-image-picker'
|
|
9
|
-
import * as Progress from 'react-native-progress'
|
|
10
7
|
|
|
11
8
|
var isReadingRfid = false
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
}
|
|
10
|
+
type IProps = Record<string, never>
|
|
15
11
|
|
|
16
12
|
interface IState {
|
|
17
13
|
fullName: string | undefined
|
|
@@ -30,6 +26,8 @@ interface IState {
|
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
export default class App extends React.Component<IProps, IState> {
|
|
29
|
+
private subscriptions: EmitterSubscription[] = []
|
|
30
|
+
|
|
33
31
|
onInitialized() {
|
|
34
32
|
this.setState({ fullName: "Ready" })
|
|
35
33
|
|
|
@@ -38,13 +36,31 @@ export default class App extends React.Component<IProps, IState> {
|
|
|
38
36
|
DocumentReader.setFunctionality(functionality, _ => { }, _ => { })
|
|
39
37
|
}
|
|
40
38
|
|
|
41
|
-
constructor(props:
|
|
39
|
+
constructor(props: IProps) {
|
|
42
40
|
super(props)
|
|
43
|
-
Icon.loadFont()
|
|
44
41
|
|
|
42
|
+
|
|
43
|
+
this.state = {
|
|
44
|
+
fullName: "Please wait...",
|
|
45
|
+
doRfid: false,
|
|
46
|
+
isReadingRfidCustomUi: false,
|
|
47
|
+
rfidUIHeader: "",
|
|
48
|
+
rfidUIHeaderColor: "black",
|
|
49
|
+
rfidDescription: "",
|
|
50
|
+
rfidProgress: -1,
|
|
51
|
+
canRfid: false,
|
|
52
|
+
canRfidTitle: "(unavailable)",
|
|
53
|
+
radioButtons: [{ label: 'Loading', id: "0" }],
|
|
54
|
+
selectedScenario: "",
|
|
55
|
+
portrait: require('./images/portrait.png'),
|
|
56
|
+
docFront: require('./images/id.png')
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
componentDidMount() {
|
|
45
61
|
var eventManager = new NativeEventEmitter(RNRegulaDocumentReader)
|
|
46
|
-
eventManager.addListener('completion',
|
|
47
|
-
eventManager.addListener('rfidOnProgressCompletion', e => this.updateRfidUI(DocumentReaderNotification.fromJson(JSON.parse(e
|
|
62
|
+
this.subscriptions.push(eventManager.addListener('completion', e => this.handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse((e as { msg: string }).msg))!)))
|
|
63
|
+
this.subscriptions.push(eventManager.addListener('rfidOnProgressCompletion', e => this.updateRfidUI(DocumentReaderNotification.fromJson(JSON.parse((e as { msg: string }).msg))!)))
|
|
48
64
|
|
|
49
65
|
var licPath = Platform.OS === 'ios' ? (RNFS.MainBundlePath + "/regula.license") : "regula.license"
|
|
50
66
|
var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileAssets
|
|
@@ -56,6 +72,7 @@ export default class App extends React.Component<IProps, IState> {
|
|
|
56
72
|
DocumentReader.initializeReader(config, (response) => {
|
|
57
73
|
if (!JSON.parse(response)["success"]) {
|
|
58
74
|
console.log(response)
|
|
75
|
+
this.setState({ fullName: "Reader initialization failed" })
|
|
59
76
|
return
|
|
60
77
|
}
|
|
61
78
|
console.log("Init complete")
|
|
@@ -72,28 +89,18 @@ export default class App extends React.Component<IProps, IState> {
|
|
|
72
89
|
var scenario = DocumentReaderScenario.fromJson(typeof scenarios[i] === "string" ? JSON.parse(scenarios[i]) : scenarios[i])!.name!
|
|
73
90
|
items.push({ label: scenario, id: scenario })
|
|
74
91
|
}
|
|
75
|
-
this.setState({ radioButtons: items })
|
|
76
|
-
this.setState({ selectedScenario: this.state.radioButtons[0]['id'] })
|
|
92
|
+
this.setState({ radioButtons: items, selectedScenario: items[0]?.id ?? '' })
|
|
77
93
|
}, error => console.log(error))
|
|
78
94
|
this.onInitialized()
|
|
79
95
|
}, error => console.log(error))
|
|
96
|
+
}).catch(error => {
|
|
97
|
+
console.log(error)
|
|
98
|
+
this.setState({ fullName: "Cannot read regula.license" })
|
|
80
99
|
})
|
|
100
|
+
}
|
|
81
101
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
doRfid: false,
|
|
85
|
-
isReadingRfidCustomUi: false,
|
|
86
|
-
rfidUIHeader: "",
|
|
87
|
-
rfidUIHeaderColor: "black",
|
|
88
|
-
rfidDescription: "",
|
|
89
|
-
rfidProgress: -1,
|
|
90
|
-
canRfid: false,
|
|
91
|
-
canRfidTitle: "(unavailable)",
|
|
92
|
-
radioButtons: [{ label: 'Loading', id: "0" }],
|
|
93
|
-
selectedScenario: "",
|
|
94
|
-
portrait: require('./images/portrait.png'),
|
|
95
|
-
docFront: require('./images/id.png')
|
|
96
|
-
}
|
|
102
|
+
componentWillUnmount() {
|
|
103
|
+
this.subscriptions.forEach(subscription => subscription.remove())
|
|
97
104
|
}
|
|
98
105
|
|
|
99
106
|
handleCompletion(completion: DocumentReaderCompletion) {
|
|
@@ -229,6 +236,7 @@ export default class App extends React.Component<IProps, IState> {
|
|
|
229
236
|
}
|
|
230
237
|
|
|
231
238
|
render() {
|
|
239
|
+
const progress = Math.max(0, Math.min(1, this.state.rfidProgress))
|
|
232
240
|
return (
|
|
233
241
|
<View style={styles.container}>
|
|
234
242
|
{!this.state.isReadingRfidCustomUi && <View style={styles.container}>
|
|
@@ -255,28 +263,34 @@ export default class App extends React.Component<IProps, IState> {
|
|
|
255
263
|
</ScrollView>
|
|
256
264
|
|
|
257
265
|
<View style={{ flexDirection: 'row', padding: 5 }}>
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
266
|
+
<TouchableOpacity
|
|
267
|
+
accessibilityRole="checkbox"
|
|
268
|
+
accessibilityLabel={'Process rfid reading' + this.state.canRfidTitle}
|
|
269
|
+
accessibilityState={{ checked: this.state.doRfid, disabled: !this.state.canRfid }}
|
|
270
|
+
disabled={!this.state.canRfid}
|
|
271
|
+
style={{ flexDirection: 'row', alignItems: 'center', padding: 10 }}
|
|
272
|
+
onPress={() => this.setState(state => ({ doRfid: !state.doRfid }))}>
|
|
273
|
+
<Text style={{ fontSize: 22, marginRight: 8 }}>{this.state.doRfid ? '☑' : '☐'}</Text>
|
|
274
|
+
<Text>{'Process rfid reading' + this.state.canRfidTitle}</Text>
|
|
275
|
+
</TouchableOpacity>
|
|
267
276
|
</View>
|
|
268
277
|
|
|
269
278
|
<View style={{ flexDirection: 'row' }}>
|
|
270
|
-
<Button color="#4285F4" title="Scan document" onPress={() => this.scan()} />
|
|
279
|
+
<Button color="#4285F4" title="Scan document" disabled={!this.state.selectedScenario} onPress={() => this.scan()} />
|
|
271
280
|
<Text style={{ padding: 5 }}></Text>
|
|
272
|
-
<Button color="#4285F4" title="Scan image" onPress={() => this.recognize()} />
|
|
281
|
+
<Button color="#4285F4" title="Scan image" disabled={!this.state.selectedScenario} onPress={() => this.recognize()} />
|
|
273
282
|
</View>
|
|
274
283
|
</View>}
|
|
275
284
|
|
|
276
285
|
{(this.state.isReadingRfidCustomUi) && <View style={styles.container}>
|
|
277
286
|
<Text style={{ paddingBottom: 30, fontSize: 23, color: this.state.rfidUIHeaderColor }}>{this.state.rfidUIHeader}</Text>
|
|
278
287
|
<Text style={{ paddingBottom: 50, fontSize: 20 }}>{this.state.rfidDescription}</Text>
|
|
279
|
-
<
|
|
288
|
+
<View
|
|
289
|
+
accessibilityRole="progressbar"
|
|
290
|
+
accessibilityValue={{ min: 0, max: 100, now: Math.round(progress * 100) }}
|
|
291
|
+
style={{ marginBottom: 30, width: 200, height: 8, borderWidth: 1, borderColor: '#4285F4', borderRadius: 4, overflow: 'hidden' }}>
|
|
292
|
+
<View style={{ width: `${progress * 100}%`, height: '100%', backgroundColor: '#4285F4' }} />
|
|
293
|
+
</View>
|
|
280
294
|
<TouchableOpacity style={styles.cancelButton} onPress={() => { this.hideRfidUI() }}>
|
|
281
295
|
<Text style={{ fontSize: 20 }}>X</Text>
|
|
282
296
|
</TouchableOpacity>
|
package/example/README.md
CHANGED
|
@@ -15,19 +15,13 @@ $ cd ios
|
|
|
15
15
|
$ pod install
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
**Note**: make sure that Metro Bundler is running when you run your app. Otherwise, run `npx react-native start` command. If it fails to start, run `git init` from Project root, then `npx react-native start`.
|
|
19
|
-
|
|
20
18
|
4. Android:
|
|
21
19
|
* Copy the `regula.license` file to the `example/android/app/src/main/assets` folder.
|
|
22
|
-
* Run `npx react-native run-android` inside `example` folder - this is just one way to run the app. You can also run it directly from within Android Studio.
|
|
23
|
-
* If gradle sync fails, select JDK-17 in Android Studio
|
|
24
|
-
|
|
25
|
-
**Note**: if the running failed with the following error `Error: spawn ./gradlew EACCES`, try to run the following command `chmod +x gradlew` within the `example/android` directory.
|
|
20
|
+
* Run `npm run android` (or `npx react-native run-android --no-packager`) inside `example` folder - this is just one way to run the app. You can also run it directly from within Android Studio.
|
|
26
21
|
|
|
27
22
|
5. iOS:
|
|
28
23
|
* Copy the `regula.license` file to the `example/ios` folder.
|
|
29
|
-
* Run `npx react-native run-ios` inside `example` folder - this is just one way to run the app. You can also run it directly from within Xcode.
|
|
30
|
-
* This example does not support MacOS-27+ and iOS-27+
|
|
24
|
+
* Run `npm run ios` (or `npx react-native run-ios --no-packager`) inside `example` folder - this is just one way to run the app. You can also run it directly from within Xcode.
|
|
31
25
|
|
|
32
26
|
# Troubleshooting license issues
|
|
33
27
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
apply plugin: "com.android.application"
|
|
2
|
+
apply plugin: "org.jetbrains.kotlin.android"
|
|
2
3
|
apply plugin: "com.facebook.react"
|
|
3
4
|
|
|
4
5
|
|
|
@@ -18,10 +19,8 @@ react {
|
|
|
18
19
|
// cliFile = file("../node_modules/react-native/cli.js")
|
|
19
20
|
|
|
20
21
|
/* Variants */
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
24
|
-
// debuggableVariants = ["liteDebug", "prodDebug"]
|
|
22
|
+
// Bundle JS and assets for every variant, including Debug.
|
|
23
|
+
debuggableVariants = []
|
|
25
24
|
|
|
26
25
|
/* Bundling */
|
|
27
26
|
// A list containing the node command and its flags. Default is just 'node'.
|
|
@@ -59,19 +58,6 @@ react {
|
|
|
59
58
|
*/
|
|
60
59
|
def enableProguardInReleaseBuilds = false
|
|
61
60
|
|
|
62
|
-
/**
|
|
63
|
-
* The preferred build flavor of JavaScriptCore (JSC)
|
|
64
|
-
*
|
|
65
|
-
* For example, to use the international variant, you can use:
|
|
66
|
-
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
|
|
67
|
-
*
|
|
68
|
-
* The international variant includes ICU i18n library and necessary data
|
|
69
|
-
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
70
|
-
* give correct results when using with locales other than en-US. Note that
|
|
71
|
-
* this variant is about 6MiB larger per architecture than default.
|
|
72
|
-
*/
|
|
73
|
-
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
|
|
74
|
-
|
|
75
61
|
android {
|
|
76
62
|
ndkVersion rootProject.ext.ndkVersion
|
|
77
63
|
|
|
@@ -102,7 +88,7 @@ android {
|
|
|
102
88
|
// see https://reactnative.dev/docs/signed-apk-android.
|
|
103
89
|
signingConfig signingConfigs.debug
|
|
104
90
|
minifyEnabled enableProguardInReleaseBuilds
|
|
105
|
-
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
91
|
+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
|
106
92
|
}
|
|
107
93
|
}
|
|
108
94
|
}
|
|
@@ -111,17 +97,5 @@ dependencies {
|
|
|
111
97
|
// The version of react-native is set by the React Native Gradle Plugin
|
|
112
98
|
implementation("com.facebook.react:react-android")
|
|
113
99
|
|
|
114
|
-
|
|
115
|
-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
116
|
-
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
120
|
-
if (hermesEnabled.toBoolean()) {
|
|
121
|
-
implementation("com.facebook.react:hermes-android")
|
|
122
|
-
} else {
|
|
123
|
-
implementation jscFlavor
|
|
124
|
-
}
|
|
100
|
+
implementation("com.facebook.react:hermes-android")
|
|
125
101
|
}
|
|
126
|
-
|
|
127
|
-
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.regula.dr.fullauthrfid
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactActivity
|
|
4
|
+
import com.facebook.react.ReactActivityDelegate
|
|
5
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
|
|
6
|
+
import com.facebook.react.defaults.DefaultReactActivityDelegate
|
|
7
|
+
|
|
8
|
+
class MainActivity : ReactActivity() {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
12
|
+
* rendering of the component.
|
|
13
|
+
*/
|
|
14
|
+
override fun getMainComponentName(): String = "DocumentReader"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
|
|
18
|
+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
|
|
19
|
+
*/
|
|
20
|
+
override fun createReactActivityDelegate(): ReactActivityDelegate =
|
|
21
|
+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.regula.dr.fullauthrfid
|
|
2
|
+
|
|
3
|
+
import android.app.Application
|
|
4
|
+
import com.facebook.react.PackageList
|
|
5
|
+
import com.facebook.react.ReactApplication
|
|
6
|
+
import com.facebook.react.ReactHost
|
|
7
|
+
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
|
|
8
|
+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
|
|
9
|
+
|
|
10
|
+
class MainApplication : Application(), ReactApplication {
|
|
11
|
+
|
|
12
|
+
override val reactHost: ReactHost by lazy {
|
|
13
|
+
getDefaultReactHost(
|
|
14
|
+
context = applicationContext,
|
|
15
|
+
useDevSupport = false,
|
|
16
|
+
packageList =
|
|
17
|
+
PackageList(this).packages.apply {
|
|
18
|
+
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
19
|
+
// add(MyReactNativePackage())
|
|
20
|
+
},
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override fun onCreate() {
|
|
25
|
+
super.onCreate()
|
|
26
|
+
loadReactNative(this)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
buildscript {
|
|
2
2
|
ext {
|
|
3
|
-
buildToolsVersion = "
|
|
3
|
+
buildToolsVersion = "37.0.0"
|
|
4
4
|
minSdkVersion = 24
|
|
5
|
-
compileSdkVersion =
|
|
6
|
-
targetSdkVersion =
|
|
7
|
-
|
|
5
|
+
compileSdkVersion = 37
|
|
6
|
+
targetSdkVersion = 36
|
|
8
7
|
ndkVersion = "27.1.12297006"
|
|
9
|
-
kotlinVersion = "2.0
|
|
8
|
+
kotlinVersion = "2.2.0"
|
|
10
9
|
}
|
|
11
10
|
repositories {
|
|
12
11
|
google()
|
|
@@ -15,5 +14,8 @@ buildscript {
|
|
|
15
14
|
dependencies {
|
|
16
15
|
classpath("com.android.tools.build:gradle")
|
|
17
16
|
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
17
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
apply plugin: "com.facebook.react.rootproject"
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
|
+
validateDistributionUrl=true
|
|
5
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
6
7
|
zipStorePath=wrapper/dists
|
|
@@ -24,9 +24,6 @@ android.useAndroidX=true
|
|
|
24
24
|
# Automatically convert third-party libraries to use AndroidX
|
|
25
25
|
android.enableJetifier=true
|
|
26
26
|
|
|
27
|
-
# Version of flipper SDK to use with React Native
|
|
28
|
-
FLIPPER_VERSION=0.182.0
|
|
29
|
-
|
|
30
27
|
# Use this property to specify which architecture you want to build.
|
|
31
28
|
# You can also override it from the CLI using
|
|
32
29
|
# ./gradlew <task> -PreactNativeArchitectures=x86_64
|
|
@@ -37,8 +34,12 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
|
|
|
37
34
|
# your application. You should enable this flag either if you want
|
|
38
35
|
# to write custom TurboModules/Fabric components OR use libraries that
|
|
39
36
|
# are providing them.
|
|
40
|
-
newArchEnabled=
|
|
37
|
+
newArchEnabled=true
|
|
41
38
|
|
|
42
39
|
# Use this property to enable or disable the Hermes JS engine.
|
|
43
40
|
# If set to false, you will be using JSC instead.
|
|
44
|
-
hermesEnabled=
|
|
41
|
+
hermesEnabled=true
|
|
42
|
+
|
|
43
|
+
# Legacy Regula/RNFS libraries still apply the standalone Kotlin Android plugin.
|
|
44
|
+
android.builtInKotlin=false
|
|
45
|
+
android.newDsl=false
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
#import "AppDelegate.h"
|
|
2
2
|
|
|
3
|
-
#import <React/
|
|
3
|
+
#import <React/RCTDevLoadingViewSetEnabled.h>
|
|
4
|
+
#import <React/RCTDevSettings.h>
|
|
5
|
+
#import <ReactAppDependencyProvider/RCTAppDependencyProvider.h>
|
|
4
6
|
|
|
5
7
|
@implementation AppDelegate
|
|
6
8
|
|
|
7
9
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
8
10
|
{
|
|
11
|
+
// This demo runs from the embedded bundle, including in Debug builds.
|
|
12
|
+
RCTDevLoadingViewSetEnabled(NO);
|
|
13
|
+
RCTDevSettingsSetEnabled(NO);
|
|
14
|
+
|
|
15
|
+
// UIWindow is owned by SceneDelegate under the scene-based lifecycle.
|
|
16
|
+
self.automaticallyLoadReactNativeWindow = NO;
|
|
9
17
|
self.moduleName = @"DocumentReader";
|
|
10
18
|
// You can add your custom initial props in the dictionary below.
|
|
11
19
|
// They will be passed down to the ViewController used by React Native.
|
|
12
20
|
self.initialProps = @{};
|
|
21
|
+
self.dependencyProvider = [RCTAppDependencyProvider new];
|
|
13
22
|
|
|
14
23
|
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
|
15
24
|
}
|
|
@@ -21,11 +30,7 @@
|
|
|
21
30
|
|
|
22
31
|
- (NSURL *)bundleURL
|
|
23
32
|
{
|
|
24
|
-
#if DEBUG
|
|
25
|
-
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
|
|
26
|
-
#else
|
|
27
33
|
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
|
28
|
-
#endif
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
@end
|
|
@@ -43,11 +43,30 @@
|
|
|
43
43
|
<string></string>
|
|
44
44
|
<key>NSPhotoLibraryUsageDescription</key>
|
|
45
45
|
<string>To use gallery</string>
|
|
46
|
+
<key>RCTNewArchEnabled</key>
|
|
47
|
+
<true/>
|
|
48
|
+
<key>UIApplicationSceneManifest</key>
|
|
49
|
+
<dict>
|
|
50
|
+
<key>UIApplicationSupportsMultipleScenes</key>
|
|
51
|
+
<false/>
|
|
52
|
+
<key>UISceneConfigurations</key>
|
|
53
|
+
<dict>
|
|
54
|
+
<key>UIWindowSceneSessionRoleApplication</key>
|
|
55
|
+
<array>
|
|
56
|
+
<dict>
|
|
57
|
+
<key>UISceneConfigurationName</key>
|
|
58
|
+
<string>Default Configuration</string>
|
|
59
|
+
<key>UISceneDelegateClassName</key>
|
|
60
|
+
<string>SceneDelegate</string>
|
|
61
|
+
</dict>
|
|
62
|
+
</array>
|
|
63
|
+
</dict>
|
|
64
|
+
</dict>
|
|
46
65
|
<key>UILaunchStoryboardName</key>
|
|
47
66
|
<string>LaunchScreen</string>
|
|
48
67
|
<key>UIRequiredDeviceCapabilities</key>
|
|
49
68
|
<array>
|
|
50
|
-
<string>
|
|
69
|
+
<string>arm64</string>
|
|
51
70
|
</array>
|
|
52
71
|
<key>UISupportedInterfaceOrientations</key>
|
|
53
72
|
<array>
|
|
@@ -58,7 +77,7 @@
|
|
|
58
77
|
<string>UIInterfaceOrientationPortrait</string>
|
|
59
78
|
</array>
|
|
60
79
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
|
61
|
-
<
|
|
80
|
+
<true/>
|
|
62
81
|
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
|
|
63
82
|
<array>
|
|
64
83
|
<string>A0000002471001</string>
|
|
@@ -69,27 +88,5 @@
|
|
|
69
88
|
<string>A0000002480300</string>
|
|
70
89
|
<string>A00000045645444C2D3031</string>
|
|
71
90
|
</array>
|
|
72
|
-
<key>UIAppFonts</key>
|
|
73
|
-
<array>
|
|
74
|
-
<string>AntDesign.ttf</string>
|
|
75
|
-
<string>Entypo.ttf</string>
|
|
76
|
-
<string>EvilIcons.ttf</string>
|
|
77
|
-
<string>Feather.ttf</string>
|
|
78
|
-
<string>FontAwesome.ttf</string>
|
|
79
|
-
<string>FontAwesome5_Brands.ttf</string>
|
|
80
|
-
<string>FontAwesome5_Regular.ttf</string>
|
|
81
|
-
<string>FontAwesome5_Solid.ttf</string>
|
|
82
|
-
<string>FontAwesome6_Brands.ttf</string>
|
|
83
|
-
<string>FontAwesome6_Regular.ttf</string>
|
|
84
|
-
<string>FontAwesome6_Solid.ttf</string>
|
|
85
|
-
<string>Foundation.ttf</string>
|
|
86
|
-
<string>Ionicons.ttf</string>
|
|
87
|
-
<string>MaterialIcons.ttf</string>
|
|
88
|
-
<string>MaterialCommunityIcons.ttf</string>
|
|
89
|
-
<string>SimpleLineIcons.ttf</string>
|
|
90
|
-
<string>Octicons.ttf</string>
|
|
91
|
-
<string>Zocial.ttf</string>
|
|
92
|
-
<string>Fontisto.ttf</string>
|
|
93
|
-
</array>
|
|
94
91
|
</dict>
|
|
95
92
|
</plist>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#import "SceneDelegate.h"
|
|
2
|
+
#import "AppDelegate.h"
|
|
3
|
+
|
|
4
|
+
@implementation SceneDelegate
|
|
5
|
+
|
|
6
|
+
- (void)scene:(UIScene *)scene
|
|
7
|
+
willConnectToSession:(UISceneSession *)session
|
|
8
|
+
options:(UISceneConnectionOptions *)connectionOptions
|
|
9
|
+
{
|
|
10
|
+
if (![scene isKindOfClass:[UIWindowScene class]]) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
AppDelegate *appDelegate = (AppDelegate *)UIApplication.sharedApplication.delegate;
|
|
15
|
+
UIView *rootView = [appDelegate.rootViewFactory viewWithModuleName:appDelegate.moduleName
|
|
16
|
+
initialProperties:appDelegate.initialProps];
|
|
17
|
+
UIViewController *rootViewController = [appDelegate createRootViewController];
|
|
18
|
+
[appDelegate setRootView:rootView toRootViewController:rootViewController];
|
|
19
|
+
|
|
20
|
+
self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
|
|
21
|
+
self.window.rootViewController = rootViewController;
|
|
22
|
+
// Keep compatibility with native modules that access the app delegate's window.
|
|
23
|
+
appDelegate.window = self.window;
|
|
24
|
+
[self.window makeKeyAndVisible];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@end
|