@regulaforensics/document-reader 8.2.186-beta
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 +18 -0
- package/RNDocumentReader.podspec +21 -0
- package/android/CVDDocumentReader.kt +74 -0
- package/android/build.gradle +36 -0
- package/android/cordova.gradle +12 -0
- package/android/src/main/java/com/regula/plugin/documentreader/BluetoothUtil.kt +160 -0
- package/android/src/main/java/com/regula/plugin/documentreader/Config.kt +826 -0
- package/android/src/main/java/com/regula/plugin/documentreader/JSONConstructor.kt +1795 -0
- package/android/src/main/java/com/regula/plugin/documentreader/Main.kt +573 -0
- package/android/src/main/java/com/regula/plugin/documentreader/RNDocumentReaderModule.kt +100 -0
- package/android/src/main/java/com/regula/plugin/documentreader/Utils.kt +181 -0
- package/examples/capacitor/README.md +12 -0
- package/examples/capacitor/android/app/build.gradle +50 -0
- package/examples/capacitor/android/app/capacitor.build.gradle +22 -0
- package/examples/capacitor/android/app/proguard-rules.pro +21 -0
- package/examples/capacitor/android/app/src/main/AndroidManifest.xml +27 -0
- package/examples/capacitor/android/app/src/main/assets/Regula/.gitkeep +0 -0
- package/examples/capacitor/android/app/src/main/java/com/regula/dr/fullauthrfid/MainActivity.java +5 -0
- package/examples/capacitor/android/app/src/main/res/drawable/ic_launcher.png +0 -0
- package/examples/capacitor/android/app/src/main/res/drawable/splash.png +0 -0
- package/examples/capacitor/android/app/src/main/res/layout/activity_main.xml +12 -0
- package/examples/capacitor/android/app/src/main/res/values/strings.xml +7 -0
- package/examples/capacitor/android/app/src/main/res/values/styles.xml +22 -0
- package/examples/capacitor/android/build.gradle +30 -0
- package/examples/capacitor/android/capacitor.settings.gradle +15 -0
- package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/capacitor/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/examples/capacitor/android/gradle.properties +22 -0
- package/examples/capacitor/android/gradlew +252 -0
- package/examples/capacitor/android/gradlew.bat +94 -0
- package/examples/capacitor/android/settings.gradle +5 -0
- package/examples/capacitor/android/variables.gradle +16 -0
- package/examples/capacitor/index.html +10 -0
- package/examples/capacitor/ionic.config.json +7 -0
- package/examples/capacitor/ios/App/App/App.entitlements +5 -0
- package/examples/capacitor/ios/App/App/AppDelegate.swift +49 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png +0 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json +14 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Contents.json +6 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json +23 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
- package/examples/capacitor/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
- package/examples/capacitor/ios/App/App/Base.lproj/LaunchScreen.storyboard +32 -0
- package/examples/capacitor/ios/App/App/Base.lproj/Main.storyboard +19 -0
- package/examples/capacitor/ios/App/App/Info.plist +53 -0
- package/examples/capacitor/ios/App/App.xcodeproj/project.pbxproj +414 -0
- package/examples/capacitor/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/examples/capacitor/ios/App/App.xcworkspace/contents.xcworkspacedata +10 -0
- package/examples/capacitor/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/examples/capacitor/ios/App/Podfile +26 -0
- package/examples/capacitor/ios/App/Podfile.lock +56 -0
- package/examples/capacitor/package-lock.json +3467 -0
- package/examples/capacitor/package.json +29 -0
- package/examples/capacitor/public/assets/.gitkeep +0 -0
- package/examples/capacitor/public/images/document.png +0 -0
- package/examples/capacitor/public/images/portrait.png +0 -0
- package/examples/capacitor/scripts/android.sh +9 -0
- package/examples/capacitor/scripts/ios.sh +8 -0
- package/examples/capacitor/scripts/setup.sh +6 -0
- package/examples/capacitor/src/extra/bt_device.tsx +32 -0
- package/examples/capacitor/src/extra/custom_rfid.tsx +74 -0
- package/examples/capacitor/src/main.css +131 -0
- package/examples/capacitor/src/main.html +41 -0
- package/examples/capacitor/src/main.tsx +175 -0
- package/examples/capacitor/tsconfig.json +5 -0
- package/examples/capacitor/vite.config.ts +17 -0
- package/examples/cordova/.vscode/launch.json +28 -0
- package/examples/cordova/.vscode/typings/cordova/cordova.d.ts +80 -0
- package/examples/cordova/README.md +12 -0
- package/examples/cordova/config.xml +29 -0
- package/examples/cordova/package-lock.json +1314 -0
- package/examples/cordova/package.json +32 -0
- package/examples/cordova/scripts/android.sh +8 -0
- package/examples/cordova/scripts/ios.sh +8 -0
- package/examples/cordova/scripts/setup.sh +8 -0
- package/examples/cordova/www/images/document.png +0 -0
- package/examples/cordova/www/images/logo.png +0 -0
- package/examples/cordova/www/images/portrait.png +0 -0
- package/examples/cordova/www/index.html +21 -0
- package/examples/cordova/www/src/main.css +130 -0
- package/examples/cordova/www/src/main.html +63 -0
- package/examples/cordova/www/src/main.js +50 -0
- package/examples/ionic/README.md +12 -0
- package/examples/ionic/angular.json +39 -0
- package/examples/ionic/config.xml +28 -0
- package/examples/ionic/index.html +19 -0
- package/examples/ionic/index.ts +17 -0
- package/examples/ionic/ionic.config.json +7 -0
- package/examples/ionic/package-lock.json +16559 -0
- package/examples/ionic/package.json +47 -0
- package/examples/ionic/scripts/android.sh +8 -0
- package/examples/ionic/scripts/ios.sh +8 -0
- package/examples/ionic/scripts/setup.sh +8 -0
- package/examples/ionic/src/assets/.gitkeep +0 -0
- package/examples/ionic/src/images/document.png +0 -0
- package/examples/ionic/src/images/icon.png +0 -0
- package/examples/ionic/src/images/portrait.png +0 -0
- package/examples/ionic/src/main.css +130 -0
- package/examples/ionic/src/main.html +63 -0
- package/examples/ionic/src/main.ts +66 -0
- package/examples/ionic/tsconfig.json +12 -0
- package/examples/react_native/README.md +12 -0
- package/examples/react_native/app.config.ts +53 -0
- package/examples/react_native/assets/.gitkeep +0 -0
- package/examples/react_native/images/document.png +0 -0
- package/examples/react_native/images/icon/adaptive-icon.png +0 -0
- package/examples/react_native/images/icon/icon.png +0 -0
- package/examples/react_native/images/portrait.png +0 -0
- package/examples/react_native/index.html +11 -0
- package/examples/react_native/index.tsx +52 -0
- package/examples/react_native/metro.config.js +7 -0
- package/examples/react_native/package-lock.json +9254 -0
- package/examples/react_native/package.json +27 -0
- package/examples/react_native/scripts/android.sh +12 -0
- package/examples/react_native/scripts/ios.sh +11 -0
- package/examples/react_native/scripts/setup.sh +8 -0
- package/examples/react_native/src/main.css +130 -0
- package/examples/react_native/src/main.html +63 -0
- package/examples/react_native/src/main.tsx +50 -0
- package/ios/CVDDocumentReader.h +7 -0
- package/ios/CVDDocumentReader.m +39 -0
- package/ios/RGLWConfig.h +42 -0
- package/ios/RGLWConfig.m +1398 -0
- package/ios/RGLWJSONConstructor.h +185 -0
- package/ios/RGLWJSONConstructor.m +2379 -0
- package/ios/RGLWMain.h +36 -0
- package/ios/RGLWMain.m +610 -0
- package/ios/RNDocumentReader.h +8 -0
- package/ios/RNDocumentReader.m +49 -0
- package/package.json +36 -0
- package/plugin.xml +51 -0
- package/www/capacitor/config/InitConfig.js +25 -0
- package/www/capacitor/config/OnlineProcessingConfig.js +41 -0
- package/www/capacitor/config/RFIDConfig.js +31 -0
- package/www/capacitor/config/RecognizeConfig.js +103 -0
- package/www/capacitor/config/ScannerConfig.js +38 -0
- package/www/capacitor/index.js +486 -0
- package/www/capacitor/info/DocReaderException.js +57 -0
- package/www/capacitor/info/DocReaderScenario.js +71 -0
- package/www/capacitor/info/DocReaderVersion.js +23 -0
- package/www/capacitor/info/DocumentsDatabase.js +27 -0
- package/www/capacitor/info/License.js +22 -0
- package/www/capacitor/info/PrepareProgress.js +23 -0
- package/www/capacitor/info/RFIDException.js +19 -0
- package/www/capacitor/internal/bridge.js +98 -0
- package/www/capacitor/internal/cordova.js +17 -0
- package/www/capacitor/params/Functionality.js +303 -0
- package/www/capacitor/params/customization/Customization.js +550 -0
- package/www/capacitor/params/customization/CustomizationColors.js +74 -0
- package/www/capacitor/params/customization/CustomizationFonts.js +40 -0
- package/www/capacitor/params/customization/CustomizationImages.js +25 -0
- package/www/capacitor/params/customization/Font.js +28 -0
- package/www/capacitor/params/process_params/AuthenticityParams.js +129 -0
- package/www/capacitor/params/process_params/BackendProcessingConfig.js +25 -0
- package/www/capacitor/params/process_params/FaceApiParams.js +38 -0
- package/www/capacitor/params/process_params/FaceApiSearchParams.js +21 -0
- package/www/capacitor/params/process_params/GlaresCheckParams.js +18 -0
- package/www/capacitor/params/process_params/ImageQA.js +97 -0
- package/www/capacitor/params/process_params/LivenessParams.js +67 -0
- package/www/capacitor/params/process_params/ProcessParams.js +570 -0
- package/www/capacitor/params/process_params/RfidParams.js +15 -0
- package/www/capacitor/params/rfid_scenario/DTCDataGroups.js +53 -0
- package/www/capacitor/params/rfid_scenario/EDLDataGroups.js +116 -0
- package/www/capacitor/params/rfid_scenario/EIDDataGroups.js +165 -0
- package/www/capacitor/params/rfid_scenario/EPassportDataGroups.js +130 -0
- package/www/capacitor/params/rfid_scenario/RFIDScenario.js +493 -0
- package/www/capacitor/results/DocumentType.js +285 -0
- package/www/capacitor/results/Position.js +60 -0
- package/www/capacitor/results/Results.js +318 -0
- package/www/capacitor/results/TransactionInfo.js +16 -0
- package/www/capacitor/results/authenticity/Authenticity.js +23 -0
- package/www/capacitor/results/authenticity/AuthenticityCheck.js +33 -0
- package/www/capacitor/results/authenticity/AuthenticityElement.js +27 -0
- package/www/capacitor/results/authenticity/AuthenticityResult.js +26 -0
- package/www/capacitor/results/authenticity/CheckDiagnose.js +124 -0
- package/www/capacitor/results/authenticity/SecurityFeatureType.js +59 -0
- package/www/capacitor/results/barcode/BarcodeField.js +24 -0
- package/www/capacitor/results/barcode/BarcodeResult.js +24 -0
- package/www/capacitor/results/barcode/BarcodeStatus.js +33 -0
- package/www/capacitor/results/barcode/BarcodeType.js +21 -0
- package/www/capacitor/results/barcode/PDF417Info.js +16 -0
- package/www/capacitor/results/image_quality/ImageQuality.js +31 -0
- package/www/capacitor/results/image_quality/ImageQualityCheckType.js +19 -0
- package/www/capacitor/results/image_quality/ImageQualityGroup.js +30 -0
- package/www/capacitor/results/rfid/AccessControlProcedureType.js +21 -0
- package/www/capacitor/results/rfid/Application.js +47 -0
- package/www/capacitor/results/rfid/Attribute.js +16 -0
- package/www/capacitor/results/rfid/Authority.js +28 -0
- package/www/capacitor/results/rfid/CardProperties.js +38 -0
- package/www/capacitor/results/rfid/CertificateChain.js +51 -0
- package/www/capacitor/results/rfid/CertificateData.js +14 -0
- package/www/capacitor/results/rfid/DataField.js +16 -0
- package/www/capacitor/results/rfid/Extension.js +14 -0
- package/www/capacitor/results/rfid/File.js +39 -0
- package/www/capacitor/results/rfid/FileData.js +18 -0
- package/www/capacitor/results/rfid/RFIDAccessControlProcedureType.js +10 -0
- package/www/capacitor/results/rfid/RFIDCertificateType.js +13 -0
- package/www/capacitor/results/rfid/RFIDDataFileType.js +98 -0
- package/www/capacitor/results/rfid/RFIDSessionData.js +76 -0
- package/www/capacitor/results/rfid/RFIDValidity.js +16 -0
- package/www/capacitor/results/rfid/RFIDValue.js +20 -0
- package/www/capacitor/results/rfid/SecurityObject.js +31 -0
- package/www/capacitor/results/rfid/SecurityObjectCertificates.js +14 -0
- package/www/capacitor/results/rfid/SignerInfo.js +57 -0
- package/www/capacitor/results/status/CheckResult.js +5 -0
- package/www/capacitor/results/status/OpticalStatus.js +30 -0
- package/www/capacitor/results/status/RFIDStatus.js +26 -0
- package/www/capacitor/results/status/ResultsStatus.js +28 -0
- package/www/capacitor/results/visible_digital_seals/BytesData.js +18 -0
- package/www/capacitor/results/visible_digital_seals/LDSParsingErrorCodes.js +134 -0
- package/www/capacitor/results/visible_digital_seals/LDSParsingNotificationCodes.js +232 -0
- package/www/capacitor/results/visible_digital_seals/VDSNCData.js +40 -0
- package/www/capacitor/results/visual_results/Comparison.js +19 -0
- package/www/capacitor/results/visual_results/FieldType.js +658 -0
- package/www/capacitor/results/visual_results/GraphicField.js +33 -0
- package/www/capacitor/results/visual_results/GraphicFieldType.js +25 -0
- package/www/capacitor/results/visual_results/GraphicResult.js +22 -0
- package/www/capacitor/results/visual_results/LCID.js +174 -0
- package/www/capacitor/results/visual_results/Lights.js +11 -0
- package/www/capacitor/results/visual_results/RFIDOrigin.js +18 -0
- package/www/capacitor/results/visual_results/Rect.js +18 -0
- package/www/capacitor/results/visual_results/Symbol.js +18 -0
- package/www/capacitor/results/visual_results/TextField.js +68 -0
- package/www/capacitor/results/visual_results/TextResult.js +42 -0
- package/www/capacitor/results/visual_results/TextSource.js +19 -0
- package/www/capacitor/results/visual_results/Validity.js +17 -0
- package/www/capacitor/results/visual_results/Value.js +39 -0
- package/www/capacitor/rfid/PAAttribute.js +17 -0
- package/www/capacitor/rfid/PAResourcesIssuer.js +27 -0
- package/www/capacitor/rfid/PKDCertificate.js +54 -0
- package/www/capacitor/rfid/RFIDErrorCodes.js +123 -0
- package/www/capacitor/rfid/RFIDNotification.js +60 -0
- package/www/capacitor/rfid/TAChallenge.js +23 -0
- package/www/capacitor/rfid/TccParams.js +24 -0
- package/www/cordova.js +9816 -0
- package/www/react-native/config/InitConfig.js +25 -0
- package/www/react-native/config/OnlineProcessingConfig.js +41 -0
- package/www/react-native/config/RFIDConfig.js +31 -0
- package/www/react-native/config/RecognizeConfig.js +103 -0
- package/www/react-native/config/ScannerConfig.js +38 -0
- package/www/react-native/index.js +486 -0
- package/www/react-native/info/DocReaderException.js +57 -0
- package/www/react-native/info/DocReaderScenario.js +71 -0
- package/www/react-native/info/DocReaderVersion.js +23 -0
- package/www/react-native/info/DocumentsDatabase.js +27 -0
- package/www/react-native/info/License.js +22 -0
- package/www/react-native/info/PrepareProgress.js +23 -0
- package/www/react-native/info/RFIDException.js +19 -0
- package/www/react-native/internal/bridge.js +98 -0
- package/www/react-native/params/Functionality.js +303 -0
- package/www/react-native/params/customization/Customization.js +550 -0
- package/www/react-native/params/customization/CustomizationColors.js +74 -0
- package/www/react-native/params/customization/CustomizationFonts.js +40 -0
- package/www/react-native/params/customization/CustomizationImages.js +25 -0
- package/www/react-native/params/customization/Font.js +28 -0
- package/www/react-native/params/process_params/AuthenticityParams.js +129 -0
- package/www/react-native/params/process_params/BackendProcessingConfig.js +25 -0
- package/www/react-native/params/process_params/FaceApiParams.js +38 -0
- package/www/react-native/params/process_params/FaceApiSearchParams.js +21 -0
- package/www/react-native/params/process_params/GlaresCheckParams.js +18 -0
- package/www/react-native/params/process_params/ImageQA.js +97 -0
- package/www/react-native/params/process_params/LivenessParams.js +67 -0
- package/www/react-native/params/process_params/ProcessParams.js +570 -0
- package/www/react-native/params/process_params/RfidParams.js +15 -0
- package/www/react-native/params/rfid_scenario/DTCDataGroups.js +53 -0
- package/www/react-native/params/rfid_scenario/EDLDataGroups.js +116 -0
- package/www/react-native/params/rfid_scenario/EIDDataGroups.js +165 -0
- package/www/react-native/params/rfid_scenario/EPassportDataGroups.js +130 -0
- package/www/react-native/params/rfid_scenario/RFIDScenario.js +493 -0
- package/www/react-native/results/DocumentType.js +285 -0
- package/www/react-native/results/Position.js +60 -0
- package/www/react-native/results/Results.js +318 -0
- package/www/react-native/results/TransactionInfo.js +16 -0
- package/www/react-native/results/authenticity/Authenticity.js +23 -0
- package/www/react-native/results/authenticity/AuthenticityCheck.js +33 -0
- package/www/react-native/results/authenticity/AuthenticityElement.js +27 -0
- package/www/react-native/results/authenticity/AuthenticityResult.js +26 -0
- package/www/react-native/results/authenticity/CheckDiagnose.js +124 -0
- package/www/react-native/results/authenticity/SecurityFeatureType.js +59 -0
- package/www/react-native/results/barcode/BarcodeField.js +24 -0
- package/www/react-native/results/barcode/BarcodeResult.js +24 -0
- package/www/react-native/results/barcode/BarcodeStatus.js +33 -0
- package/www/react-native/results/barcode/BarcodeType.js +21 -0
- package/www/react-native/results/barcode/PDF417Info.js +16 -0
- package/www/react-native/results/image_quality/ImageQuality.js +31 -0
- package/www/react-native/results/image_quality/ImageQualityCheckType.js +19 -0
- package/www/react-native/results/image_quality/ImageQualityGroup.js +30 -0
- package/www/react-native/results/rfid/AccessControlProcedureType.js +21 -0
- package/www/react-native/results/rfid/Application.js +47 -0
- package/www/react-native/results/rfid/Attribute.js +16 -0
- package/www/react-native/results/rfid/Authority.js +28 -0
- package/www/react-native/results/rfid/CardProperties.js +38 -0
- package/www/react-native/results/rfid/CertificateChain.js +51 -0
- package/www/react-native/results/rfid/CertificateData.js +14 -0
- package/www/react-native/results/rfid/DataField.js +16 -0
- package/www/react-native/results/rfid/Extension.js +14 -0
- package/www/react-native/results/rfid/File.js +39 -0
- package/www/react-native/results/rfid/FileData.js +18 -0
- package/www/react-native/results/rfid/RFIDAccessControlProcedureType.js +10 -0
- package/www/react-native/results/rfid/RFIDCertificateType.js +13 -0
- package/www/react-native/results/rfid/RFIDDataFileType.js +98 -0
- package/www/react-native/results/rfid/RFIDSessionData.js +76 -0
- package/www/react-native/results/rfid/RFIDValidity.js +16 -0
- package/www/react-native/results/rfid/RFIDValue.js +20 -0
- package/www/react-native/results/rfid/SecurityObject.js +31 -0
- package/www/react-native/results/rfid/SecurityObjectCertificates.js +14 -0
- package/www/react-native/results/rfid/SignerInfo.js +57 -0
- package/www/react-native/results/status/CheckResult.js +5 -0
- package/www/react-native/results/status/OpticalStatus.js +30 -0
- package/www/react-native/results/status/RFIDStatus.js +26 -0
- package/www/react-native/results/status/ResultsStatus.js +28 -0
- package/www/react-native/results/visible_digital_seals/BytesData.js +18 -0
- package/www/react-native/results/visible_digital_seals/LDSParsingErrorCodes.js +134 -0
- package/www/react-native/results/visible_digital_seals/LDSParsingNotificationCodes.js +232 -0
- package/www/react-native/results/visible_digital_seals/VDSNCData.js +40 -0
- package/www/react-native/results/visual_results/Comparison.js +19 -0
- package/www/react-native/results/visual_results/FieldType.js +658 -0
- package/www/react-native/results/visual_results/GraphicField.js +33 -0
- package/www/react-native/results/visual_results/GraphicFieldType.js +25 -0
- package/www/react-native/results/visual_results/GraphicResult.js +22 -0
- package/www/react-native/results/visual_results/LCID.js +174 -0
- package/www/react-native/results/visual_results/Lights.js +11 -0
- package/www/react-native/results/visual_results/RFIDOrigin.js +18 -0
- package/www/react-native/results/visual_results/Rect.js +18 -0
- package/www/react-native/results/visual_results/Symbol.js +18 -0
- package/www/react-native/results/visual_results/TextField.js +68 -0
- package/www/react-native/results/visual_results/TextResult.js +42 -0
- package/www/react-native/results/visual_results/TextSource.js +19 -0
- package/www/react-native/results/visual_results/Validity.js +17 -0
- package/www/react-native/results/visual_results/Value.js +39 -0
- package/www/react-native/rfid/PAAttribute.js +17 -0
- package/www/react-native/rfid/PAResourcesIssuer.js +27 -0
- package/www/react-native/rfid/PKDCertificate.js +54 -0
- package/www/react-native/rfid/RFIDErrorCodes.js +123 -0
- package/www/react-native/rfid/RFIDNotification.js +60 -0
- package/www/react-native/rfid/TAChallenge.js +23 -0
- package/www/react-native/rfid/TccParams.js +24 -0
- package/www/types/config/InitConfig.d.ts +63 -0
- package/www/types/config/OnlineProcessingConfig.d.ts +22 -0
- package/www/types/config/RFIDConfig.d.ts +131 -0
- package/www/types/config/RecognizeConfig.d.ts +119 -0
- package/www/types/config/ScannerConfig.d.ts +54 -0
- package/www/types/index.d.ts +421 -0
- package/www/types/info/DocReaderException.d.ts +79 -0
- package/www/types/info/DocReaderScenario.d.ts +90 -0
- package/www/types/info/DocReaderVersion.d.ts +28 -0
- package/www/types/info/DocumentsDatabase.d.ts +42 -0
- package/www/types/info/License.d.ts +23 -0
- package/www/types/info/PrepareProgress.d.ts +15 -0
- package/www/types/info/RFIDException.d.ts +8 -0
- package/www/types/params/Functionality.d.ts +316 -0
- package/www/types/params/customization/Customization.d.ts +558 -0
- package/www/types/params/customization/CustomizationColors.d.ts +16 -0
- package/www/types/params/customization/CustomizationFonts.d.ts +13 -0
- package/www/types/params/customization/CustomizationImages.d.ts +12 -0
- package/www/types/params/customization/Font.d.ts +36 -0
- package/www/types/params/process_params/AuthenticityParams.d.ts +30 -0
- package/www/types/params/process_params/BackendProcessingConfig.d.ts +25 -0
- package/www/types/params/process_params/FaceApiParams.d.ts +68 -0
- package/www/types/params/process_params/FaceApiSearchParams.d.ts +35 -0
- package/www/types/params/process_params/GlaresCheckParams.d.ts +26 -0
- package/www/types/params/process_params/ImageQA.d.ts +79 -0
- package/www/types/params/process_params/LivenessParams.d.ts +20 -0
- package/www/types/params/process_params/ProcessParams.d.ts +465 -0
- package/www/types/params/process_params/RfidParams.d.ts +19 -0
- package/www/types/params/rfid_scenario/DTCDataGroups.d.ts +13 -0
- package/www/types/params/rfid_scenario/EDLDataGroups.d.ts +22 -0
- package/www/types/params/rfid_scenario/EIDDataGroups.d.ts +29 -0
- package/www/types/params/rfid_scenario/EPassportDataGroups.d.ts +24 -0
- package/www/types/params/rfid_scenario/RFIDScenario.d.ts +167 -0
- package/www/types/results/DocumentType.d.ts +525 -0
- package/www/types/results/Position.d.ts +50 -0
- package/www/types/results/Results.d.ts +283 -0
- package/www/types/results/TransactionInfo.d.ts +9 -0
- package/www/types/results/authenticity/Authenticity.d.ts +67 -0
- package/www/types/results/authenticity/AuthenticityCheck.d.ts +23 -0
- package/www/types/results/authenticity/AuthenticityElement.d.ts +26 -0
- package/www/types/results/authenticity/AuthenticityResult.d.ts +16 -0
- package/www/types/results/authenticity/CheckDiagnose.d.ts +229 -0
- package/www/types/results/authenticity/SecurityFeatureType.d.ts +100 -0
- package/www/types/results/barcode/BarcodeField.d.ts +37 -0
- package/www/types/results/barcode/BarcodeResult.d.ts +14 -0
- package/www/types/results/barcode/BarcodeStatus.d.ts +66 -0
- package/www/types/results/barcode/BarcodeType.d.ts +45 -0
- package/www/types/results/barcode/PDF417Info.d.ts +15 -0
- package/www/types/results/image_quality/ImageQuality.d.ts +18 -0
- package/www/types/results/image_quality/ImageQualityCheckType.d.ts +30 -0
- package/www/types/results/image_quality/ImageQualityGroup.d.ts +17 -0
- package/www/types/results/rfid/AccessControlProcedureType.d.ts +21 -0
- package/www/types/results/rfid/Application.d.ts +44 -0
- package/www/types/results/rfid/Attribute.d.ts +9 -0
- package/www/types/results/rfid/Authority.d.ts +11 -0
- package/www/types/results/rfid/CardProperties.d.ts +48 -0
- package/www/types/results/rfid/CertificateChain.d.ts +28 -0
- package/www/types/results/rfid/CertificateData.d.ts +7 -0
- package/www/types/results/rfid/DataField.d.ts +9 -0
- package/www/types/results/rfid/Extension.d.ts +7 -0
- package/www/types/results/rfid/File.d.ts +22 -0
- package/www/types/results/rfid/FileData.d.ts +9 -0
- package/www/types/results/rfid/RFIDAccessControlProcedureType.d.ts +18 -0
- package/www/types/results/rfid/RFIDCertificateType.d.ts +13 -0
- package/www/types/results/rfid/RFIDDataFileType.d.ts +101 -0
- package/www/types/results/rfid/RFIDSessionData.d.ts +48 -0
- package/www/types/results/rfid/RFIDValidity.d.ts +9 -0
- package/www/types/results/rfid/RFIDValue.d.ts +10 -0
- package/www/types/results/rfid/SecurityObject.d.ts +28 -0
- package/www/types/results/rfid/SecurityObjectCertificates.d.ts +8 -0
- package/www/types/results/rfid/SignerInfo.d.ts +41 -0
- package/www/types/results/status/CheckResult.d.ts +8 -0
- package/www/types/results/status/OpticalStatus.d.ts +29 -0
- package/www/types/results/status/RFIDStatus.d.ts +22 -0
- package/www/types/results/status/ResultsStatus.d.ts +24 -0
- package/www/types/results/visible_digital_seals/BytesData.d.ts +9 -0
- package/www/types/results/visible_digital_seals/LDSParsingErrorCodes.d.ts +132 -0
- package/www/types/results/visible_digital_seals/LDSParsingNotificationCodes.d.ts +230 -0
- package/www/types/results/visible_digital_seals/VDSNCData.d.ts +35 -0
- package/www/types/results/visual_results/Comparison.d.ts +15 -0
- package/www/types/results/visual_results/FieldType.d.ts +1310 -0
- package/www/types/results/visual_results/GraphicField.d.ts +29 -0
- package/www/types/results/visual_results/GraphicFieldType.d.ts +52 -0
- package/www/types/results/visual_results/GraphicResult.d.ts +10 -0
- package/www/types/results/visual_results/LCID.d.ts +173 -0
- package/www/types/results/visual_results/Lights.d.ts +23 -0
- package/www/types/results/visual_results/RFIDOrigin.d.ts +10 -0
- package/www/types/results/visual_results/Rect.d.ts +9 -0
- package/www/types/results/visual_results/Symbol.d.ts +14 -0
- package/www/types/results/visual_results/TextField.d.ts +40 -0
- package/www/types/results/visual_results/TextResult.d.ts +23 -0
- package/www/types/results/visual_results/TextSource.d.ts +15 -0
- package/www/types/results/visual_results/Validity.d.ts +13 -0
- package/www/types/results/visual_results/Value.d.ts +27 -0
- package/www/types/rfid/PAAttribute.d.ts +4 -0
- package/www/types/rfid/PAResourcesIssuer.d.ts +7 -0
- package/www/types/rfid/PKDCertificate.d.ts +34 -0
- package/www/types/rfid/RFIDErrorCodes.d.ts +121 -0
- package/www/types/rfid/RFIDNotification.d.ts +153 -0
- package/www/types/rfid/TAChallenge.d.ts +7 -0
- package/www/types/rfid/TccParams.d.ts +25 -0
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
@file:SuppressLint("MissingPermission")
|
|
2
|
+
|
|
3
|
+
package com.regula.plugin.documentreader
|
|
4
|
+
|
|
5
|
+
import android.annotation.SuppressLint
|
|
6
|
+
import android.app.PendingIntent
|
|
7
|
+
import android.content.Intent
|
|
8
|
+
import android.content.IntentFilter
|
|
9
|
+
import android.nfc.NfcAdapter
|
|
10
|
+
import android.nfc.tech.IsoDep
|
|
11
|
+
import android.os.Build
|
|
12
|
+
import androidx.lifecycle.Lifecycle
|
|
13
|
+
import androidx.lifecycle.LifecycleEventObserver
|
|
14
|
+
import com.regula.common.LocalizationCallbacks
|
|
15
|
+
import com.regula.documentreader.api.DocumentReader.Instance
|
|
16
|
+
import com.regula.documentreader.api.completions.IDocumentReaderCompletion
|
|
17
|
+
import com.regula.documentreader.api.completions.IDocumentReaderInitCompletion
|
|
18
|
+
import com.regula.documentreader.api.completions.IDocumentReaderPrepareDbCompletion
|
|
19
|
+
import com.regula.documentreader.api.completions.model.PrepareProgress
|
|
20
|
+
import com.regula.documentreader.api.completions.rfid.IRfidPKDCertificateCompletion
|
|
21
|
+
import com.regula.documentreader.api.completions.rfid.IRfidReaderCompletion
|
|
22
|
+
import com.regula.documentreader.api.completions.rfid.IRfidReaderRequest
|
|
23
|
+
import com.regula.documentreader.api.completions.rfid.IRfidTASignatureCompletion
|
|
24
|
+
import com.regula.documentreader.api.completions.rfid.certificates.IRfidPACertificates
|
|
25
|
+
import com.regula.documentreader.api.completions.rfid.certificates.IRfidTACertificates
|
|
26
|
+
import com.regula.documentreader.api.completions.rfid.certificates.IRfidTASignature
|
|
27
|
+
import com.regula.documentreader.api.enums.DocReaderAction
|
|
28
|
+
import com.regula.documentreader.api.enums.LCID
|
|
29
|
+
import com.regula.documentreader.api.enums.eImageQualityCheckType
|
|
30
|
+
import com.regula.documentreader.api.enums.eLDS_ParsingErrorCodes
|
|
31
|
+
import com.regula.documentreader.api.enums.eLDS_ParsingNotificationCodes
|
|
32
|
+
import com.regula.documentreader.api.enums.eRFID_DataFile_Type
|
|
33
|
+
import com.regula.documentreader.api.enums.eRFID_ErrorCodes
|
|
34
|
+
import com.regula.documentreader.api.enums.eVisualFieldType
|
|
35
|
+
import com.regula.documentreader.api.errors.DocReaderRfidException
|
|
36
|
+
import com.regula.documentreader.api.errors.DocumentReaderException
|
|
37
|
+
import com.regula.documentreader.api.internal.core.CoreScenarioUtil
|
|
38
|
+
import com.regula.documentreader.api.results.DocumentReaderNotification
|
|
39
|
+
import com.regula.documentreader.api.results.DocumentReaderResults
|
|
40
|
+
import com.regula.documentreader.api.results.DocumentReaderResults.fromRawResults
|
|
41
|
+
import com.regula.documentreader.api.results.DocumentReaderScenario
|
|
42
|
+
import org.json.JSONArray
|
|
43
|
+
import org.json.JSONObject
|
|
44
|
+
import com.regula.plugin.documentreader.Convert.toBase64
|
|
45
|
+
import com.regula.plugin.documentreader.Convert.toByteArray
|
|
46
|
+
|
|
47
|
+
fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
|
|
48
|
+
"getDocumentReaderIsReady" -> getDocumentReaderIsReady(callback)
|
|
49
|
+
"getDocumentReaderStatus" -> getDocumentReaderStatus(callback)
|
|
50
|
+
"getRfidSessionStatus" -> getRfidSessionStatus(callback)
|
|
51
|
+
"setRfidSessionStatus" -> setRfidSessionStatus(argsNullable(0))
|
|
52
|
+
"getTag" -> getTag(callback)
|
|
53
|
+
"setTag" -> setTag(argsNullable(0))
|
|
54
|
+
"getTenant" -> getTenant(callback)
|
|
55
|
+
"setTenant" -> setTenant(argsNullable(0))
|
|
56
|
+
"getEnv" -> getEnv(callback)
|
|
57
|
+
"setEnv" -> setEnv(argsNullable(0))
|
|
58
|
+
"getFunctionality" -> getFunctionality(callback)
|
|
59
|
+
"setFunctionality" -> setFunctionality(args(0))
|
|
60
|
+
"getProcessParams" -> getProcessParams(callback)
|
|
61
|
+
"setProcessParams" -> setProcessParams(args(0))
|
|
62
|
+
"getCustomization" -> getCustomization(callback)
|
|
63
|
+
"setCustomization" -> setCustomization(args(0))
|
|
64
|
+
"getRfidScenario" -> getRfidScenario(callback)
|
|
65
|
+
"setRfidScenario" -> setRfidScenario(args(0))
|
|
66
|
+
"resetConfiguration" -> resetConfiguration()
|
|
67
|
+
"initialize" -> initialize(callback, args(0))
|
|
68
|
+
"initializeReader" -> initialize(callback, args(0)) // deprecated
|
|
69
|
+
"initializeReaderWithBleDeviceConfig" -> initializeReaderWithBleDeviceConfig(callback, args(0)) // deprecated
|
|
70
|
+
"deinitialize" -> deinitialize()
|
|
71
|
+
"prepareDatabase" -> prepareDatabase(callback, args(0))
|
|
72
|
+
"removeDatabase" -> removeDatabase(callback)
|
|
73
|
+
"runAutoUpdate" -> runAutoUpdate(callback, args(0))
|
|
74
|
+
"cancelDBUpdate" -> cancelDBUpdate(callback)
|
|
75
|
+
"checkDatabaseUpdate" -> checkDatabaseUpdate(callback, args(0))
|
|
76
|
+
"scan" -> scan(args(0))
|
|
77
|
+
"startScanner" -> startScanner(args(0))
|
|
78
|
+
"recognize" -> recognize(args(0))
|
|
79
|
+
"startNewPage" -> startNewPage()
|
|
80
|
+
"stopScanner" -> stopScanner()
|
|
81
|
+
"startRFIDReader" -> startRFIDReader(args(0), args(1), args(2))
|
|
82
|
+
"readRFID" -> readRFID(args(0), args(1), args(2))
|
|
83
|
+
"stopRFIDReader" -> stopRFIDReader()
|
|
84
|
+
"providePACertificates" -> providePACertificates(argsNullable(0))
|
|
85
|
+
"provideTACertificates" -> provideTACertificates(argsNullable(0))
|
|
86
|
+
"provideTASignature" -> provideTASignature(args(0))
|
|
87
|
+
"setTCCParams" -> setTCCParams(callback, args(0))
|
|
88
|
+
"addPKDCertificates" -> addPKDCertificates(args(0))
|
|
89
|
+
"clearPKDCertificates" -> clearPKDCertificates()
|
|
90
|
+
"startNewSession" -> startNewSession()
|
|
91
|
+
"connectBluetoothDevice" -> connectBluetoothDevice(callback)
|
|
92
|
+
"btDeviceRequestFlashing" -> btDeviceRequestFlashing()
|
|
93
|
+
"btDeviceRequestFlashingFullIR" -> btDeviceRequestFlashingFullIR()
|
|
94
|
+
"btDeviceRequestTurnOffAll" -> btDeviceRequestTurnOffAll()
|
|
95
|
+
"setLocalizationDictionary" -> setLocalizationDictionary(args(0))
|
|
96
|
+
"getLicense" -> getLicense(callback)
|
|
97
|
+
"getAvailableScenarios" -> getAvailableScenarios(callback)
|
|
98
|
+
"getIsRFIDAvailableForUse" -> getIsRFIDAvailableForUse(callback)
|
|
99
|
+
"isAuthenticatorAvailableForUse" -> isAuthenticatorAvailableForUse(callback)
|
|
100
|
+
"isAuthenticatorRFIDAvailableForUse" -> isAuthenticatorRFIDAvailableForUse(callback)
|
|
101
|
+
"getDocReaderVersion" -> getDocReaderVersion(callback)
|
|
102
|
+
"getDocReaderDocumentsDatabase" -> getDocReaderDocumentsDatabase(callback)
|
|
103
|
+
"textFieldValueByType" -> textFieldValueByType(callback, args(0), args(1))
|
|
104
|
+
"textFieldValueByTypeLcid" -> textFieldValueByTypeLcid(callback, args(0), args(1), args(2))
|
|
105
|
+
"textFieldValueByTypeSource" -> textFieldValueByTypeSource(callback, args(0), args(1), args(2))
|
|
106
|
+
"textFieldValueByTypeLcidSource" -> textFieldValueByTypeLcidSource(callback, args(0), args(1), args(2), args(3))
|
|
107
|
+
"textFieldValueByTypeSourceOriginal" -> textFieldValueByTypeSourceOriginal(callback, args(0), args(1), args(2), args(3))
|
|
108
|
+
"textFieldValueByTypeLcidSourceOriginal" -> textFieldValueByTypeLcidSourceOriginal(callback, args(0), args(1), args(2), args(3), args(4))
|
|
109
|
+
"textFieldByType" -> textFieldByType(callback, args(0), args(1))
|
|
110
|
+
"textFieldByTypeLcid" -> textFieldByTypeLcid(callback, args(0), args(1), args(2))
|
|
111
|
+
"graphicFieldByTypeSource" -> graphicFieldByTypeSource(callback, args(0), args(1), args(2))
|
|
112
|
+
"graphicFieldByTypeSourcePageIndex" -> graphicFieldByTypeSourcePageIndex(callback, args(0), args(1), args(2), args(3))
|
|
113
|
+
"graphicFieldByTypeSourcePageIndexLight" -> graphicFieldByTypeSourcePageIndexLight(callback, args(0), args(1), args(2), args(3), args(4))
|
|
114
|
+
"graphicFieldImageByType" -> graphicFieldImageByType(callback, args(0), args(1))
|
|
115
|
+
"graphicFieldImageByTypeSource" -> graphicFieldImageByTypeSource(callback, args(0), args(1), args(2))
|
|
116
|
+
"graphicFieldImageByTypeSourcePageIndex" -> graphicFieldImageByTypeSourcePageIndex(callback, args(0), args(1), args(2), args(3))
|
|
117
|
+
"graphicFieldImageByTypeSourcePageIndexLight" -> graphicFieldImageByTypeSourcePageIndexLight(callback, args(0), args(1), args(2), args(3), args(4))
|
|
118
|
+
"containers" -> containers(callback, args(0), args(1))
|
|
119
|
+
"encryptedContainers" -> encryptedContainers(callback, args(0))
|
|
120
|
+
"finalizePackage" -> finalizePackage(callback)
|
|
121
|
+
"endBackendTransaction" -> endBackendTransaction()
|
|
122
|
+
"getTranslation" -> getTranslation(callback, args(0), args(1))
|
|
123
|
+
else -> Unit
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
inline fun <reified T> args(index: Int) = argsNullable<T>(index)!!
|
|
127
|
+
typealias Callback = (Any?) -> Unit
|
|
128
|
+
|
|
129
|
+
const val completionEvent = "completion"
|
|
130
|
+
const val databaseProgressEvent = "database_progress"
|
|
131
|
+
|
|
132
|
+
const val rfidOnProgressEvent = "rfidOnProgressCompletion"
|
|
133
|
+
const val rfidOnChipDetectedEvent = "rfidOnChipDetectedEvent"
|
|
134
|
+
const val rfidOnRetryReadChipEvent = "rfidOnRetryReadChipEvent"
|
|
135
|
+
|
|
136
|
+
const val paCertificateCompletionEvent = "pa_certificate_completion"
|
|
137
|
+
const val taCertificateCompletionEvent = "ta_certificate_completion"
|
|
138
|
+
const val taSignatureCompletionEvent = "ta_signature_completion"
|
|
139
|
+
|
|
140
|
+
const val videoEncoderCompletionEvent = "video_encoder_completion"
|
|
141
|
+
const val onCustomButtonTappedEvent = "onCustomButtonTappedEvent"
|
|
142
|
+
|
|
143
|
+
fun getDocumentReaderIsReady(callback: Callback) = callback(Instance().isReady)
|
|
144
|
+
|
|
145
|
+
fun getDocumentReaderStatus(callback: Callback) = callback(Instance().status)
|
|
146
|
+
|
|
147
|
+
fun getRfidSessionStatus(iosOnly: Callback) = iosOnly(null)
|
|
148
|
+
|
|
149
|
+
fun setRfidSessionStatus(iosOnly: String?) = Unit
|
|
150
|
+
|
|
151
|
+
fun getTag(callback: Callback) = callback(Instance().tag)
|
|
152
|
+
|
|
153
|
+
fun setTag(tag: String?) = tag.let { Instance().tag = it }
|
|
154
|
+
|
|
155
|
+
fun getTenant(callback: Callback) = callback(Instance().tenant)
|
|
156
|
+
|
|
157
|
+
fun setTenant(tag: String?) = tag.let { Instance().tenant = it }
|
|
158
|
+
|
|
159
|
+
fun getEnv(callback: Callback) = callback(Instance().env)
|
|
160
|
+
|
|
161
|
+
fun setEnv(tag: String?) = tag.let { Instance().env = it }
|
|
162
|
+
|
|
163
|
+
fun getFunctionality(callback: Callback) = callback(getFunctionality(Instance().functionality()))
|
|
164
|
+
|
|
165
|
+
fun setFunctionality(functionality: JSONObject) = setFunctionality(Instance().functionality(), functionality)
|
|
166
|
+
|
|
167
|
+
fun getProcessParams(callback: Callback) = callback(getProcessParams(Instance().processParams()))
|
|
168
|
+
|
|
169
|
+
fun setProcessParams(processParams: JSONObject) = setProcessParams(Instance().processParams(), processParams)
|
|
170
|
+
|
|
171
|
+
fun getCustomization(callback: Callback) = callback(getCustomization(Instance().customization()))
|
|
172
|
+
|
|
173
|
+
fun setCustomization(customization: JSONObject) = setCustomization(Instance().customization(), customization)
|
|
174
|
+
|
|
175
|
+
fun getRfidScenario(callback: Callback) = callback(getRfidScenario(Instance().rfidScenario()))
|
|
176
|
+
|
|
177
|
+
fun setRfidScenario(rfidScenario: JSONObject) = setRfidScenario(Instance().rfidScenario(), rfidScenario)
|
|
178
|
+
|
|
179
|
+
fun resetConfiguration() = Instance().resetConfiguration()
|
|
180
|
+
|
|
181
|
+
fun initialize(callback: Callback, config: JSONObject) =
|
|
182
|
+
if (config.getBooleanOrNull("useBleDevice") != true)
|
|
183
|
+
Instance().initializeReader(context, initConfigFromJSON(config), initCompletion(callback))
|
|
184
|
+
else
|
|
185
|
+
Instance().initializeReader(context, initBleDeviceConfigFromJSON(config), initCompletion(callback))
|
|
186
|
+
|
|
187
|
+
// deprecated
|
|
188
|
+
fun initializeReaderWithBleDeviceConfig(callback: Callback, config: JSONObject) = Instance().initializeReader(context, initBleDeviceConfigFromJSON(config), initCompletion(callback))
|
|
189
|
+
|
|
190
|
+
fun deinitialize() = Instance().deinitializeReader()
|
|
191
|
+
|
|
192
|
+
fun prepareDatabase(callback: Callback, databaseID: String) = Instance().prepareDatabase(
|
|
193
|
+
context,
|
|
194
|
+
databaseID,
|
|
195
|
+
prepareCompletion(callback)
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
fun removeDatabase(callback: Callback) = callback(Instance().removeDatabase(context))
|
|
199
|
+
|
|
200
|
+
fun runAutoUpdate(callback: Callback, databaseID: String) = Instance().runAutoUpdate(
|
|
201
|
+
context,
|
|
202
|
+
databaseID,
|
|
203
|
+
prepareCompletion(callback)
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
fun cancelDBUpdate(callback: Callback) = callback(Instance().cancelDBUpdate(context))
|
|
207
|
+
|
|
208
|
+
fun checkDatabaseUpdate(callback: Callback, databaseID: String) = Instance().checkDatabaseUpdate(
|
|
209
|
+
context,
|
|
210
|
+
databaseID
|
|
211
|
+
) { callback(generateDocReaderDocumentsDatabase(it)) }
|
|
212
|
+
|
|
213
|
+
@Suppress("DEPRECATION")
|
|
214
|
+
fun scan(config: JSONObject) {
|
|
215
|
+
stopBackgroundRFID()
|
|
216
|
+
Instance().showScanner(context, scannerConfigFromJSON(config), IDocumentReaderCompletion(completion))
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
fun startScanner(config: JSONObject) {
|
|
220
|
+
stopBackgroundRFID()
|
|
221
|
+
Instance().startScanner(context, scannerConfigFromJSON(config), IDocumentReaderCompletion(completion))
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
fun recognize(config: JSONObject) {
|
|
225
|
+
stopBackgroundRFID()
|
|
226
|
+
Instance().recognize(recognizeConfigFromJSON(config), IDocumentReaderCompletion(completion))
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
fun startNewPage() = Instance().startNewPage()
|
|
230
|
+
|
|
231
|
+
fun stopScanner() = Instance().stopScanner(context)
|
|
232
|
+
|
|
233
|
+
fun startRFIDReader(onRequestPACertificates: Boolean, onRequestTACertificates: Boolean, onRequestTASignature: Boolean) {
|
|
234
|
+
stopBackgroundRFID()
|
|
235
|
+
requestType = RfidReaderRequestType(
|
|
236
|
+
onRequestPACertificates,
|
|
237
|
+
onRequestTACertificates,
|
|
238
|
+
onRequestTASignature
|
|
239
|
+
)
|
|
240
|
+
Instance().startRFIDReader(context, rfidReaderCompletion, requestType.getRfidReaderRequest())
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
fun readRFID(onRequestPACertificates: Boolean, onRequestTACertificates: Boolean, onRequestTASignature: Boolean) {
|
|
244
|
+
requestType = RfidReaderRequestType(
|
|
245
|
+
onRequestPACertificates,
|
|
246
|
+
onRequestTACertificates,
|
|
247
|
+
onRequestTASignature
|
|
248
|
+
)
|
|
249
|
+
startForegroundDispatch()
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
fun stopRFIDReader() {
|
|
253
|
+
Instance().stopRFIDReader(context)
|
|
254
|
+
stopBackgroundRFID()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
fun providePACertificates(certificates: JSONArray?) = paCertificateCompletion.onCertificatesReceived(
|
|
258
|
+
certificates.toArray(::pkdCertificateFromJSON)
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
fun provideTACertificates(certificates: JSONArray?) = taCertificateCompletion.onCertificatesReceived(
|
|
262
|
+
certificates.toArray(::pkdCertificateFromJSON)
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
fun provideTASignature(signature: String?) = taSignatureCompletion.onSignatureReceived(
|
|
266
|
+
signature.toByteArray()
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
fun setTCCParams(callback: Callback, params: JSONObject) {
|
|
270
|
+
Instance().setTccParams(tccParamsFromJSON(params)) { success, error ->
|
|
271
|
+
callback(generateSuccessCompletion(success, error))
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
fun addPKDCertificates(certificates: JSONArray) = Instance().addPKDCertificates(
|
|
276
|
+
certificates.toList(::pkdCertificateFromJSON)!!
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
fun clearPKDCertificates() = Instance().clearPKDCertificates()
|
|
280
|
+
|
|
281
|
+
fun startNewSession() = Instance().startNewSession()
|
|
282
|
+
|
|
283
|
+
fun setLocalizationDictionary(dictionary: JSONObject) {
|
|
284
|
+
localizationCallbacks = LocalizationCallbacks { if (dictionary.has(it)) dictionary.getString(it) else null }
|
|
285
|
+
Instance().setLocalizationCallback(localizationCallbacks)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
fun getLicense(callback: Callback) = callback(generateLicense(Instance().license()))
|
|
289
|
+
|
|
290
|
+
fun getAvailableScenarios(callback: Callback) {
|
|
291
|
+
val scenarios: MutableList<DocumentReaderScenario> = ArrayList()
|
|
292
|
+
for (scenario: DocumentReaderScenario in Instance().availableScenarios)
|
|
293
|
+
scenarios.add(CoreScenarioUtil.getScenario(scenario.name))
|
|
294
|
+
callback(scenarios.toJsonNullable(::generateDocumentReaderScenario))
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
fun getIsRFIDAvailableForUse(callback: Callback) = callback(Instance().isRFIDAvailableForUse)
|
|
298
|
+
|
|
299
|
+
fun isAuthenticatorAvailableForUse(callback: Callback) = callback(Instance().isAuthenticatorAvailableForUse)
|
|
300
|
+
|
|
301
|
+
fun isAuthenticatorRFIDAvailableForUse(callback: Callback) = callback(Instance().isAuthenticatorRFIDAvailableForUse)
|
|
302
|
+
|
|
303
|
+
fun getDocReaderVersion(callback: Callback) = callback(generateDocReaderVersion(Instance().version))
|
|
304
|
+
|
|
305
|
+
fun getDocReaderDocumentsDatabase(callback: Callback) = callback(Instance().version?.let {
|
|
306
|
+
generateDocReaderDocumentsDatabase(it.database)
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
fun finalizePackage(callback: Callback) = Instance().finalizePackage { action, info, error ->
|
|
310
|
+
callback(generateFinalizePackageCompletion(action, info, error))
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
fun endBackendTransaction() = Instance().endBackendTransaction()
|
|
314
|
+
|
|
315
|
+
fun textFieldValueByType(
|
|
316
|
+
callback: Callback,
|
|
317
|
+
raw: String,
|
|
318
|
+
fieldType: Int
|
|
319
|
+
) = callback(fromRawResults(raw).getTextFieldValueByType(fieldType))
|
|
320
|
+
|
|
321
|
+
fun textFieldValueByTypeLcid(
|
|
322
|
+
callback: Callback,
|
|
323
|
+
raw: String,
|
|
324
|
+
fieldType: Int,
|
|
325
|
+
lcid: Int
|
|
326
|
+
) = callback(fromRawResults(raw).getTextFieldValueByType(fieldType, lcid))
|
|
327
|
+
|
|
328
|
+
fun textFieldValueByTypeSource(
|
|
329
|
+
callback: Callback,
|
|
330
|
+
raw: String,
|
|
331
|
+
fieldType: Int,
|
|
332
|
+
source: Int
|
|
333
|
+
) = callback(fromRawResults(raw).getTextFieldValueByTypeAndSource(fieldType, source))
|
|
334
|
+
|
|
335
|
+
fun textFieldValueByTypeLcidSource(
|
|
336
|
+
callback: Callback,
|
|
337
|
+
raw: String,
|
|
338
|
+
fieldType: Int,
|
|
339
|
+
lcid: Int,
|
|
340
|
+
source: Int
|
|
341
|
+
) = callback(fromRawResults(raw).getTextFieldValueByType(fieldType, lcid, source))
|
|
342
|
+
|
|
343
|
+
fun textFieldValueByTypeSourceOriginal(
|
|
344
|
+
callback: Callback,
|
|
345
|
+
raw: String,
|
|
346
|
+
fieldType: Int,
|
|
347
|
+
source: Int,
|
|
348
|
+
original: Boolean
|
|
349
|
+
) = callback(fromRawResults(raw).getTextFieldValueByTypeAndSource(fieldType, source, original))
|
|
350
|
+
|
|
351
|
+
fun textFieldValueByTypeLcidSourceOriginal(
|
|
352
|
+
callback: Callback,
|
|
353
|
+
raw: String,
|
|
354
|
+
fieldType: Int,
|
|
355
|
+
lcid: Int,
|
|
356
|
+
source: Int,
|
|
357
|
+
original: Boolean
|
|
358
|
+
) = callback(fromRawResults(raw).getTextFieldValueByType(fieldType, lcid, source, original))
|
|
359
|
+
|
|
360
|
+
fun textFieldByType(
|
|
361
|
+
callback: Callback,
|
|
362
|
+
raw: String,
|
|
363
|
+
fieldType: Int
|
|
364
|
+
) = callback(generateDocumentReaderTextField(fromRawResults(raw).getTextFieldByType(fieldType)))
|
|
365
|
+
|
|
366
|
+
fun textFieldByTypeLcid(
|
|
367
|
+
callback: Callback,
|
|
368
|
+
raw: String,
|
|
369
|
+
fieldType: Int,
|
|
370
|
+
lcid: Int
|
|
371
|
+
) = callback(generateDocumentReaderTextField(fromRawResults(raw).getTextFieldByType(fieldType, lcid)))
|
|
372
|
+
|
|
373
|
+
fun graphicFieldByTypeSource(
|
|
374
|
+
callback: Callback,
|
|
375
|
+
raw: String,
|
|
376
|
+
fieldType: Int,
|
|
377
|
+
source: Int
|
|
378
|
+
) = callback(generateDocumentReaderGraphicField(fromRawResults(raw).getGraphicFieldByType(fieldType, source)))
|
|
379
|
+
|
|
380
|
+
fun graphicFieldByTypeSourcePageIndex(
|
|
381
|
+
callback: Callback,
|
|
382
|
+
raw: String,
|
|
383
|
+
fieldType: Int,
|
|
384
|
+
source: Int,
|
|
385
|
+
pageIndex: Int
|
|
386
|
+
) = callback(generateDocumentReaderGraphicField(fromRawResults(raw).getGraphicFieldByType(fieldType, source, pageIndex)))
|
|
387
|
+
|
|
388
|
+
fun graphicFieldByTypeSourcePageIndexLight(
|
|
389
|
+
callback: Callback,
|
|
390
|
+
raw: String,
|
|
391
|
+
fieldType: Int,
|
|
392
|
+
source: Int,
|
|
393
|
+
pageIndex: Int,
|
|
394
|
+
light: Int
|
|
395
|
+
) = callback(generateDocumentReaderGraphicField(fromRawResults(raw).getGraphicFieldByType(fieldType, source, pageIndex, light)))
|
|
396
|
+
|
|
397
|
+
fun graphicFieldImageByType(
|
|
398
|
+
callback: Callback,
|
|
399
|
+
raw: String,
|
|
400
|
+
fieldType: Int
|
|
401
|
+
) = callback(fromRawResults(raw).getGraphicFieldImageByType(fieldType).toBase64())
|
|
402
|
+
|
|
403
|
+
fun graphicFieldImageByTypeSource(
|
|
404
|
+
callback: Callback,
|
|
405
|
+
raw: String,
|
|
406
|
+
fieldType: Int,
|
|
407
|
+
source: Int
|
|
408
|
+
) = callback(fromRawResults(raw).getGraphicFieldImageByType(fieldType, source).toBase64())
|
|
409
|
+
|
|
410
|
+
fun graphicFieldImageByTypeSourcePageIndex(
|
|
411
|
+
callback: Callback,
|
|
412
|
+
raw: String,
|
|
413
|
+
fieldType: Int,
|
|
414
|
+
source: Int,
|
|
415
|
+
pageIndex: Int
|
|
416
|
+
) = callback(fromRawResults(raw).getGraphicFieldImageByType(fieldType, source, pageIndex).toBase64())
|
|
417
|
+
|
|
418
|
+
fun graphicFieldImageByTypeSourcePageIndexLight(
|
|
419
|
+
callback: Callback,
|
|
420
|
+
raw: String,
|
|
421
|
+
fieldType: Int,
|
|
422
|
+
source: Int,
|
|
423
|
+
pageIndex: Int,
|
|
424
|
+
light: Int
|
|
425
|
+
) = callback(fromRawResults(raw).getGraphicFieldImageByType(fieldType, source, pageIndex, light).toBase64())
|
|
426
|
+
|
|
427
|
+
fun containers(
|
|
428
|
+
callback: Callback,
|
|
429
|
+
raw: String,
|
|
430
|
+
resultType: JSONArray
|
|
431
|
+
) = callback(fromRawResults(raw).getContainers(resultType.toIntArray()!!))
|
|
432
|
+
|
|
433
|
+
fun encryptedContainers(
|
|
434
|
+
callback: Callback,
|
|
435
|
+
raw: String
|
|
436
|
+
) = callback(fromRawResults(raw).encryptedContainers)
|
|
437
|
+
|
|
438
|
+
fun getTranslation(callback: Callback, className: String, value: Int) = when (className) {
|
|
439
|
+
"RFIDErrorCodes" -> callback(eRFID_ErrorCodes.getTranslation(context, value))
|
|
440
|
+
"LDSParsingErrorCodes" -> callback(eLDS_ParsingErrorCodes.getTranslation(context, value))
|
|
441
|
+
"LDSParsingNotificationCodes" -> callback(eLDS_ParsingNotificationCodes.getTranslation(context, value))
|
|
442
|
+
"ImageQualityCheckType" -> callback(eImageQualityCheckType.getTranslation(context, value))
|
|
443
|
+
"RFIDDataFileType" -> callback(eRFID_DataFile_Type.getTranslation(context, value))
|
|
444
|
+
"VisualFieldType" -> callback(eVisualFieldType.getTranslation(context, value))
|
|
445
|
+
"LCID" -> callback(LCID.getTranslation(context, value))
|
|
446
|
+
else -> Unit
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// --------------------------------------------------------------------------------------------------------------------------
|
|
450
|
+
|
|
451
|
+
val completion = { action: Int, results: DocumentReaderResults?, error: DocumentReaderException? ->
|
|
452
|
+
sendEvent(completionEvent, generateCompletion(action, results, error))
|
|
453
|
+
if ((action == DocReaderAction.ERROR) ||
|
|
454
|
+
(action == DocReaderAction.CANCEL) ||
|
|
455
|
+
((action == DocReaderAction.COMPLETE) && (results?.rfidResult == 1))
|
|
456
|
+
) stopBackgroundRFID()
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
val rfidReaderCompletion = object : IRfidReaderCompletion() {
|
|
460
|
+
override fun onCompleted(action: Int, results: DocumentReaderResults?, error: DocumentReaderException?): Unit = completion(action, results, error)
|
|
461
|
+
override fun onChipDetected(): Unit = sendEvent(rfidOnChipDetectedEvent)
|
|
462
|
+
override fun onRetryReadChip(error: DocReaderRfidException) = sendEvent(rfidOnRetryReadChipEvent, generateRegulaException(error))
|
|
463
|
+
override fun onProgress(notification: DocumentReaderNotification) = sendEvent(rfidOnProgressEvent, generateDocumentReaderNotification(notification))
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
fun prepareCompletion(callback: Callback) = object : IDocumentReaderPrepareDbCompletion() {
|
|
467
|
+
override fun onPrepareProgressChanged(progress: PrepareProgress) = sendEvent(databaseProgressEvent, generatePrepareProgress(progress))
|
|
468
|
+
override fun onPrepareCompleted(success: Boolean, error: DocumentReaderException?) = callback(generateSuccessCompletion(success, error))
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
fun initCompletion(callback: Callback) = IDocumentReaderInitCompletion { success, error ->
|
|
472
|
+
if (success) {
|
|
473
|
+
Instance().setVideoEncoderCompletion { _, file -> sendEvent(videoEncoderCompletionEvent, file.path) }
|
|
474
|
+
Instance().setOnClickListener { sendEvent(onCustomButtonTappedEvent, it.tag) }
|
|
475
|
+
}
|
|
476
|
+
callback(generateSuccessCompletion(success, error))
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
lateinit var paCertificateCompletion: IRfidPKDCertificateCompletion
|
|
480
|
+
lateinit var taCertificateCompletion: IRfidPKDCertificateCompletion
|
|
481
|
+
lateinit var taSignatureCompletion: IRfidTASignatureCompletion
|
|
482
|
+
|
|
483
|
+
class RfidReaderRequestType(
|
|
484
|
+
val doPACertificates: Boolean,
|
|
485
|
+
val doTACertificates: Boolean,
|
|
486
|
+
val doTASignature: Boolean
|
|
487
|
+
) {
|
|
488
|
+
private val onRequestPACertificates = IRfidPACertificates { serialNumber, issuer, completion ->
|
|
489
|
+
paCertificateCompletion = completion
|
|
490
|
+
sendEvent(paCertificateCompletionEvent, generatePACertificateCompletion(serialNumber, issuer))
|
|
491
|
+
}
|
|
492
|
+
private val onRequestTACertificates = IRfidTACertificates { keyCAR, completion ->
|
|
493
|
+
taCertificateCompletion = completion
|
|
494
|
+
sendEvent(taCertificateCompletionEvent, keyCAR)
|
|
495
|
+
}
|
|
496
|
+
private val onRequestTASignature = IRfidTASignature { challenge, completion ->
|
|
497
|
+
taSignatureCompletion = completion
|
|
498
|
+
sendEvent(taSignatureCompletionEvent, generateTAChallenge(challenge))
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
fun getRfidReaderRequest(): IRfidReaderRequest? = when {
|
|
502
|
+
!doPACertificates && !doTACertificates && doTASignature -> IRfidReaderRequest(onRequestTASignature)
|
|
503
|
+
!doPACertificates && doTACertificates && !doTASignature -> IRfidReaderRequest(onRequestTACertificates)
|
|
504
|
+
!doPACertificates && doTACertificates && doTASignature -> IRfidReaderRequest(onRequestTACertificates, onRequestTASignature)
|
|
505
|
+
doPACertificates && !doTACertificates && !doTASignature -> IRfidReaderRequest(onRequestPACertificates)
|
|
506
|
+
doPACertificates && !doTACertificates && doTASignature -> IRfidReaderRequest(onRequestPACertificates, onRequestTASignature)
|
|
507
|
+
doPACertificates && doTACertificates && !doTASignature -> IRfidReaderRequest(onRequestPACertificates, onRequestTACertificates)
|
|
508
|
+
doPACertificates && doTACertificates && doTASignature -> IRfidReaderRequest(onRequestPACertificates, onRequestTACertificates, onRequestTASignature)
|
|
509
|
+
else -> null
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
var requestType = RfidReaderRequestType(
|
|
514
|
+
doPACertificates = false,
|
|
515
|
+
doTACertificates = false,
|
|
516
|
+
doTASignature = false
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
@Suppress("DEPRECATION", "MissingPermission")
|
|
520
|
+
fun newIntent(intent: Intent): Boolean {
|
|
521
|
+
if (intent.action != NfcAdapter.ACTION_TECH_DISCOVERED) return false
|
|
522
|
+
Instance().readRFID(
|
|
523
|
+
IsoDep.get(intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)),
|
|
524
|
+
rfidReaderCompletion,
|
|
525
|
+
requestType.getRfidReaderRequest()
|
|
526
|
+
)
|
|
527
|
+
return true
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
var backgroundRFIDEnabled = false
|
|
531
|
+
lateinit var lifecycleObserver: LifecycleEventObserver
|
|
532
|
+
|
|
533
|
+
fun startForegroundDispatch() {
|
|
534
|
+
backgroundRFIDEnabled = true
|
|
535
|
+
val filters: Array<IntentFilter?> = arrayOfNulls(1)
|
|
536
|
+
filters[0] = IntentFilter()
|
|
537
|
+
filters[0]!!.addAction(NfcAdapter.ACTION_TECH_DISCOVERED)
|
|
538
|
+
filters[0]!!.addCategory(Intent.CATEGORY_DEFAULT)
|
|
539
|
+
val techList = arrayOf(arrayOf("android.nfc.tech.IsoDep"))
|
|
540
|
+
val intent = Intent(activity, activity.javaClass)
|
|
541
|
+
val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
|
|
542
|
+
val pendingIntent = PendingIntent.getActivity(activity, 0, intent, flag)
|
|
543
|
+
|
|
544
|
+
if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
|
|
545
|
+
enableForegroundDispatch(pendingIntent, filters, techList)
|
|
546
|
+
lifecycleObserver = LifecycleEventObserver { _, event ->
|
|
547
|
+
if (backgroundRFIDEnabled) when (event) {
|
|
548
|
+
Lifecycle.Event.ON_RESUME -> enableForegroundDispatch(pendingIntent, filters, techList)
|
|
549
|
+
Lifecycle.Event.ON_PAUSE -> disableForegroundDispatch()
|
|
550
|
+
else -> Unit
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
activity.runOnUiThread { lifecycle.addObserver(lifecycleObserver) }
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
fun enableForegroundDispatch(
|
|
557
|
+
pendingIntent: PendingIntent,
|
|
558
|
+
filters: Array<IntentFilter?>,
|
|
559
|
+
techList: Array<Array<String>>
|
|
560
|
+
) = NfcAdapter.getDefaultAdapter(context).enableForegroundDispatch(activity, pendingIntent, filters, techList)
|
|
561
|
+
|
|
562
|
+
fun disableForegroundDispatch() = NfcAdapter.getDefaultAdapter(activity).disableForegroundDispatch(activity)
|
|
563
|
+
|
|
564
|
+
fun stopBackgroundRFID() {
|
|
565
|
+
if (!backgroundRFIDEnabled) return
|
|
566
|
+
backgroundRFIDEnabled = false
|
|
567
|
+
if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
|
|
568
|
+
disableForegroundDispatch()
|
|
569
|
+
activity.runOnUiThread { lifecycle.removeObserver(lifecycleObserver) }
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// Weak references
|
|
573
|
+
lateinit var localizationCallbacks: LocalizationCallbacks
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@file:Suppress("unused", "UNUSED_PARAMETER")
|
|
2
|
+
|
|
3
|
+
package com.regula.plugin.documentreader
|
|
4
|
+
|
|
5
|
+
import android.app.Activity
|
|
6
|
+
import android.content.Context
|
|
7
|
+
import android.content.Intent
|
|
8
|
+
import android.util.Log
|
|
9
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
10
|
+
import androidx.lifecycle.Lifecycle
|
|
11
|
+
import com.facebook.react.ReactPackage
|
|
12
|
+
import com.facebook.react.bridge.ActivityEventListener
|
|
13
|
+
import com.facebook.react.bridge.Promise
|
|
14
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
15
|
+
import com.facebook.react.bridge.ReactContext
|
|
16
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
17
|
+
import com.facebook.react.bridge.ReactMethod
|
|
18
|
+
import com.facebook.react.bridge.ReadableArray
|
|
19
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
20
|
+
import com.facebook.react.modules.core.PermissionAwareActivity
|
|
21
|
+
import com.facebook.react.uimanager.ViewManager
|
|
22
|
+
import org.json.JSONArray
|
|
23
|
+
import org.json.JSONObject
|
|
24
|
+
|
|
25
|
+
var listenerCount = 0
|
|
26
|
+
|
|
27
|
+
lateinit var args: JSONArray
|
|
28
|
+
lateinit var binding: ReactContext
|
|
29
|
+
val context: Context
|
|
30
|
+
get() = binding.applicationContext
|
|
31
|
+
val activity: Activity
|
|
32
|
+
get() = binding.currentActivity!!
|
|
33
|
+
val lifecycle: Lifecycle
|
|
34
|
+
get() = (activity as AppCompatActivity).lifecycle
|
|
35
|
+
|
|
36
|
+
fun sendEvent(event: String, data: Any? = "") {
|
|
37
|
+
if (listenerCount <= 0) return
|
|
38
|
+
val result = if (data is JSONObject || data is JSONArray) data.toString() else data.toString() + ""
|
|
39
|
+
binding.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit(event, result)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@Suppress("UNCHECKED_CAST")
|
|
43
|
+
fun <T> argsNullable(index: Int): T? {
|
|
44
|
+
val value = args[index]
|
|
45
|
+
if (value is Double && value % 1 == 0.0) return value.toInt() as T
|
|
46
|
+
if (value.toString() == "null") return null
|
|
47
|
+
return value as T
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fun requestPermissions(activity: Activity, permissions: Array<String>, requestCode: Int) {
|
|
51
|
+
(activity as PermissionAwareActivity).requestPermissions(permissions, requestCode) { code, perms, grantResults ->
|
|
52
|
+
onRequestPermissionsResult(code, perms, grantResults)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fun startActivityForResult(activity: Activity, intent: Intent, requestCode: Int) {
|
|
57
|
+
activity.startActivityForResult(intent, requestCode)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
class RNDocumentReaderPackage : ReactPackage {
|
|
61
|
+
override fun createNativeModules(reactContext: ReactApplicationContext) = listOf(RNDocumentReaderModule(reactContext))
|
|
62
|
+
override fun createViewManagers(reactContext: ReactApplicationContext) = emptyList<ViewManager<*, *>>()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class RNDocumentReaderModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), ActivityEventListener {
|
|
66
|
+
init {
|
|
67
|
+
binding = reactContext
|
|
68
|
+
binding.addActivityEventListener(this)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@ReactMethod
|
|
72
|
+
fun addListener(eventName: String) {
|
|
73
|
+
listenerCount += 1
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@ReactMethod
|
|
77
|
+
fun removeListeners(count: Int) {
|
|
78
|
+
listenerCount -= count
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
override fun onNewIntent(intent: Intent) {
|
|
82
|
+
newIntent(intent)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
|
|
86
|
+
onActivityResult(requestCode, resultCode, data)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@ReactMethod
|
|
90
|
+
fun exec(method: String, arguments: ReadableArray, promise: Promise) {
|
|
91
|
+
args = JSONArray(arguments.toArrayList())
|
|
92
|
+
try {
|
|
93
|
+
methodCall(method) { data -> promise.resolve(data.toSendable()) }
|
|
94
|
+
} catch (error: Exception) {
|
|
95
|
+
Log.e("REGULA", "Caught exception in \"$method\" function:", error)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
override fun getName() = "RNDocumentReader"
|
|
100
|
+
}
|