@regulaforensics/document-reader 8.3.310-beta → 8.4.2-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 -1
- package/RNDocumentReader.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/cordova.gradle +2 -2
- package/android/src/main/java/com/regula/plugin/documentreader/BluetoothUtil.kt +9 -5
- package/android/src/main/java/com/regula/plugin/documentreader/Config.kt +20 -0
- package/android/src/main/java/com/regula/plugin/documentreader/JSONConstructor.kt +3 -0
- package/android/src/main/java/com/regula/plugin/documentreader/Main.kt +8 -5
- package/examples/capacitor/index.tsx +5 -5
- package/examples/capacitor/package-lock.json +372 -335
- package/examples/capacitor/package.json +3 -3
- package/examples/ionic/index.tsx +6 -2
- package/examples/ionic/package-lock.json +519 -814
- package/examples/ionic/package.json +3 -3
- package/examples/react_native/index.html +5 -4
- package/examples/react_native/package-lock.json +984 -818
- package/examples/react_native/package.json +3 -3
- package/ios/RGLWConfig.m +10 -9
- package/ios/RGLWJSONConstructor.m +3 -0
- package/ios/RGLWMain.h +2 -2
- package/ios/RGLWMain.m +2 -2
- package/ios/RNDocumentReader.m +2 -2
- package/package.json +1 -1
- package/plugin.xml +2 -2
- package/test/json.tsx +44 -31
- package/test/package-lock.json +1 -1
- package/test/test.tsx +1 -1
- package/www/capacitor/config/InitConfig.js +3 -0
- package/www/capacitor/index.js +0 -1
- package/www/capacitor/info/DocReaderException.js +2 -0
- package/www/capacitor/params/Functionality.js +8 -0
- package/www/capacitor/params/customization/CustomizationColors.js +32 -0
- package/www/capacitor/params/customization/CustomizationFonts.js +24 -0
- package/www/capacitor/params/customization/CustomizationImages.js +8 -0
- package/www/capacitor/params/process_params/AuthenticityParams.js +1 -0
- package/www/capacitor/params/process_params/LivenessParams.js +2 -2
- package/www/capacitor/params/process_params/ProcessParams.js +10 -0
- package/www/capacitor/results/authenticity/CheckDiagnose.js +2 -0
- package/www/capacitor/results/authenticity/SecurityFeatureType.js +3 -1
- package/www/cordova.js +95 -4
- package/www/react-native/config/InitConfig.js +3 -0
- package/www/react-native/index.js +0 -1
- package/www/react-native/info/DocReaderException.js +2 -0
- package/www/react-native/params/Functionality.js +8 -0
- package/www/react-native/params/customization/CustomizationColors.js +32 -0
- package/www/react-native/params/customization/CustomizationFonts.js +24 -0
- package/www/react-native/params/customization/CustomizationImages.js +8 -0
- package/www/react-native/params/process_params/AuthenticityParams.js +1 -0
- package/www/react-native/params/process_params/LivenessParams.js +2 -2
- package/www/react-native/params/process_params/ProcessParams.js +10 -0
- package/www/react-native/results/authenticity/CheckDiagnose.js +2 -0
- package/www/react-native/results/authenticity/SecurityFeatureType.js +3 -1
- package/www/types/config/InitConfig.d.ts +5 -0
- package/www/types/index.d.ts +2 -2
- package/www/types/info/DocReaderException.d.ts +4 -0
- package/www/types/params/Functionality.d.ts +6 -0
- package/www/types/params/customization/CustomizationColors.d.ts +16 -8
- package/www/types/params/customization/CustomizationFonts.d.ts +6 -0
- package/www/types/params/customization/CustomizationImages.d.ts +6 -1
- package/www/types/params/process_params/ProcessParams.d.ts +5 -0
- package/www/types/results/authenticity/CheckDiagnose.d.ts +4 -0
- package/www/types/results/authenticity/SecurityFeatureType.d.ts +4 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ Document Reader allows you to read various kinds of identification documents, pa
|
|
|
3
3
|
|
|
4
4
|
## Demo applications
|
|
5
5
|
In the [examples](examples/) folder you can find 3 demo applications:
|
|
6
|
-
* [React-native](examples/
|
|
6
|
+
* [React-native](examples/react_native)
|
|
7
7
|
* [Ionic(ionic app with cordova, angular)](examples/ionic)
|
|
8
8
|
* [Capacitor(ionic app with capacitor, react)](examples/capacitor)
|
|
9
9
|
|
package/RNDocumentReader.podspec
CHANGED
|
@@ -5,7 +5,7 @@ source = File.join(__dir__, 'ios')
|
|
|
5
5
|
|
|
6
6
|
Pod::Spec.new do |s|
|
|
7
7
|
s.name = 'RNDocumentReader'
|
|
8
|
-
s.version = '8.
|
|
8
|
+
s.version = '8.4.2-nightly'
|
|
9
9
|
s.summary = package['description']
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
|
|
@@ -16,6 +16,6 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.ios.deployment_target = '13.0'
|
|
17
17
|
s.source_files = 'ios/**/*.{h,m}'
|
|
18
18
|
s.exclude_files = [ 'ios/CVDDocumentReader.h', 'ios/CVDDocumentReader.m' ]
|
|
19
|
-
s.dependency '
|
|
19
|
+
s.dependency 'DocumentReaderNightly', '8.5.5556'
|
|
20
20
|
s.dependency 'React'
|
|
21
21
|
end
|
package/android/build.gradle
CHANGED
|
@@ -20,7 +20,7 @@ android {
|
|
|
20
20
|
rootProject.allprojects {
|
|
21
21
|
repositories {
|
|
22
22
|
maven {
|
|
23
|
-
url "https://maven.regulaforensics.com/RegulaDocumentReader/
|
|
23
|
+
url "https://maven.regulaforensics.com/RegulaDocumentReader/Nightly"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -29,7 +29,7 @@ dependencies {
|
|
|
29
29
|
//noinspection GradleDynamicVersion
|
|
30
30
|
implementation 'com.facebook.react:react-native:+'
|
|
31
31
|
//noinspection GradleDependency
|
|
32
|
-
implementation('com.regula.documentreader:api:8.
|
|
32
|
+
implementation('com.regula.documentreader:api:8.5.12093'){
|
|
33
33
|
transitive = true
|
|
34
34
|
}
|
|
35
35
|
}
|
package/android/cordova.gradle
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
repositories {
|
|
2
2
|
maven {
|
|
3
|
-
url "https://maven.regulaforensics.com/RegulaDocumentReader/
|
|
3
|
+
url "https://maven.regulaforensics.com/RegulaDocumentReader/Nightly"
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
dependencies {
|
|
8
8
|
//noinspection GradleDependency
|
|
9
|
-
implementation('com.regula.documentreader:api:8.
|
|
9
|
+
implementation('com.regula.documentreader:api:8.5.12093'){
|
|
10
10
|
transitive = true
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -7,6 +7,7 @@ import android.annotation.SuppressLint
|
|
|
7
7
|
import android.app.Activity
|
|
8
8
|
import android.bluetooth.BluetoothAdapter
|
|
9
9
|
import android.content.ComponentName
|
|
10
|
+
import android.content.Context.BIND_AUTO_CREATE
|
|
10
11
|
import android.content.Intent
|
|
11
12
|
import android.content.ServiceConnection
|
|
12
13
|
import android.content.pm.PackageManager.PERMISSION_GRANTED
|
|
@@ -31,9 +32,10 @@ const val INTENT_REQUEST_ENABLE_BLUETOOTH = 197
|
|
|
31
32
|
|
|
32
33
|
@SuppressLint("StaticFieldLeak")
|
|
33
34
|
var bluetooth: BLEWrapper? = null
|
|
35
|
+
lateinit var savedDeviceNameForPermissionResult: String
|
|
34
36
|
lateinit var savedCallbackForPermissionResult: Callback
|
|
35
37
|
|
|
36
|
-
fun connectBluetoothDevice(callback: Callback) {
|
|
38
|
+
fun connectBluetoothDevice(deviceName: String, callback: Callback) {
|
|
37
39
|
if (bluetooth?.isConnected == true) {
|
|
38
40
|
Log.e("REGULA", "Bluetooth device already connected, returning false")
|
|
39
41
|
callback(false)
|
|
@@ -41,6 +43,7 @@ fun connectBluetoothDevice(callback: Callback) {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
if (!isBluetoothSettingsReady(activity)) {
|
|
46
|
+
savedDeviceNameForPermissionResult = deviceName
|
|
44
47
|
savedCallbackForPermissionResult = callback
|
|
45
48
|
return
|
|
46
49
|
}
|
|
@@ -55,6 +58,7 @@ fun connectBluetoothDevice(callback: Callback) {
|
|
|
55
58
|
Timer().schedule(timeout, SEARCHING_TIMEOUT)
|
|
56
59
|
|
|
57
60
|
val bleIntent = Intent(context, RegulaBleService::class.java)
|
|
61
|
+
bleIntent.putExtra(RegulaBleService.DEVICE_NAME, deviceName)
|
|
58
62
|
context.startService(bleIntent)
|
|
59
63
|
context.bindService(bleIntent, object : ServiceConnection {
|
|
60
64
|
override fun onServiceConnected(name: ComponentName, service: IBinder) {
|
|
@@ -70,7 +74,7 @@ fun connectBluetoothDevice(callback: Callback) {
|
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
override fun onServiceDisconnected(name: ComponentName) {}
|
|
73
|
-
},
|
|
77
|
+
}, BIND_AUTO_CREATE)
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
fun onRequestPermissionsResult(
|
|
@@ -83,7 +87,7 @@ fun onRequestPermissionsResult(
|
|
|
83
87
|
savedCallbackForPermissionResult(false)
|
|
84
88
|
return true
|
|
85
89
|
}
|
|
86
|
-
connectBluetoothDevice(savedCallbackForPermissionResult)
|
|
90
|
+
connectBluetoothDevice(savedDeviceNameForPermissionResult, savedCallbackForPermissionResult)
|
|
87
91
|
return true
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -95,7 +99,7 @@ fun onActivityResult(requestCode: Int, rc: Int, @Suppress("UNUSED_PARAMETER") da
|
|
|
95
99
|
|
|
96
100
|
if (requestCode == INTENT_REQUEST_ENABLE_BLUETOOTH || requestCode == INTENT_REQUEST_ENABLE_LOCATION) {
|
|
97
101
|
if (resultCode == Activity.RESULT_OK)
|
|
98
|
-
connectBluetoothDevice(savedCallbackForPermissionResult)
|
|
102
|
+
connectBluetoothDevice(savedDeviceNameForPermissionResult, savedCallbackForPermissionResult)
|
|
99
103
|
else
|
|
100
104
|
savedCallbackForPermissionResult(false)
|
|
101
105
|
return true
|
|
@@ -126,7 +130,7 @@ fun deniedBluetoothPermissions(): Array<String>? {
|
|
|
126
130
|
result.addAll(deniedBluetoothPermission(BLUETOOTH_CONNECT))
|
|
127
131
|
} else
|
|
128
132
|
result.addAll(deniedBluetoothPermission(ACCESS_FINE_LOCATION))
|
|
129
|
-
return result.let { if (it.
|
|
133
|
+
return result.let { if (it.isNotEmpty()) it.toTypedArray() else null }
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
fun deniedBluetoothPermission(permission: String): Array<String> {
|
|
@@ -47,6 +47,7 @@ fun setFunctionality(config: Functionality, input: JSONObject) = input.forEach {
|
|
|
47
47
|
"recordScanningProcess" -> editor.setDoRecordProcessingVideo(v as Boolean)
|
|
48
48
|
"manualMultipageMode" -> editor.setManualMultipageMode(v as Boolean)
|
|
49
49
|
"torchTurnedOn" -> editor.setTorchTurnedOn(v as Boolean)
|
|
50
|
+
"preventScreenRecording" -> editor.setPreventScreenRecording(v as Boolean)
|
|
50
51
|
"showCaptureButtonDelayFromDetect" -> editor.setShowCaptureButtonDelayFromDetect(v.toLong())
|
|
51
52
|
"showCaptureButtonDelayFromStart" -> editor.setShowCaptureButtonDelayFromStart(v.toLong())
|
|
52
53
|
"orientation" -> editor.setOrientation(v.toInt())
|
|
@@ -82,6 +83,7 @@ fun getFunctionality(input: Functionality) = mapOf(
|
|
|
82
83
|
"recordScanningProcess" to input.doRecordProcessingVideo(),
|
|
83
84
|
"manualMultipageMode" to input.isManualMultipageMode,
|
|
84
85
|
"torchTurnedOn" to input.isTorchTurnedOn,
|
|
86
|
+
"preventScreenRecording" to input.doPreventScreenRecording(),
|
|
85
87
|
"showCaptureButtonDelayFromDetect" to input.showCaptureButtonDelayFromDetect,
|
|
86
88
|
"showCaptureButtonDelayFromStart" to input.showCaptureButtonDelayFromStart,
|
|
87
89
|
"orientation" to input.orientation,
|
|
@@ -141,6 +143,7 @@ fun setProcessParams(processParams: ProcessParam, opts: JSONObject) = opts.forEa
|
|
|
141
143
|
"generateAlpha2Codes" -> processParams.generateAlpha2Codes = v as Boolean
|
|
142
144
|
"disableAuthResolutionFilter" -> processParams.disableAuthResolutionFilter = v as Boolean
|
|
143
145
|
"strictSecurityChecks" -> processParams.strictSecurityChecks = v as Boolean
|
|
146
|
+
"returnTransliteratedFields" -> processParams.returnTransliteratedFields = v as Boolean
|
|
144
147
|
"measureSystem" -> processParams.measureSystem = v.toInt()
|
|
145
148
|
"barcodeParserType" -> processParams.barcodeParserType = v.toInt()
|
|
146
149
|
"perspectiveAngle" -> processParams.perspectiveAngle = v.toInt()
|
|
@@ -227,6 +230,7 @@ fun getProcessParams(processParams: ProcessParam) = mapOf(
|
|
|
227
230
|
"generateAlpha2Codes" to processParams.generateAlpha2Codes,
|
|
228
231
|
"disableAuthResolutionFilter" to processParams.disableAuthResolutionFilter,
|
|
229
232
|
"strictSecurityChecks" to processParams.strictSecurityChecks,
|
|
233
|
+
"returnTransliteratedFields" to processParams.returnTransliteratedFields,
|
|
230
234
|
"measureSystem" to processParams.measureSystem,
|
|
231
235
|
"barcodeParserType" to processParams.barcodeParserType,
|
|
232
236
|
"perspectiveAngle" to processParams.perspectiveAngle,
|
|
@@ -752,6 +756,10 @@ fun setColors(input: ParamsCustomization.CustomizationEditor, opts: JSONObject)
|
|
|
752
756
|
"rfidProcessingScreenProgressBarBackground" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND, value)
|
|
753
757
|
"rfidProcessingScreenResultLabelText" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT, value)
|
|
754
758
|
"rfidProcessingScreenLoadingBar" -> input.setColor(CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR, value)
|
|
759
|
+
"rfidEnableNfcTitleText" -> input.setColor(CustomizationColor.RFID_ENABLE_NFC_TITLE_TEXT, value)
|
|
760
|
+
"rfidEnableNfcDescriptionText" -> input.setColor(CustomizationColor.RFID_ENABLE_NFC_DESCRIPTION_TEXT, value)
|
|
761
|
+
"rfidEnableNfcButtonText" -> input.setColor(CustomizationColor.RFID_ENABLE_NFC_BUTTON_TEXT, value)
|
|
762
|
+
"rfidEnableNfcButtonBackground" -> input.setColor(CustomizationColor.RFID_ENABLE_NFC_BUTTON_BACKGROUND, value)
|
|
755
763
|
}
|
|
756
764
|
}
|
|
757
765
|
|
|
@@ -764,6 +772,10 @@ fun getColors(input: Map<CustomizationColor, Long>) = mapOf(
|
|
|
764
772
|
"rfidProcessingScreenProgressBarBackground" to input[CustomizationColor.RFID_PROCESSING_SCREEN_PROGRESS_BAR_BACKGROUND],
|
|
765
773
|
"rfidProcessingScreenResultLabelText" to input[CustomizationColor.RFID_PROCESSING_SCREEN_RESULT_LABEL_TEXT],
|
|
766
774
|
"rfidProcessingScreenLoadingBar" to input[CustomizationColor.RFID_PROCESSING_SCREEN_LOADING_BAR],
|
|
775
|
+
"rfidEnableNfcTitleText" to input[CustomizationColor.RFID_ENABLE_NFC_TITLE_TEXT],
|
|
776
|
+
"rfidEnableNfcDescriptionText" to input[CustomizationColor.RFID_ENABLE_NFC_DESCRIPTION_TEXT],
|
|
777
|
+
"rfidEnableNfcButtonText" to input[CustomizationColor.RFID_ENABLE_NFC_BUTTON_TEXT],
|
|
778
|
+
"rfidEnableNfcButtonBackground" to input[CustomizationColor.RFID_ENABLE_NFC_BUTTON_BACKGROUND],
|
|
767
779
|
).toJson()
|
|
768
780
|
|
|
769
781
|
fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, value ->
|
|
@@ -771,6 +783,9 @@ fun setFonts(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) =
|
|
|
771
783
|
"rfidProcessingScreenHintLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.setFont(input, value)
|
|
772
784
|
"rfidProcessingScreenProgressLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.setFont(input, value)
|
|
773
785
|
"rfidProcessingScreenResultLabel" -> CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.setFont(input, value)
|
|
786
|
+
"rfidEnableNfcTitleText" -> CustomizationFont.RFID_ENABLE_NFC_TITLE_TEXT.setFont(input, value)
|
|
787
|
+
"rfidEnableNfcDescriptionText" -> CustomizationFont.RFID_ENABLE_NFC_DESCRIPTION_TEXT.setFont(input, value)
|
|
788
|
+
"rfidEnableNfcButtonText" -> CustomizationFont.RFID_ENABLE_NFC_BUTTON_TEXT.setFont(input, value)
|
|
774
789
|
}
|
|
775
790
|
}
|
|
776
791
|
|
|
@@ -778,16 +793,21 @@ fun getFonts(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFo
|
|
|
778
793
|
"rfidProcessingScreenHintLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_HINT_LABEL.getFont(fonts, sizes),
|
|
779
794
|
"rfidProcessingScreenProgressLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_PROGRESS_LABEL.getFont(fonts, sizes),
|
|
780
795
|
"rfidProcessingScreenResultLabel" to CustomizationFont.RFID_PROCESSING_SCREEN_RESULT_LABEL.getFont(fonts, sizes),
|
|
796
|
+
"rfidEnableNfcTitleText" to CustomizationFont.RFID_ENABLE_NFC_TITLE_TEXT.getFont(fonts, sizes),
|
|
797
|
+
"rfidEnableNfcDescriptionText" to CustomizationFont.RFID_ENABLE_NFC_DESCRIPTION_TEXT.getFont(fonts, sizes),
|
|
798
|
+
"rfidEnableNfcButtonText" to CustomizationFont.RFID_ENABLE_NFC_BUTTON_TEXT.getFont(fonts, sizes),
|
|
781
799
|
).toJson()
|
|
782
800
|
|
|
783
801
|
fun setImages(input: ParamsCustomization.CustomizationEditor, opts: JSONObject) = opts.forEach { key, v ->
|
|
784
802
|
when (key) {
|
|
785
803
|
"rfidProcessingScreenFailureImage" -> input.setImage(CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE, v.toDrawable())
|
|
804
|
+
"rfidEnableNfcImage" -> input.setImage(CustomizationImage.RFID_ENABLE_NFC_IMAGE, v.toDrawable())
|
|
786
805
|
}
|
|
787
806
|
}
|
|
788
807
|
|
|
789
808
|
fun getImages(input: Map<CustomizationImage, Drawable>) = mapOf(
|
|
790
809
|
"rfidProcessingScreenFailureImage" to (input[CustomizationImage.RFID_PROCESSING_SCREEN_FAILURE_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_ic_error)).toBase64(),
|
|
810
|
+
"rfidEnableNfcImage" to (input[CustomizationImage.RFID_ENABLE_NFC_IMAGE] ?: ContextCompat.getDrawable(context, com.regula.documentreader.api.R.drawable.reg_enable_nfc)).toBase64(),
|
|
791
811
|
).toJson()
|
|
792
812
|
|
|
793
813
|
fun CustomizationFont.getFont(fonts: Map<CustomizationFont, Typeface>, sizes: Map<CustomizationFont, Int>) =
|
|
@@ -192,6 +192,7 @@ fun initConfigFromJSON(input: JSONObject) = input.let {
|
|
|
192
192
|
|
|
193
193
|
if (it.has("licenseUpdate")) result.setLicenseUpdate(it.getBoolean("licenseUpdate"))
|
|
194
194
|
if (it.has("delayedNNLoad")) result.isDelayedNNLoad = it.getBoolean("delayedNNLoad")
|
|
195
|
+
result.licenseUpdateTimeout = it.getDoubleOrNull("licenseUpdateTimeout")
|
|
195
196
|
result.blackList = it.getJSONObjectOrNull("blackList")
|
|
196
197
|
result
|
|
197
198
|
}
|
|
@@ -203,6 +204,7 @@ fun generateInitConfig(input: DocReaderConfig?) = input?.let {
|
|
|
203
204
|
"databasePath" to it.customDbPath,
|
|
204
205
|
"licenseUpdate" to it.isLicenseUpdate,
|
|
205
206
|
"delayedNNLoad" to it.isDelayedNNLoad,
|
|
207
|
+
"licenseUpdateTimeout" to it.licenseUpdateTimeout,
|
|
206
208
|
"blackList" to it.blackList
|
|
207
209
|
).toJson()
|
|
208
210
|
}
|
|
@@ -213,6 +215,7 @@ fun initBleDeviceConfigFromJSON(input: JSONObject) = input.let {
|
|
|
213
215
|
|
|
214
216
|
if (it.has("licenseUpdate")) result.setLicenseUpdate(it.getBoolean("licenseUpdate"))
|
|
215
217
|
if (it.has("delayedNNLoad")) result.isDelayedNNLoad = it.getBoolean("delayedNNLoad")
|
|
218
|
+
result.licenseUpdateTimeout = it.getDoubleOrNull("licenseUpdateTimeout")
|
|
216
219
|
result.blackList = it.getJSONObjectOrNull("blackList")
|
|
217
220
|
result
|
|
218
221
|
}
|
|
@@ -16,6 +16,7 @@ import com.regula.documentreader.api.DocumentReader.Instance
|
|
|
16
16
|
import com.regula.documentreader.api.completions.IDocumentReaderCompletion
|
|
17
17
|
import com.regula.documentreader.api.completions.IDocumentReaderInitCompletion
|
|
18
18
|
import com.regula.documentreader.api.completions.IDocumentReaderPrepareDbCompletion
|
|
19
|
+
import com.regula.documentreader.api.completions.IVideoEncoderCompletion
|
|
19
20
|
import com.regula.documentreader.api.completions.model.PrepareProgress
|
|
20
21
|
import com.regula.documentreader.api.completions.rfid.IRfidPKDCertificateCompletion
|
|
21
22
|
import com.regula.documentreader.api.completions.rfid.IRfidReaderCompletion
|
|
@@ -44,11 +45,11 @@ import org.json.JSONObject
|
|
|
44
45
|
import com.regula.plugin.documentreader.Convert.toBase64
|
|
45
46
|
import com.regula.plugin.documentreader.Convert.toByteArray
|
|
46
47
|
|
|
47
|
-
fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
|
|
48
|
+
fun methodCall(method: String, callback: (Any?) -> Unit): Any? = when (method) {
|
|
48
49
|
"getDocumentReaderIsReady" -> getDocumentReaderIsReady(callback)
|
|
49
50
|
"getDocumentReaderStatus" -> getDocumentReaderStatus(callback)
|
|
50
51
|
"getRfidSessionStatus" -> getRfidSessionStatus(callback)
|
|
51
|
-
"setRfidSessionStatus" -> setRfidSessionStatus(
|
|
52
|
+
"setRfidSessionStatus" -> setRfidSessionStatus()
|
|
52
53
|
"getTag" -> getTag(callback)
|
|
53
54
|
"setTag" -> setTag(argsNullable(0))
|
|
54
55
|
"getTenant" -> getTenant(callback)
|
|
@@ -90,7 +91,7 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
|
|
|
90
91
|
"addPKDCertificates" -> addPKDCertificates(args(0))
|
|
91
92
|
"clearPKDCertificates" -> clearPKDCertificates()
|
|
92
93
|
"startNewSession" -> startNewSession()
|
|
93
|
-
"connectBluetoothDevice" -> connectBluetoothDevice(callback)
|
|
94
|
+
"connectBluetoothDevice" -> connectBluetoothDevice(args(0), callback)
|
|
94
95
|
"btDeviceRequestFlashing" -> btDeviceRequestFlashing()
|
|
95
96
|
"btDeviceRequestFlashingFullIR" -> btDeviceRequestFlashingFullIR()
|
|
96
97
|
"btDeviceRequestTurnOffAll" -> btDeviceRequestTurnOffAll()
|
|
@@ -148,7 +149,7 @@ fun getDocumentReaderStatus(callback: Callback) = callback(Instance().status)
|
|
|
148
149
|
|
|
149
150
|
fun getRfidSessionStatus(iosOnly: Callback) = iosOnly(null)
|
|
150
151
|
|
|
151
|
-
fun setRfidSessionStatus(
|
|
152
|
+
fun setRfidSessionStatus() = Unit
|
|
152
153
|
|
|
153
154
|
fun getTag(callback: Callback) = callback(Instance().tag)
|
|
154
155
|
|
|
@@ -476,7 +477,8 @@ fun prepareCompletion(callback: Callback) = object : IDocumentReaderPrepareDbCom
|
|
|
476
477
|
|
|
477
478
|
fun initCompletion(callback: Callback) = IDocumentReaderInitCompletion { success, error ->
|
|
478
479
|
if (success) {
|
|
479
|
-
|
|
480
|
+
videoEncoderCompletion = IVideoEncoderCompletion { _, file -> sendEvent(videoEncoderCompletionEvent, file.path) }
|
|
481
|
+
Instance().setVideoEncoderCompletion(videoEncoderCompletion)
|
|
480
482
|
Instance().setOnClickListener { sendEvent(onCustomButtonTappedEvent, it.tag) }
|
|
481
483
|
}
|
|
482
484
|
callback(generateSuccessCompletion(success, error))
|
|
@@ -577,3 +579,4 @@ fun stopBackgroundRFID() {
|
|
|
577
579
|
|
|
578
580
|
// Weak references
|
|
579
581
|
lateinit var localizationCallbacks: LocalizationCallbacks
|
|
582
|
+
lateinit var videoEncoderCompletion: IVideoEncoderCompletion
|
|
@@ -6,11 +6,11 @@ import { File } from '@awesome-cordova-plugins/file'
|
|
|
6
6
|
import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera'
|
|
7
7
|
import { main } from './src/main'
|
|
8
8
|
|
|
9
|
-
document.addEventListener('deviceready', () =>
|
|
10
|
-
.then(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
)
|
|
9
|
+
document.addEventListener('deviceready', async () => {
|
|
10
|
+
document.getElementById("content").innerHTML = await fetch("main.html").then(r => r.text())
|
|
11
|
+
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))
|
|
12
|
+
document.dispatchEvent(new Event('ready'))
|
|
13
|
+
})
|
|
14
14
|
|
|
15
15
|
export async function loadAsset(path: string): Promise<string> {
|
|
16
16
|
var dir = await File.resolveDirectoryUrl(File.applicationDirectory + "public/assets")
|