2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | @autoreleasepool {
8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4 | networkTimeout=10000
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader/DocumentReader.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.developer.nfc.readersession.formats
6 |
7 | TAG
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
2 | plugins { id("com.facebook.react.settings") }
3 | extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
4 | rootProject.name = 'com.regula.dr.fullauthrfid'
5 | include ':app'
6 | includeBuild('../node_modules/@react-native/gradle-plugin')
7 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/example/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | # This `.xcode.env` file is versioned and is used to source the environment
2 | # used when running script phases inside Xcode.
3 | # To customize your local environment, you can create an `.xcode.env.local`
4 | # file that is not versioned.
5 |
6 | # NODE_BINARY variable contains the PATH to the node executable.
7 | #
8 | # Customize the NODE_BINARY variable here.
9 | # For example, to use nvm with brew, add the following line
10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use
11 | export NODE_BINARY=$(command -v node)
12 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | buildToolsVersion = "35.0.0"
4 | minSdkVersion = 24
5 | compileSdkVersion = 35
6 | targetSdkVersion = 35
7 |
8 | ndkVersion = "27.1.12297006"
9 | kotlinVersion = "2.0.21"
10 | }
11 | repositories {
12 | google()
13 | mavenCentral()
14 | }
15 | dependencies {
16 | classpath("com.android.tools.build:gradle")
17 | classpath("com.facebook.react:react-native-gradle-plugin")
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2 |
3 | const path = require('path');
4 | const folders = [
5 | path.resolve(path.join(__dirname, './node_modules'))
6 | ];
7 |
8 | /**
9 | * Metro configuration
10 | * https://facebook.github.io/metro/docs/configuration
11 | *
12 | * @type {import('metro-config').MetroConfig}
13 | */
14 | const config = {
15 | resolver: {
16 | nodeModulesPaths: folders
17 | },
18 | watchFolders: folders,
19 | };
20 |
21 | module.exports = mergeConfig(getDefaultConfig(__dirname), config);
22 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/RNDocumentReaderApi.podspec:
--------------------------------------------------------------------------------
1 | require 'json'
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4 |
5 | Pod::Spec.new do |s|
6 | s.name = "RNDocumentReaderApi"
7 | s.version = package['version']
8 | s.summary = package['description']
9 | s.license = package['license']
10 |
11 | s.authors = { 'RegulaForensics' => 'support@regulaforensics.com' }
12 | s.homepage = 'https://regulaforensics.com'
13 |
14 | s.source = { :http => 'file:' + __dir__ }
15 | s.ios.deployment_target = '13.0'
16 | s.source_files = "ios/*.{h,m}"
17 | s.dependency 'DocumentReader', '8.4.5436'
18 | s.dependency 'React'
19 | end
20 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@regulaforensics/react-native-document-reader-api",
3 | "version": "8.4.327",
4 | "description": "React Native module for reading and validation of identification documents (API framework)",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [
10 | "react-native", "documentreader", "reader", "scanner", "regula"
11 | ],
12 | "author": "Regulaforensics",
13 | "license": "commercial",
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/regulaforensics/react-native-document-reader.git"
17 | },
18 | "homepage": "https://mobile.regulaforensics.com",
19 | "publishConfig": {
20 | "access": "public"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/example/android/app/src/release/java/com/regula/dr/fullrfid/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.regula.dr.fullauthrfid;
8 |
9 | import android.content.Context;
10 | import com.facebook.react.ReactInstanceManager;
11 |
12 | /**
13 | * Class responsible of loading Flipper inside your React Native application. This is the release
14 | * flavor of it so it's empty as we don't want to load Flipper.
15 | */
16 | public class ReactNativeFlipper {
17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18 | // Do nothing as we don't want to initialize Flipper on Release.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/example/ios/DocumentReaderTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | // Conditional for compatibility with AGP <4.2.
6 | if (project.android.hasProperty("namespace")) {
7 | namespace 'com.regula.plugin.documentreader'
8 | }
9 |
10 | compileSdk 36
11 |
12 | defaultConfig {
13 | minSdkVersion 24
14 | targetSdk 36
15 | versionCode 1
16 | versionName "1.0"
17 | }
18 | }
19 |
20 | rootProject.allprojects {
21 | repositories {
22 | maven {
23 | url "https://maven.regulaforensics.com/RegulaDocumentReader"
24 | }
25 | }
26 | }
27 |
28 | dependencies {
29 | //noinspection GradleDynamicVersion
30 | implementation 'com.facebook.react:react-native:+'
31 | //noinspection GradleDependency
32 | implementation('com.regula.documentreader:api:8.4.12046') {
33 | transitive = true
34 | }
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 |
5 | @implementation AppDelegate
6 |
7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8 | {
9 | self.moduleName = @"DocumentReader";
10 | // You can add your custom initial props in the dictionary below.
11 | // They will be passed down to the ViewController used by React Native.
12 | self.initialProps = @{};
13 |
14 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
15 | }
16 |
17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18 | {
19 | return [self bundleURL];
20 | }
21 |
22 | - (NSURL *)bundleURL
23 | {
24 | #if DEBUG
25 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
26 | #else
27 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
28 | #endif
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "scale" : "1x",
46 | "size" : "1024x1024"
47 | }
48 | ],
49 | "info" : {
50 | "author" : "xcode",
51 | "version" : 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | ios/.xcode.env.local
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 | *.hprof
33 | .cxx/
34 | *.keystore
35 | !debug.keystore
36 |
37 | # node.js
38 | #
39 | node_modules/
40 | npm-debug.log
41 | yarn-error.log
42 |
43 | # fastlane
44 | #
45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46 | # screenshots whenever they are needed.
47 | # For more information about the recommended setup visit:
48 | # https://docs.fastlane.tools/best-practices/source-control/
49 |
50 | **/fastlane/report.xml
51 | **/fastlane/Preview.html
52 | **/fastlane/screenshots
53 | **/fastlane/test_output
54 |
55 | # Bundle artifact
56 | *.jsbundle
57 |
58 | # Ruby / CocoaPods
59 | /ios/Pods/
60 | /vendor/bundle/
61 |
62 | # Temporary files created by Metro to check the health of the file watcher
63 | .metro-health-check*
64 |
65 | # testing
66 | /coverage
67 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | source "https://github.com/CocoaPods/Specs.git"
2 |
3 | # Resolve react_native_pods.rb with node to allow for hoisting
4 | require Pod::Executable.execute_command('node', ['-p',
5 | 'require.resolve(
6 | "react-native/scripts/react_native_pods.rb",
7 | {paths: [process.argv[1]]},
8 | )', __dir__]).strip
9 |
10 | platform :ios, min_ios_version_supported
11 | prepare_react_native_project!
12 |
13 | linkage = ENV['USE_FRAMEWORKS']
14 | if linkage != nil
15 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
16 | use_frameworks! :linkage => linkage.to_sym
17 | end
18 |
19 | target 'DocumentReader' do
20 | config = use_native_modules!
21 |
22 | use_react_native!(
23 | :path => config[:reactNativePath],
24 | # An absolute path to your application root.
25 | :app_path => "#{Pod::Config.instance.installation_root}/.."
26 | )
27 |
28 | target 'DocumentReaderTests' do
29 | inherit! :complete
30 | end
31 |
32 | post_install do |installer|
33 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
34 | react_native_post_install(
35 | installer,
36 | config[:reactNativePath],
37 | :mac_catalyst_enabled => false
38 | )
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/regula/dr/fullauthrfid/MainActivity.java:
--------------------------------------------------------------------------------
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;
6 | import com.facebook.react.defaults.DefaultReactActivityDelegate;
7 |
8 | public class MainActivity extends 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
15 | protected String getMainComponentName() {
16 | return "DocumentReader";
17 | }
18 |
19 | /**
20 | * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
21 | * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
22 | * (aka React 18) with two boolean flags.
23 | */
24 | @Override
25 | protected ReactActivityDelegate createReactActivityDelegate() {
26 | return new DefaultReactActivityDelegate(
27 | this,
28 | getMainComponentName(),
29 | // If you opted-in for the New Architecture, we enable the Fabric Renderer.
30 | DefaultNewArchitectureEntryPoint.getFabricEnabled());
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ios/RNRegulaDocumentReader.m:
--------------------------------------------------------------------------------
1 | #import "RNRegulaDocumentReader.h"
2 |
3 | RNRegulaDocumentReader* RGLWPlugin;
4 |
5 | @implementation RNRegulaDocumentReader
6 | @synthesize bridge = _bridge;
7 | RCT_EXPORT_MODULE();
8 |
9 | - (NSArray*)supportedEvents {
10 | return @[completionEvent,
11 | databaseProgressEvent,
12 | rfidOnProgressEvent,
13 | rfidOnChipDetectedEvent,
14 | rfidOnRetryReadChipEvent,
15 | paCertificateCompletionEvent,
16 | taCertificateCompletionEvent,
17 | taSignatureCompletionEvent,
18 | drVideoEncoderCompletionEvent,
19 | drOnCustomButtonTappedEvent];
20 | }
21 |
22 | static bool hasListeners;
23 | -(void)startObserving { hasListeners = YES; }
24 | -(void)stopObserving { hasListeners = NO; }
25 |
26 | UIViewController*(^RGLWRootViewController)(void) = ^UIViewController*(){
27 | return RCTPresentedViewController();
28 | };
29 |
30 | static RGLWEventSender sendEvent = ^(NSString* event, id data) {
31 | dispatch_async(dispatch_get_main_queue(), ^{
32 | if (hasListeners) [RGLWPlugin sendEventWithName:event body:@{@"msg": data}];
33 | });
34 | };
35 |
36 | RCT_EXPORT_METHOD(exec:(NSString*)moduleName:(NSString*)action:(NSArray*)args:(RCTResponseSenderBlock)sCallback:(RCTResponseSenderBlock)eCallback) {
37 | RGLWPlugin = self;
38 | RGLWCallback callback = ^(id _Nullable data) {
39 | if (data == nil) sCallback(@[[NSNull null]]);
40 | else sCallback(@[data]);
41 | };
42 | [RGLWMain methodCall:action :args :callback :sendEvent];
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Deprecated
2 |
3 | Introduced a new unified [NPM package](https://www.npmjs.com/package/@regulaforensics/document-reader) that supports React, Ionic, and Cordova wrappers in a single distribution. The individual packages for each wrapper are now deprecated and will only be supported for a few upcoming releases before being removed in future versions. We’ll provide advance notice prior to their removal. Follow the Migration Guide for detailed steps to transition to the new unified package.
4 |
5 | # Regula Document Reader SDK for React Native
6 |
7 | Regula Document Reader SDK allows you to read various kinds of identification documents, passports, driving licenses, ID cards, etc. All processing is performed completely _**offline**_ on your device. No any data leaving your device.
8 |
9 | You can use native camera to scan the documents or image from gallery for extract all data from it.
10 |
11 | This repository contains the source code of the Document Reader API, and the sample application that demonstrates the _**API**_ calls you can use to interact with the Document Reader library.
12 |
13 | ## Documentation
14 |
15 | You can find documentation [here](https://docs.regulaforensics.com/develop/doc-reader-sdk/mobile).
16 |
17 | ## License
18 |
19 | To obtaining the production license or other purchasing information, please [submit an inquiry](https://regulaforensics.com/talk-to-an-expert) and our sales team will contact you shortly.
20 |
21 | ## Support
22 |
23 | Please do not hesitate to [contact us](https://support.regulaforensics.com/hc/requests/new), if you need any assistance or want to report a bug / suggest an improvement.
24 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "DocumentReader",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "lint": "eslint .",
9 | "start": "react-native start",
10 | "test": "jest"
11 | },
12 | "dependencies": {
13 | "@regulaforensics/react-native-document-reader-api": "8.4.327",
14 | "@regulaforensics/react-native-document-reader-core-fullauthrfid": "8.4.1170",
15 | "@rneui/base": "4.0.0-rc.7",
16 | "@rneui/themed": "4.0.0-rc.7",
17 | "react": "19.0.0",
18 | "react-native": "0.79.0",
19 | "react-native-fs": "2.20.0",
20 | "react-native-image-picker": "7.2.3",
21 | "react-native-progress": "5.0.0",
22 | "react-native-radio-buttons-group": "3.0.5",
23 | "react-native-vector-icons": "10.2.0"
24 | },
25 | "devDependencies": {
26 | "@babel/core": "^7.26.0",
27 | "@babel/preset-env": "^7.26.0",
28 | "@babel/runtime": "^7.28.4",
29 | "@react-native-community/cli": "18.0.1",
30 | "@react-native-community/cli-platform-android": "18.0.1",
31 | "@react-native-community/cli-platform-ios": "18.0.1",
32 | "@react-native/babel-preset": "0.79.0",
33 | "@react-native/eslint-config": "0.79.0",
34 | "@react-native/metro-config": "0.79.0",
35 | "@react-native/typescript-config": "0.79.0",
36 | "@types/react": "^19.0.0",
37 | "@types/react-test-renderer": "^19.0.0",
38 | "babel-jest": "^29.7.0",
39 | "eslint": "^8.19.0",
40 | "jest": "^29.7.0",
41 | "prettier": "2.8.8",
42 | "react-test-renderer": "19.0.0",
43 | "typescript": "5.7.3"
44 | },
45 | "engines": {
46 | "node": ">=18"
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/ios/RGLWMain.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "RGLWJSONConstructor.h"
3 | #import "RGLWConfig.h"
4 |
5 | typedef void (^RGLWCallback)(id _Nullable response);
6 | typedef void (^RGLWEventSender)(NSString* _Nonnull event, id _Nullable data);
7 | typedef void (^RGLWRFIDSignatureCallback)(NSData * _Nonnull signature);
8 | extern UIViewController*_Nonnull(^ _Nonnull RGLWRootViewController)(void);
9 |
10 | @interface RGLWMain: NSObject
15 |
16 | +(void)methodCall:(NSString* _Nonnull)method
17 | :(NSArray* _Nonnull)args
18 | :(RGLWCallback _Nonnull)callback
19 | :(RGLWEventSender _Nonnull)eventSender;
20 |
21 | @property NSNumber* _Nonnull doRequestPACertificates;
22 | @property NSNumber* _Nonnull doRequestTACertificates;
23 | @property NSNumber* _Nonnull doRequestTASignature;
24 |
25 | @end
26 |
27 | static NSString* _Nonnull completionEvent = @"completion";
28 | static NSString* _Nonnull databaseProgressEvent = @"database_progress";
29 | static NSString* _Nonnull rfidOnProgressEvent = @"rfidOnProgressCompletion";
30 | static NSString* _Nonnull rfidOnChipDetectedEvent = @"rfidOnChipDetectedEvent";
31 | static NSString* _Nonnull rfidOnRetryReadChipEvent = @"rfidOnRetryReadChipEvent";
32 | static NSString* _Nonnull paCertificateCompletionEvent = @"pa_certificate_completion";
33 | static NSString* _Nonnull taCertificateCompletionEvent = @"ta_certificate_completion";
34 | static NSString* _Nonnull taSignatureCompletionEvent = @"ta_signature_completion";
35 | static NSString* _Nonnull drVideoEncoderCompletionEvent = @"video_encoder_completion";
36 | static NSString* _Nonnull drOnCustomButtonTappedEvent = @"onCustomButtonTappedEvent";
37 |
--------------------------------------------------------------------------------
/ios/RGLWConfig.h:
--------------------------------------------------------------------------------
1 | #ifndef RGLWConfig_h
2 | #define RGLWConfig_h
3 |
4 | #import
5 | #import "RGLWJSONConstructor.h"
6 |
7 | @import CoreGraphics;
8 | @import UIKit;
9 | @import AVFoundation;
10 |
11 | @interface RGLWConfig : NSObject
12 |
13 | +(void)setFunctionality:(NSDictionary*)options :(RGLFunctionality*)functionality;
14 | +(void)setProcessParams:(NSDictionary*)options :(RGLProcessParams*)processParams;
15 | +(void)setCustomization:(NSDictionary*)options :(RGLCustomization*)customization;
16 | +(void)setRfidScenario:(NSDictionary*)options :(RGLRFIDScenario*)rfidScenario;
17 | +(void)setDataGroups:(RGLDataGroup*)dataGroup dict:(NSDictionary*)dict;
18 | +(void)setDTCDataGroup:(RGLDTCDataGroup*)dataGroup dict:(NSDictionary*)dict;
19 | +(void)setImageQA:(RGLImageQA*)result input:(NSDictionary*)input;
20 | +(void)setAuthenticityParams:(RGLAuthenticityParams*)result input:(NSDictionary*)input;
21 | +(void)setLivenessParams:(RGLLivenessParams*)result input:(NSDictionary*)input;
22 |
23 | +(NSDictionary*)getFunctionality:(RGLFunctionality*)functionality;
24 | +(NSDictionary*)getProcessParams:(RGLProcessParams*)processParams;
25 | +(NSDictionary*)getCustomization:(RGLCustomization*)customization;
26 | +(NSDictionary*)getRfidScenario:(RGLRFIDScenario*)rfidScenario;
27 | +(NSDictionary*)getDataGroups:(RGLDataGroup*)dataGroup;
28 | +(NSDictionary*)getDTCDataGroup:(RGLDTCDataGroup*)dataGroup;
29 | +(NSDictionary*)getImageQA:(RGLImageQA*)input;
30 | +(NSDictionary*)getAuthenticityParams:(RGLAuthenticityParams*)input;
31 | +(NSDictionary*)getLivenessParams:(RGLLivenessParams*)input;
32 |
33 | +(RGLImageQualityCheckType)imageQualityCheckTypeWithNumber:(NSNumber*)value;
34 | +(NSNumber*)generateDocReaderAction:(RGLDocReaderAction)action;
35 | +(NSNumber*)generateRFIDCompleteAction:(RGLRFIDCompleteAction)action;
36 | +(NSNumber*)generateImageQualityCheckType:(RGLImageQualityCheckType)value;
37 |
38 | +(RGLDocReaderFrame)docReaderFrameWithString:(NSString*)value;
39 | +(NSString*)generateDocReaderFrame:(RGLDocReaderFrame)value;
40 |
41 | @end
42 | #endif
43 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Version of flipper SDK to use with React Native
28 | FLIPPER_VERSION=0.182.0
29 |
30 | # Use this property to specify which architecture you want to build.
31 | # You can also override it from the CLI using
32 | # ./gradlew -PreactNativeArchitectures=x86_64
33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34 |
35 | # Use this property to enable support to the new architecture.
36 | # This will allow you to use TurboModules and the Fabric render in
37 | # your application. You should enable this flag either if you want
38 | # to write custom TurboModules/Fabric components OR use libraries that
39 | # are providing them.
40 | newArchEnabled=false
41 |
42 | # Use this property to enable or disable the Hermes JS engine.
43 | # If set to false, you will be using JSC instead.
44 | hermesEnabled=false
45 |
--------------------------------------------------------------------------------
/example/ios/DocumentReaderTests/DocumentReaderTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import
5 | #import
6 |
7 | #define TIMEOUT_SECONDS 600
8 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
9 |
10 | @interface DocumentReaderTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation DocumentReaderTests
15 |
16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 | {
18 | if (test(view)) {
19 | return YES;
20 | }
21 | for (UIView *subview in [view subviews]) {
22 | if ([self findSubviewInView:subview matching:test]) {
23 | return YES;
24 | }
25 | }
26 | return NO;
27 | }
28 |
29 | - (void)testRendersWelcomeScreen
30 | {
31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 | BOOL foundElement = NO;
34 |
35 | __block NSString *redboxError = nil;
36 | #ifdef DEBUG
37 | RCTSetLogFunction(
38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 | if (level >= RCTLogLevelError) {
40 | redboxError = message;
41 | }
42 | });
43 | #endif
44 |
45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 |
49 | foundElement = [self findSubviewInView:vc.view
50 | matching:^BOOL(UIView *view) {
51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 | return YES;
53 | }
54 | return NO;
55 | }];
56 | }
57 |
58 | #ifdef DEBUG
59 | RCTSetLogFunction(RCTDefaultLogFunction);
60 | #endif
61 |
62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/regula/dr/fullauthrfid/MainApplication.java:
--------------------------------------------------------------------------------
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.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
9 | import com.facebook.react.defaults.DefaultReactNativeHost;
10 | import com.facebook.soloader.SoLoader;
11 |
12 | import java.io.IOException;
13 | import java.util.List;
14 | import com.facebook.react.soloader.OpenSourceMergedSoMapping;
15 |
16 | public class MainApplication extends Application implements ReactApplication {
17 |
18 | private final ReactNativeHost mReactNativeHost =
19 | new DefaultReactNativeHost(this) {
20 | @Override
21 | public boolean getUseDeveloperSupport() {
22 | return BuildConfig.DEBUG;
23 | }
24 |
25 | @Override
26 | protected List getPackages() {
27 | @SuppressWarnings("UnnecessaryLocalVariable")
28 | List packages = new PackageList(this).getPackages();
29 | // Packages that cannot be autolinked yet can be added manually here, for example:
30 | // packages.add(new MyReactNativePackage());
31 | return packages;
32 | }
33 |
34 | @Override
35 | protected String getJSMainModuleName() {
36 | return "index";
37 | }
38 |
39 | @Override
40 | protected boolean isNewArchEnabled() {
41 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
42 | }
43 |
44 | @Override
45 | protected Boolean isHermesEnabled() {
46 | return BuildConfig.IS_HERMES_ENABLED;
47 | }
48 | };
49 |
50 | @Override
51 | public ReactNativeHost getReactNativeHost() {
52 | return mReactNativeHost;
53 | }
54 |
55 | @Override
56 | public void onCreate() {
57 | super.onCreate();
58 | try {
59 | SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE);
60 | } catch (IOException e) {
61 | throw new RuntimeException(e);
62 | }
63 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
64 | // If you opted-in for the New Architecture, we load the native entry point for this app.
65 | DefaultNewArchitectureEntryPoint.load();
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # How to build demo application
2 |
3 | 1. Get the trial license at [client.regulaforensics.com](https://client.regulaforensics.com/) (`regula.license` file). The license creation wizard will guide you through the necessary steps.
4 | 2. Get the trial database at [client.regulaforensics.com/customer/databases](https://client.regulaforensics.com/customer/databases) (`db.dat`)
5 | 2. Download or clone this repository using the command `git clone https://github.com/regulaforensics/react-native-document-reader.git`.
6 | 4. Copy the `regula.license` file to the `example/android/app/src/main/assets/` folder.
7 | 4. Copy the `regula.license` file to the `example/ios/` folder.
8 | 5. Copy the `db.dat` file to the `example/android/app/src/main/assets/Regula/` folder.
9 | 6. Copy the `db.dat` file to the `example/ios/` folder.
10 | 3. Run the following commands in Terminal:
11 | ```bash
12 | $ cd example
13 | $ npm install
14 | $ cd ios
15 | $ pod install
16 | ```
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 | 4. Android:
21 | * 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. **Note**: `npx react-native log-android` is used to view logs.
23 |
24 | **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.
25 |
26 | 5. iOS:
27 | * Copy the `regula.license` file to the `example/ios` folder.
28 | * 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.
29 |
30 | # Troubleshooting license issues
31 |
32 | If you have issues with license verification when running the application, please verify that next is true:
33 | 1. The OS, which you use, is specified in the license (e.g., Android and/or iOS).
34 | 3. The license is valid (not expired).
35 | 4. The date and time on the device, where you run the application, are valid.
36 | 5. You use the latest release version of the Document Reader SDK.
37 | 6. You placed the `license` into the correct folder as described [here](#how-to-build-demo-application).
38 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | DocumentReader
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NFCReaderUsageDescription
28 | To use NFC
29 | NSAppTransportSecurity
30 |
31 | NSExceptionDomains
32 |
33 | localhost
34 |
35 | NSExceptionAllowsInsecureHTTPLoads
36 |
37 |
38 |
39 |
40 | NSCameraUsageDescription
41 | To use camera
42 | NSLocationWhenInUseUsageDescription
43 |
44 | NSPhotoLibraryUsageDescription
45 | To use gallery
46 | UILaunchStoryboardName
47 | LaunchScreen
48 | UIRequiredDeviceCapabilities
49 |
50 | armv7
51 |
52 | UISupportedInterfaceOrientations
53 |
54 | UIInterfaceOrientationPortrait
55 |
56 | UISupportedInterfaceOrientations~ipad
57 |
58 | UIInterfaceOrientationPortrait
59 |
60 | UIViewControllerBasedStatusBarAppearance
61 |
62 | com.apple.developer.nfc.readersession.iso7816.select-identifiers
63 |
64 | A0000002471001
65 | E80704007F00070302
66 | A000000167455349474E
67 | A0000002480100
68 | A0000002480200
69 | A0000002480300
70 | A00000045645444C2D3031
71 |
72 | UIAppFonts
73 |
74 | AntDesign.ttf
75 | Entypo.ttf
76 | EvilIcons.ttf
77 | Feather.ttf
78 | FontAwesome.ttf
79 | FontAwesome5_Brands.ttf
80 | FontAwesome5_Regular.ttf
81 | FontAwesome5_Solid.ttf
82 | FontAwesome6_Brands.ttf
83 | FontAwesome6_Regular.ttf
84 | FontAwesome6_Solid.ttf
85 | Foundation.ttf
86 | Ionicons.ttf
87 | MaterialIcons.ttf
88 | MaterialCommunityIcons.ttf
89 | SimpleLineIcons.ttf
90 | Octicons.ttf
91 | Zocial.ttf
92 | Fontisto.ttf
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/java/com/regula/dr/fullrfid/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.regula.dr.fullauthrfid;
8 |
9 | import android.content.Context;
10 | import com.facebook.flipper.android.AndroidFlipperClient;
11 | import com.facebook.flipper.android.utils.FlipperUtils;
12 | import com.facebook.flipper.core.FlipperClient;
13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21 | import com.facebook.react.ReactInstanceEventListener;
22 | import com.facebook.react.ReactInstanceManager;
23 | import com.facebook.react.bridge.ReactContext;
24 | import com.facebook.react.modules.network.NetworkingModule;
25 | import okhttp3.OkHttpClient;
26 |
27 | /**
28 | * Class responsible of loading Flipper inside your React Native application. This is the debug
29 | * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30 | */
31 | public class ReactNativeFlipper {
32 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33 | if (FlipperUtils.shouldEnableFlipper(context)) {
34 | final FlipperClient client = AndroidFlipperClient.getInstance(context);
35 |
36 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37 | client.addPlugin(new DatabasesFlipperPlugin(context));
38 | client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39 | client.addPlugin(CrashReporterPlugin.getInstance());
40 |
41 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42 | NetworkingModule.setCustomClientBuilder(
43 | new NetworkingModule.CustomClientBuilder() {
44 | @Override
45 | public void apply(OkHttpClient.Builder builder) {
46 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47 | }
48 | });
49 | client.addPlugin(networkFlipperPlugin);
50 | client.start();
51 |
52 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53 | // Hence we run if after all native modules have been initialized
54 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55 | if (reactContext == null) {
56 | reactInstanceManager.addReactInstanceEventListener(
57 | new ReactInstanceEventListener() {
58 | @Override
59 | public void onReactContextInitialized(ReactContext reactContext) {
60 | reactInstanceManager.removeReactInstanceEventListener(this);
61 | reactContext.runOnNativeModulesQueueThread(
62 | new Runnable() {
63 | @Override
64 | public void run() {
65 | client.addPlugin(new FrescoFlipperPlugin());
66 | }
67 | });
68 | }
69 | });
70 | } else {
71 | client.addPlugin(new FrescoFlipperPlugin());
72 | }
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader.xcodeproj/xcshareddata/xcschemes/DocumentReader.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/android/src/main/java/com/regula/plugin/documentreader/RNRegulaDocumentReaderModule.kt:
--------------------------------------------------------------------------------
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.Arguments
14 | import com.facebook.react.bridge.Promise
15 | import com.facebook.react.bridge.ReactApplicationContext
16 | import com.facebook.react.bridge.ReactContext
17 | import com.facebook.react.bridge.ReactContextBaseJavaModule
18 | import com.facebook.react.bridge.ReactMethod
19 | import com.facebook.react.bridge.ReadableArray
20 | import com.facebook.react.modules.core.DeviceEventManagerModule
21 | import com.facebook.react.modules.core.PermissionAwareActivity
22 | import com.facebook.react.uimanager.ViewManager
23 | import org.json.JSONArray
24 | import org.json.JSONObject
25 |
26 | var listenerCount = 0
27 |
28 | lateinit var args: JSONArray
29 | lateinit var binding: ReactContext
30 | val context: Context
31 | get() = binding.applicationContext
32 | val activity: Activity
33 | get() = binding.currentActivity!!
34 | val lifecycle: Lifecycle
35 | get() = (activity as AppCompatActivity).lifecycle
36 |
37 | fun sendEvent(event: String, data: Any? = "") {
38 | if (listenerCount <= 0) return
39 | val result = if (data is JSONObject || data is JSONArray) data.toString() else data.toString() + ""
40 | val map = Arguments.createMap()
41 | map.putString("msg", result)
42 | binding.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit(event, map)
43 | }
44 |
45 | @Suppress("UNCHECKED_CAST")
46 | fun argsNullable(index: Int): T? {
47 | val value = args[index]
48 | if (value is Double && value % 1 == 0.0) return value.toInt() as T
49 | if (value.toString() == "null") return null
50 | return value as T
51 | }
52 |
53 | fun requestPermissions(activity: Activity, permissions: Array, requestCode: Int) {
54 | (activity as PermissionAwareActivity).requestPermissions(permissions, requestCode) { code, perms, grantResults ->
55 | onRequestPermissionsResult(code, perms, grantResults)
56 | }
57 | }
58 |
59 | fun startActivityForResult(activity: Activity, intent: Intent, requestCode: Int) {
60 | activity.startActivityForResult(intent, requestCode)
61 | }
62 |
63 | class RNRegulaDocumentReaderPackage : ReactPackage {
64 | override fun createNativeModules(reactContext: ReactApplicationContext) = listOf(RNRegulaDocumentReaderModule(reactContext))
65 | override fun createViewManagers(reactContext: ReactApplicationContext) = emptyList>()
66 | }
67 |
68 | class RNRegulaDocumentReaderModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), ActivityEventListener {
69 | init {
70 | binding = reactContext
71 | binding.addActivityEventListener(this)
72 | }
73 |
74 | @ReactMethod
75 | fun addListener(eventName: String) {
76 | listenerCount += 1
77 | }
78 |
79 | @ReactMethod
80 | fun removeListeners(count: Int) {
81 | listenerCount -= count
82 | }
83 |
84 | override fun onNewIntent(intent: Intent) {
85 | newIntent(intent)
86 | }
87 |
88 | override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
89 | onActivityResult(requestCode, resultCode, data)
90 | }
91 |
92 | @ReactMethod
93 | fun exec(moduleName: String, method: String, arguments: ReadableArray, success: com.facebook.react.bridge.Callback, error: com.facebook.react.bridge.Callback) {
94 | args = JSONArray(arguments.toArrayList())
95 | try {
96 | methodCall(method) { data -> success(data.toSendable()) }
97 | } catch (error: Exception) {
98 | Log.e("REGULA", "Caught exception in \"$method\" function:", error)
99 | }
100 | }
101 |
102 | override fun getName() = "RNRegulaDocumentReader"
103 | }
104 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 | apply plugin: "com.facebook.react"
3 |
4 |
5 | /**
6 | * This is the configuration block to customize your React Native Android app.
7 | * By default you don't need to apply any configuration, just uncomment the lines you need.
8 | */
9 | react {
10 | /* Folders */
11 | // The root of your project, i.e. where "package.json" lives. Default is '..'
12 | // root = file("../")
13 | // The folder where the react-native NPM package is. Default is ../node_modules/react-native
14 | // reactNativeDir = file("../node_modules/react-native")
15 | // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
16 | // codegenDir = file("../node_modules/@react-native/codegen")
17 | // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
18 | // cliFile = file("../node_modules/react-native/cli.js")
19 |
20 | /* Variants */
21 | // The list of variants to that are debuggable. For those we're going to
22 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
23 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24 | // debuggableVariants = ["liteDebug", "prodDebug"]
25 |
26 | /* Bundling */
27 | // A list containing the node command and its flags. Default is just 'node'.
28 | // nodeExecutableAndArgs = ["node"]
29 | //
30 | // The command to run when bundling. By default is 'bundle'
31 | // bundleCommand = "ram-bundle"
32 | //
33 | // The path to the CLI configuration file. Default is empty.
34 | // bundleConfig = file(../rn-cli.config.js)
35 | //
36 | // The name of the generated asset file containing your JS bundle
37 | // bundleAssetName = "MyApplication.android.bundle"
38 | //
39 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40 | // entryFile = file("../js/MyApplication.android.js")
41 | //
42 | // A list of extra flags to pass to the 'bundle' commands.
43 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44 | // extraPackagerArgs = []
45 |
46 | /* Hermes Commands */
47 | // The hermes compiler command to run. By default it is 'hermesc'
48 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49 | //
50 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51 | // hermesFlags = ["-O", "-output-source-map"]
52 |
53 | /* Autolinking */
54 | autolinkLibrariesWithApp()
55 | }
56 |
57 | /**
58 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
59 | */
60 | def enableProguardInReleaseBuilds = false
61 |
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 | android {
76 | ndkVersion rootProject.ext.ndkVersion
77 |
78 | compileSdk rootProject.ext.compileSdkVersion
79 |
80 | namespace "com.regula.dr.fullauthrfid"
81 | defaultConfig {
82 | applicationId "com.regula.dr.fullauthrfid"
83 | minSdkVersion rootProject.ext.minSdkVersion
84 | targetSdkVersion rootProject.ext.targetSdkVersion
85 | versionCode 1
86 | versionName "1.0"
87 | }
88 | signingConfigs {
89 | debug {
90 | storeFile file('debug.keystore')
91 | storePassword 'android'
92 | keyAlias 'androiddebugkey'
93 | keyPassword 'android'
94 | }
95 | }
96 | buildTypes {
97 | debug {
98 | signingConfig signingConfigs.debug
99 | }
100 | release {
101 | // Caution! In production, you need to generate your own keystore file.
102 | // see https://reactnative.dev/docs/signed-apk-android.
103 | signingConfig signingConfigs.debug
104 | minifyEnabled enableProguardInReleaseBuilds
105 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
106 | }
107 | }
108 | }
109 |
110 | dependencies {
111 | // The version of react-native is set by the React Native Gradle Plugin
112 | implementation("com.facebook.react:react-android")
113 |
114 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
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 | }
125 | }
126 |
127 | apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
128 |
--------------------------------------------------------------------------------
/android/src/main/java/com/regula/plugin/documentreader/BluetoothUtil.kt:
--------------------------------------------------------------------------------
1 | package com.regula.plugin.documentreader
2 |
3 | import android.Manifest.permission.ACCESS_FINE_LOCATION
4 | import android.Manifest.permission.BLUETOOTH_CONNECT
5 | import android.Manifest.permission.BLUETOOTH_SCAN
6 | import android.annotation.SuppressLint
7 | import android.app.Activity
8 | import android.bluetooth.BluetoothAdapter
9 | import android.content.ComponentName
10 | import android.content.Context.BIND_AUTO_CREATE
11 | import android.content.Intent
12 | import android.content.ServiceConnection
13 | import android.content.pm.PackageManager.PERMISSION_GRANTED
14 | import android.os.Build
15 | import android.os.IBinder
16 | import android.provider.Settings
17 | import android.util.Log
18 | import androidx.core.content.ContextCompat.checkSelfPermission
19 | import com.regula.common.ble.BLEWrapper
20 | import com.regula.common.ble.BleWrapperCallback
21 | import com.regula.common.ble.RegulaBleService
22 | import com.regula.documentreader.api.internal.permission.BluetoothPermissionHelper.BLE_ACCESS_PERMISSION
23 | import com.regula.documentreader.api.internal.permission.BluetoothSettingsHelper.isBluetoothEnabled
24 | import com.regula.documentreader.api.internal.permission.BluetoothSettingsHelper.isLocationServiceEnabled
25 | import java.util.Timer
26 | import java.util.TimerTask
27 |
28 | const val SEARCHING_TIMEOUT: Long = 7000
29 |
30 | const val INTENT_REQUEST_ENABLE_LOCATION = 196
31 | const val INTENT_REQUEST_ENABLE_BLUETOOTH = 197
32 |
33 | @SuppressLint("StaticFieldLeak")
34 | var bluetooth: BLEWrapper? = null
35 | lateinit var savedDeviceNameForPermissionResult: String
36 | lateinit var savedCallbackForPermissionResult: Callback
37 |
38 | fun connectBluetoothDevice(deviceName: String, callback: Callback) {
39 | if (bluetooth?.isConnected == true) {
40 | Log.e("REGULA", "Bluetooth device already connected, returning false")
41 | callback(false)
42 | return
43 | }
44 |
45 | if (!isBluetoothSettingsReady(activity)) {
46 | savedDeviceNameForPermissionResult = deviceName
47 | savedCallbackForPermissionResult = callback
48 | return
49 | }
50 |
51 | val timeout = object : TimerTask() {
52 | override fun run() {
53 | callback(false)
54 | bluetooth?.stopDeviceScan()
55 | bluetooth?.disconnect()
56 | }
57 | }
58 | Timer().schedule(timeout, SEARCHING_TIMEOUT)
59 |
60 | val bleIntent = Intent(context, RegulaBleService::class.java)
61 | bleIntent.putExtra(RegulaBleService.DEVICE_NAME, deviceName)
62 | context.startService(bleIntent)
63 | context.bindService(bleIntent, object : ServiceConnection {
64 | override fun onServiceConnected(name: ComponentName, service: IBinder) {
65 | bluetooth = (service as RegulaBleService.LocalBinder).service.bleManager
66 | if (bluetooth!!.isConnected) callback(true)
67 | else bluetooth!!.addCallback(object : BleWrapperCallback() {
68 | override fun onDeviceReady() {
69 | timeout.cancel()
70 | bluetooth!!.removeCallback(this)
71 | callback(true)
72 | }
73 | })
74 | }
75 |
76 | override fun onServiceDisconnected(name: ComponentName) {}
77 | }, BIND_AUTO_CREATE)
78 | }
79 |
80 | fun onRequestPermissionsResult(
81 | requestCode: Int,
82 | permissions: Array,
83 | grantResults: IntArray
84 | ): Boolean {
85 | if (requestCode != BLE_ACCESS_PERMISSION || permissions.isEmpty()) return false
86 | if (grantResults.isEmpty() || grantResults[0] != PERMISSION_GRANTED) {
87 | savedCallbackForPermissionResult(false)
88 | return true
89 | }
90 | connectBluetoothDevice(savedDeviceNameForPermissionResult, savedCallbackForPermissionResult)
91 | return true
92 | }
93 |
94 | fun onActivityResult(requestCode: Int, rc: Int, @Suppress("UNUSED_PARAMETER") data: Intent?): Boolean {
95 | var resultCode = rc
96 | if (requestCode == INTENT_REQUEST_ENABLE_LOCATION)
97 | resultCode = if (isLocationServiceEnabled(activity)) Activity.RESULT_OK
98 | else requestCode
99 |
100 | if (requestCode == INTENT_REQUEST_ENABLE_BLUETOOTH || requestCode == INTENT_REQUEST_ENABLE_LOCATION) {
101 | if (resultCode == Activity.RESULT_OK)
102 | connectBluetoothDevice(savedDeviceNameForPermissionResult, savedCallbackForPermissionResult)
103 | else
104 | savedCallbackForPermissionResult(false)
105 | return true
106 | }
107 | return false
108 | }
109 |
110 | fun isBluetoothSettingsReady(activity: Activity): Boolean {
111 | deniedBluetoothPermissions()?.let {
112 | requestPermissions(activity, it, BLE_ACCESS_PERMISSION)
113 | return false
114 | }
115 | if (!isBluetoothEnabled(activity)) {
116 | requestEnableBluetooth(activity)
117 | return false
118 | }
119 | if (!isLocationServiceEnabled(activity)) {
120 | requestEnableLocationService(activity)
121 | return false
122 | }
123 | return true
124 | }
125 |
126 | fun deniedBluetoothPermissions(): Array? {
127 | val result = mutableListOf()
128 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
129 | result.addAll(deniedBluetoothPermission(BLUETOOTH_SCAN))
130 | result.addAll(deniedBluetoothPermission(BLUETOOTH_CONNECT))
131 | } else
132 | result.addAll(deniedBluetoothPermission(ACCESS_FINE_LOCATION))
133 | return result.let { if (it.isNotEmpty()) it.toTypedArray() else null }
134 | }
135 |
136 | fun deniedBluetoothPermission(permission: String): Array {
137 | if (checkSelfPermission(context, permission) != PERMISSION_GRANTED)
138 | return arrayOf(permission)
139 | return arrayOf()
140 | }
141 |
142 | fun requestEnableBluetooth(activity: Activity) {
143 | val enableIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
144 | startActivityForResult(activity, enableIntent, INTENT_REQUEST_ENABLE_BLUETOOTH)
145 | }
146 |
147 | fun requestEnableLocationService(activity: Activity) {
148 | val myIntent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)
149 | startActivityForResult(activity, myIntent, INTENT_REQUEST_ENABLE_LOCATION)
150 | }
151 |
152 | // btDevice functionality(temporary, will be reworked)
153 |
154 | fun btDeviceRequestFlashing() {
155 | bluetooth?.requestFlashing()
156 | }
157 |
158 | fun btDeviceRequestFlashingFullIR() {
159 | bluetooth?.requestFlashingFullIR()
160 | }
161 |
162 | fun btDeviceRequestTurnOffAll() {
163 | bluetooth?.requestTurnOffAll()
164 | }
165 |
--------------------------------------------------------------------------------
/android/src/main/java/com/regula/plugin/documentreader/Utils.kt:
--------------------------------------------------------------------------------
1 | @file:SuppressLint("UseKtx")
2 |
3 | package com.regula.plugin.documentreader
4 |
5 | import android.annotation.SuppressLint
6 | import android.graphics.Bitmap
7 | import android.graphics.BitmapFactory
8 | import android.graphics.Canvas
9 | import android.graphics.drawable.BitmapDrawable
10 | import android.graphics.drawable.Drawable
11 | import android.util.Base64
12 | import org.json.JSONArray
13 | import org.json.JSONObject
14 | import java.io.ByteArrayOutputStream
15 | import kotlin.math.sqrt
16 |
17 | fun List<*>.toJson(): JSONArray {
18 | val result = JSONArray()
19 | for (i in indices)
20 | when (val v = this[i]) {
21 | null -> result.put(null)
22 | is Map<*, *> -> result.put(v.toJson())
23 | is List<*> -> result.put(v.toJson())
24 | else -> result.put(v)
25 | }
26 | return result
27 | }
28 |
29 | fun Map<*, *>.toJson(): JSONObject {
30 | val result = JSONObject()
31 | for ((k, v) in this) {
32 | when (v) {
33 | null -> result.put(k as String, null)
34 | is Map<*, *> -> result.put(k as String, v.toJson())
35 | is List<*> -> result.put(k as String, v.toJson())
36 | else -> result.put(k as String, v)
37 | }
38 | }
39 | return result
40 | }
41 |
42 | fun Any?.toSendable(): Any? = this?.let {
43 | if (it is JSONObject || it is JSONArray) it.toString()
44 | else it
45 | }
46 |
47 | fun List?.toJson(toJson: (T?) -> Any?) = this?.let {
48 | val result = JSONArray()
49 | for (item in it) result.put(toJson(item))
50 | result
51 | }
52 |
53 | fun List?.toJsonNullable(toJson: (T?) -> Any?) = this?.let {
54 | val result = JSONArray()
55 | for (item in it) result.put(toJson(item))
56 | result
57 | }
58 |
59 | fun JSONArray?.toList(fromJson: (JSONObject) -> T) = this?.let {
60 | val result: MutableList = ArrayList()
61 | for (i in 0 until it.length()) result.add(fromJson(it.getJSONObject(i)))
62 | result
63 | }
64 |
65 | fun JSONArray.toList() = this.let {
66 | val result = mutableListOf()
67 | @Suppress("UNCHECKED_CAST")
68 | for (i in 0 until length()) result.add(get(i) as T)
69 | result
70 | }
71 |
72 | inline fun JSONArray?.toArray() = this?.let {
73 | val result = arrayOfNulls(length())
74 | for (i in 0 until length()) result[i] = get(i) as T
75 | result
76 | }
77 |
78 | inline fun JSONArray?.toArray(fromJson: (JSONObject?) -> T) = this?.let {
79 | val result = arrayOfNulls(length())
80 | for (i in 0 until length()) result[i] = fromJson(getJSONObject(i))
81 | result
82 | }
83 |
84 | fun Array?.toJson() = this?.let {
85 | val result = JSONArray()
86 | for (i in it.indices) result.put(i, it[i])
87 | result
88 | }
89 |
90 | fun Array?.toJson(toJson: (T?) -> JSONObject?) = this?.let {
91 | val result = JSONArray()
92 | for (i in indices) result.put(i, toJson(this[i]))
93 | result
94 | }
95 |
96 | fun Any?.toIntArray() = (this as JSONArray?)?.let {
97 | val result = IntArray(it.length())
98 | for (i in 0 until it.length()) result[i] = it.getInt(i)
99 | result
100 | }
101 |
102 | fun IntArray?.toJson() = this?.let {
103 | val result = JSONArray()
104 | for (i in it.indices) result.put(i, it[i])
105 | result
106 | }
107 |
108 | fun JSONObject.forEach(action: (String, Any) -> Unit) {
109 | val keys: Iterator = keys()
110 | while (keys.hasNext()) {
111 | val key = keys.next()
112 | action(key, get(key))
113 | }
114 | }
115 |
116 | fun JSONObject.getJSONObjectOrNull(name: String): JSONObject? {
117 | if (has(name) && get(name).toString() != "null") return getJSONObject(name)
118 | return null
119 | }
120 |
121 | fun JSONObject.getIntOrNull(name: String): Int? {
122 | if (has(name) && get(name).toString() != "null") return getInt(name)
123 | return null
124 | }
125 |
126 | fun JSONObject.getDoubleOrNull(name: String): Double? {
127 | if (has(name) && get(name).toString() != "null") return getDouble(name)
128 | return null
129 | }
130 |
131 | fun JSONObject.getBooleanOrNull(name: String): Boolean? {
132 | if (has(name) && get(name).toString() != "null") return getBoolean(name)
133 | return null
134 | }
135 |
136 | fun JSONObject.getStringOrNull(name: String): String? {
137 | if (has(name) && get(name).toString() != "null") return getString(name)
138 | return null
139 | }
140 |
141 | internal object Convert {
142 | fun String?.toByteArray(): ByteArray? {
143 | var str = this ?: return null
144 | if (str.startsWith("data")) str = str.substring(str.indexOf(",") + 1)
145 | return Base64.decode(str, Base64.NO_WRAP)
146 | }
147 |
148 | fun ByteArray?.toBase64() = this?.let { Base64.encodeToString(it, Base64.NO_WRAP) }
149 |
150 | fun Bitmap?.toBase64() = this?.let {
151 | val byteArrayOutputStream = ByteArrayOutputStream()
152 | it.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream)
153 | byteArrayOutputStream.toByteArray().toBase64()
154 | }
155 |
156 | fun String?.toBitmap() = this?.let {
157 | val decodedString = toByteArray()!!
158 | var result = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.size)
159 | val sizeMultiplier = result.byteCount / 5000000
160 | if (result.byteCount > 5000000) result = Bitmap.createScaledBitmap(result, result.width / sqrt(sizeMultiplier.toDouble()).toInt(), result.height / sqrt(sizeMultiplier.toDouble()).toInt(), false)
161 | result
162 | }
163 |
164 | fun Any?.toDrawable() = (this as String?)?.let {
165 | val decodedByte = it.toByteArray()!!
166 | val bitmap = BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.size)
167 | val density = context.resources.displayMetrics.density
168 | val width = (bitmap.width * density).toInt()
169 | val height = (bitmap.height * density).toInt()
170 | BitmapDrawable(context.resources, Bitmap.createScaledBitmap(bitmap, width, height, false))
171 | }
172 |
173 | fun Drawable?.toBase64() = this?.let {
174 | if (this is BitmapDrawable) if (bitmap != null) return bitmap.toBase64()
175 | val bitmap: Bitmap = if (intrinsicWidth <= 0 || intrinsicHeight <= 0) Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) else Bitmap.createBitmap(intrinsicWidth, intrinsicHeight, Bitmap.Config.ARGB_8888)
176 | val canvas = Canvas(bitmap)
177 | setBounds(0, 0, canvas.width, canvas.height)
178 | draw(canvas)
179 | bitmap.toBase64()
180 | }
181 | }
182 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | # This is normally unused
84 | # shellcheck disable=SC2034
85 | APP_BASE_NAME=${0##*/}
86 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147 | # shellcheck disable=SC3045
148 | MAX_FD=$( ulimit -H -n ) ||
149 | warn "Could not query maximum file descriptor limit"
150 | esac
151 | case $MAX_FD in #(
152 | '' | soft) :;; #(
153 | *)
154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155 | # shellcheck disable=SC3045
156 | ulimit -n "$MAX_FD" ||
157 | warn "Could not set maximum file descriptor limit to $MAX_FD"
158 | esac
159 | fi
160 |
161 | # Collect all arguments for the java command, stacking in reverse order:
162 | # * args from the command line
163 | # * the main class name
164 | # * -classpath
165 | # * -D...appname settings
166 | # * --module-path (only if needed)
167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
168 |
169 | # For Cygwin or MSYS, switch paths to Windows format before running java
170 | if "$cygwin" || "$msys" ; then
171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
173 |
174 | JAVACMD=$( cygpath --unix "$JAVACMD" )
175 |
176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
177 | for arg do
178 | if
179 | case $arg in #(
180 | -*) false ;; # don't mess with options #(
181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
182 | [ -e "$t" ] ;; #(
183 | *) false ;;
184 | esac
185 | then
186 | arg=$( cygpath --path --ignore --mixed "$arg" )
187 | fi
188 | # Roll the args list around exactly as many times as the number of
189 | # args, so each arg winds up back in the position where it started, but
190 | # possibly modified.
191 | #
192 | # NB: a `for` loop captures its iteration list before it begins, so
193 | # changing the positional parameters here affects neither the number of
194 | # iterations, nor the values presented in `arg`.
195 | shift # remove old arg
196 | set -- "$@" "$arg" # push replacement arg
197 | done
198 | fi
199 |
200 | # Collect all arguments for the java command;
201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202 | # shell script including quotes and variable substitutions, so put them in
203 | # double quotes to make sure that they get re-expanded; and
204 | # * put everything else in single quotes, so that it's not re-expanded.
205 |
206 | set -- \
207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
208 | -classpath "$CLASSPATH" \
209 | org.gradle.wrapper.GradleWrapperMain \
210 | "$@"
211 |
212 | # Stop when "xargs" is not available.
213 | if ! command -v xargs >/dev/null 2>&1
214 | then
215 | die "xargs is not available"
216 | fi
217 |
218 | # Use "xargs" to parse quoted args.
219 | #
220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
221 | #
222 | # In Bash we could simply go:
223 | #
224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
225 | # set -- "${ARGS[@]}" "$@"
226 | #
227 | # but POSIX shell has neither arrays nor command substitution, so instead we
228 | # post-process each arg (as a line of input to sed) to backslash-escape any
229 | # character that might be a shell metacharacter, then use eval to reverse
230 | # that process (while maintaining the separation between arguments), and wrap
231 | # the whole thing up as a single "set" statement.
232 | #
233 | # This will of course break if any of these variables contains a newline or
234 | # an unmatched quote.
235 | #
236 |
237 | eval "set -- $(
238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
239 | xargs -n1 |
240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
241 | tr '\n' ' '
242 | )" '"$@"'
243 |
244 | exec "$JAVACMD" "$@"
245 |
--------------------------------------------------------------------------------
/example/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { ScrollView, StyleSheet, Text, View, NativeEventEmitter, Platform, TouchableOpacity, Image, Button } from 'react-native'
3 | import DocumentReader, { Enum, DocumentReaderCompletion, DocumentReaderScenario, RNRegulaDocumentReader, DocumentReaderResults, DocumentReaderNotification, ScannerConfig, RecognizeConfig, DocReaderConfig, Functionality } from '@regulaforensics/react-native-document-reader-api'
4 | import * as RNFS from 'react-native-fs'
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 | import { launchImageLibrary } from 'react-native-image-picker'
9 | import * as Progress from 'react-native-progress'
10 |
11 | var isReadingRfid = false
12 |
13 | interface IProps {
14 | }
15 |
16 | interface IState {
17 | fullName: string | undefined
18 | doRfid: boolean
19 | isReadingRfidCustomUi: boolean
20 | rfidUIHeader: string
21 | rfidUIHeaderColor: string
22 | rfidDescription: string
23 | rfidProgress: number
24 | canRfid: boolean
25 | canRfidTitle: string
26 | radioButtons: any
27 | selectedScenario: string
28 | portrait: any
29 | docFront: any
30 | }
31 |
32 | export default class App extends React.Component {
33 | onInitialized() {
34 | this.setState({ fullName: "Ready" })
35 |
36 | var functionality = new Functionality()
37 | functionality.showCaptureButton = true
38 | DocumentReader.setFunctionality(functionality, _ => { }, _ => { })
39 | }
40 |
41 | constructor(props: {} | Readonly<{}>) {
42 | super(props)
43 | Icon.loadFont()
44 |
45 | var eventManager = new NativeEventEmitter(RNRegulaDocumentReader)
46 | eventManager.addListener('completion', (e) => this.handleCompletion(DocumentReaderCompletion.fromJson(JSON.parse(e["msg"]))!))
47 | eventManager.addListener('rfidOnProgressCompletion', e => this.updateRfidUI(DocumentReaderNotification.fromJson(JSON.parse(e["msg"]))!))
48 |
49 | var licPath = Platform.OS === 'ios' ? (RNFS.MainBundlePath + "/regula.license") : "regula.license"
50 | var readFile = Platform.OS === 'ios' ? RNFS.readFile : RNFS.readFileAssets
51 | readFile(licPath, 'base64').then((res) => {
52 | this.setState({ fullName: "Initializing..." })
53 | var config = new DocReaderConfig()
54 | config.license = res
55 | config.delayedNNLoad = true
56 | DocumentReader.initializeReader(config, (response) => {
57 | if (!JSON.parse(response)["success"]) {
58 | console.log(response)
59 | return
60 | }
61 | console.log("Init complete")
62 | DocumentReader.getIsRFIDAvailableForUse((canRfid) => {
63 | if (canRfid) {
64 | this.setState({ canRfid: true, rfidUIHeader: "Reading RFID", rfidDescription: "Place your phone on top of the NFC tag", rfidUIHeaderColor: "black" })
65 | this.setState({ canRfidTitle: '' })
66 | }
67 | }, error => console.log(error))
68 | DocumentReader.getAvailableScenarios((jstring) => {
69 | var scenarios = JSON.parse(jstring)
70 | var items: RadioButtonProps[] = []
71 | for (var i in scenarios) {
72 | var scenario = DocumentReaderScenario.fromJson(typeof scenarios[i] === "string" ? JSON.parse(scenarios[i]) : scenarios[i])!.name!
73 | items.push({ label: scenario, id: scenario })
74 | }
75 | this.setState({ radioButtons: items })
76 | this.setState({ selectedScenario: this.state.radioButtons[0]['id'] })
77 | }, error => console.log(error))
78 | this.onInitialized()
79 | }, error => console.log(error))
80 | })
81 |
82 | this.state = {
83 | fullName: "Please wait...",
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 | }
97 | }
98 |
99 | handleCompletion(completion: DocumentReaderCompletion) {
100 | if (this.state.isReadingRfidCustomUi) {
101 | if (completion.action == Enum.DocReaderAction.ERROR) this.restartRfidUI()
102 | if (this.actionSuccess(completion.action!) || this.actionError(completion.action!)) {
103 | this.hideRfidUI()
104 | this.displayResults(completion.results!)
105 | }
106 | } else if (this.actionSuccess(completion.action!) || this.actionError(completion.action!))
107 | this.handleResults(completion.results!)
108 | }
109 |
110 | actionSuccess(action: number) {
111 | if (action == Enum.DocReaderAction.COMPLETE || action == Enum.DocReaderAction.TIMEOUT) return true
112 | return false
113 | }
114 |
115 | actionError(action: number) {
116 | if (action == Enum.DocReaderAction.CANCEL || action == Enum.DocReaderAction.ERROR) return true
117 | return false
118 | }
119 |
120 | showRfidUI() {
121 | // show animation
122 | this.setState({ isReadingRfidCustomUi: true })
123 | }
124 |
125 | hideRfidUI() {
126 | // show animation
127 | DocumentReader.stopRFIDReader(_ => { }, _ => { });
128 | this.restartRfidUI()
129 | this.setState({ isReadingRfidCustomUi: false, rfidUIHeader: "Reading RFID", rfidUIHeaderColor: "black" })
130 | }
131 |
132 | restartRfidUI() {
133 | this.setState({ rfidUIHeaderColor: "red", rfidUIHeader: "Failed!", rfidDescription: "Place your phone on top of the NFC tag", rfidProgress: -1 })
134 | }
135 |
136 | updateRfidUI(notification: DocumentReaderNotification) {
137 | if (notification.notificationCode === Enum.eRFID_NotificationCodes.RFID_NOTIFICATION_PCSC_READING_DATAGROUP)
138 | this.setState({ rfidDescription: "ERFIDDataFileType: " + notification.dataFileType })
139 | this.setState({ rfidUIHeader: "Reading RFID", rfidUIHeaderColor: "black" })
140 | if (notification.progress != null)
141 | this.setState({ rfidProgress: notification.progress / 100 })
142 | if (Platform.OS === 'ios')
143 | DocumentReader.setRfidSessionStatus(this.state.rfidDescription + "\n" + notification.progress + "%", e => { }, e => { })
144 | }
145 |
146 | clearResults() {
147 | this.setState({ fullName: "Ready", docFront: require('./images/id.png'), portrait: require('./images/portrait.png') })
148 | }
149 |
150 | scan() {
151 | this.clearResults()
152 | var config = new ScannerConfig()
153 | config.scenario = this.state.selectedScenario
154 | DocumentReader.startScanner(config, _ => { }, e => console.log(e))
155 | }
156 |
157 | recognize() {
158 | launchImageLibrary({
159 | mediaType: 'photo',
160 | includeBase64: true,
161 | selectionLimit: 10
162 | }, r => {
163 | if (r.errorCode != null) {
164 | console.log("error code: " + r.errorCode)
165 | console.log("error message: " + r.errorMessage)
166 | this.setState({ fullName: r.errorMessage })
167 | return
168 | }
169 | if (r.didCancel) return
170 | this.clearResults()
171 | this.setState({ fullName: "COPYING IMAGE..." })
172 | var response = r.assets
173 |
174 | var images: any = []
175 |
176 | for (var i = 0; i < response!.length; i++) {
177 | images.push(response![i].base64!)
178 | }
179 | this.setState({ fullName: "PROCESSING..." })
180 |
181 | var config = new RecognizeConfig()
182 | config.scenario = this.state.selectedScenario
183 | config.images = images
184 | DocumentReader.recognize(config, _ => { }, e => console.log(e))
185 | })
186 | }
187 |
188 | displayResults(results: DocumentReaderResults) {
189 | if (results == null) return
190 |
191 | results.textFieldValueByType(Enum.eVisualFieldType.FT_SURNAME_AND_GIVEN_NAMES, (value: string | undefined) => {
192 | this.setState({ fullName: value })
193 | }, (error: string) => console.log(error))
194 |
195 | results.graphicFieldImageByType(Enum.eGraphicFieldType.GF_DOCUMENT_IMAGE, (value: string | undefined) => {
196 | if (value != null && value != "")
197 | this.setState({ docFront: { uri: "data:image/png;base64," + value } })
198 | }, (error: string) => console.log(error))
199 |
200 | results.graphicFieldImageByType(Enum.eGraphicFieldType.GF_PORTRAIT, (value: string | undefined) => {
201 | if (value != null && value != "")
202 | this.setState({ portrait: { uri: "data:image/png;base64," + value } })
203 | }, (error: string) => console.log(error))
204 |
205 | results.graphicFieldImageByTypeSource(Enum.eGraphicFieldType.GF_PORTRAIT, Enum.eRPRM_ResultType.RFID_RESULT_TYPE_RFID_IMAGE_DATA, (value: string | undefined) => {
206 | if (value != null && value != "")
207 | this.setState({ portrait: { uri: "data:image/png;base64," + value } })
208 | }, (error: string) => console.log(error))
209 | }
210 |
211 | customRFID() {
212 | this.showRfidUI()
213 | DocumentReader.readRFID(false, false, false, _ => { }, _ => { })
214 | }
215 |
216 | usualRFID() {
217 | isReadingRfid = true
218 | DocumentReader.startRFIDReader(false, false, false, _ => { }, _ => { })
219 | }
220 |
221 | handleResults(results: DocumentReaderResults) {
222 | if (this.state.doRfid && !isReadingRfid && results != null && results.chipPage != 0) {
223 | // this.customRFID()
224 | this.usualRFID()
225 | } else {
226 | isReadingRfid = false
227 | this.displayResults(results)
228 | }
229 | }
230 |
231 | render() {
232 | return (
233 |
234 | {!this.state.isReadingRfidCustomUi &&
235 | {this.state.fullName}
236 |
237 |
238 |
239 | Portrait
240 |
241 |
242 |
243 | Document image
244 |
245 |
246 |
247 |
248 |
249 | { this.setState({ selectedScenario: selectedID }) }}
253 | selectedId={this.state.selectedScenario}
254 | />
255 |
256 |
257 |
258 | {
263 | if (this.state.canRfid) {
264 | this.setState({ doRfid: !this.state.doRfid })
265 | }
266 | }} />
267 |
268 |
269 |
270 |
274 | }
275 |
276 | {(this.state.isReadingRfidCustomUi) &&
277 | {this.state.rfidUIHeader}
278 | {this.state.rfidDescription}
279 |
280 | { this.hideRfidUI() }}>
281 | X
282 |
283 | }
284 |
285 | )
286 | }
287 | }
288 |
289 | const styles = StyleSheet.create({
290 | container: {
291 | width: '100%',
292 | height: '100%',
293 | flex: 1,
294 | justifyContent: 'center',
295 | alignItems: 'center',
296 | backgroundColor: '#F5FCFF',
297 | marginBottom: 12,
298 | paddingTop: 15
299 | },
300 | cancelButton: {
301 | position: 'absolute',
302 | bottom: 0,
303 | right: 20
304 | },
305 | imageLabel: {
306 | top: 1,
307 | right: 1,
308 | padding: 5
309 | },
310 | title: {
311 | top: 1,
312 | left: 1,
313 | padding: 30,
314 | fontSize: 20
315 | }
316 | })
--------------------------------------------------------------------------------
/ios/RGLWJSONConstructor.h:
--------------------------------------------------------------------------------
1 | #ifndef RGLWJSONConstructor_h
2 | #define RGLWJSONConstructor_h
3 |
4 | #import
5 | #import "RGLWConfig.h"
6 |
7 | @import CoreGraphics;
8 | @import UIKit;
9 |
10 | @interface RGLWJSONConstructor : NSObject
11 |
12 | +(NSString* _Nullable)toSendable:(id _Nullable)input;
13 | +(NSString* _Nullable)dictToString:(NSDictionary* _Nullable)input;
14 | +(NSString* _Nullable)arrayToString:(NSArray* _Nullable)input;
15 | +(NSString* _Nullable)base64WithImage:(UIImage* _Nullable)input;
16 | +(UIImage* _Nullable)imageWithBase64:(NSString* _Nullable)input;
17 | +(NSData* _Nullable)base64Decode:(NSString* _Nullable)input;
18 |
19 | +(NSString* _Nonnull)generateSuccessCompletion:(BOOL)success :(NSError* _Nullable)error;
20 | +(NSString* _Nullable)generateCompletion:(NSNumber*_Nonnull)action :(RGLDocumentReaderResults*_Nullable)results :(NSError*_Nullable)error;
21 | +(NSString* _Nonnull)generatePACertificateCompletion:(NSData *_Nullable)serialNumber :(RGLPAResourcesIssuer *_Nullable)issuer;
22 | +(NSString* _Nullable)generateFinalizePackageCompletion:(NSNumber*_Nonnull)action :(RGLTransactionInfo*_Nullable)info :(NSError*_Nullable)error;
23 |
24 | +(RGLConfig* _Nullable)configFromJson:(NSDictionary* _Nullable)input;
25 | +(NSDictionary* _Nullable)generateConfig:(RGLConfig* _Nullable)input;
26 | +(RGLBleConfig* _Nullable)bleDeviceConfigFromJson:(NSDictionary* _Nullable)input :(RGLBluetooth* _Nonnull)bluetooth;
27 | +(RGLOnlineProcessingConfig* _Nullable)onlineProcessingConfigFromJson:(NSDictionary* _Nullable)input;
28 | +(NSDictionary* _Nullable)generateOnlineProcessingConfig:(RGLOnlineProcessingConfig* _Nullable)input;
29 | +(RGLImageInput* _Nullable)imageInputFromJson:(NSDictionary* _Nullable)input;
30 | +(NSDictionary* _Nullable)generateImageInput:(RGLImageInput* _Nullable)input;
31 | +(RGLRecognizeConfig* _Nullable)recognizeConfigFromJson:(NSDictionary* _Nullable)input;
32 | +(NSDictionary* _Nullable)generateRecognizeConfig:(RGLRecognizeConfig* _Nullable)input;
33 | +(RGLScannerConfig* _Nullable)scannerConfigFromJson:(NSDictionary* _Nullable)input;
34 | +(NSDictionary* _Nullable)generateScannerConfig:(RGLScannerConfig* _Nullable)input;
35 | +(RGLFaceAPISearchParams* _Nullable)faceAPISearchParamsFromJson:(NSDictionary* _Nullable)input;
36 | +(NSDictionary* _Nullable)generateFaceAPISearchParams:(RGLFaceAPISearchParams* _Nullable)input;
37 | +(RGLFaceAPIParams* _Nullable)faceAPIParamsFromJson:(NSDictionary* _Nullable)input;
38 | +(NSDictionary* _Nullable)generateFaceAPIParams:(RGLFaceAPIParams* _Nullable)input;
39 | +(RGLAuthenticityParams* _Nullable)authenticityParamsFromJson:(NSDictionary* _Nullable)input;
40 | +(NSDictionary* _Nullable)generateAuthenticityParams:(RGLAuthenticityParams* _Nullable)input;
41 | +(RGLLivenessParams* _Nullable)livenessParamsFromJson:(NSDictionary* _Nullable)input;
42 | +(NSDictionary* _Nullable)generateLivenessParams:(RGLLivenessParams* _Nullable)input;
43 | +(RGLGlaresCheckParams* _Nullable)glaresCheckParamsFromJson:(NSDictionary* _Nullable)input;
44 | +(NSDictionary* _Nullable)generateGlaresCheckParams:(RGLGlaresCheckParams* _Nullable)input;
45 | +(RGLImageQA* _Nullable)imageQAFromJson:(NSDictionary* _Nullable)input;
46 | +(NSDictionary* _Nullable)generateImageQA:(RGLImageQA* _Nullable)input;
47 | +(RGLRFIDParams* _Nullable)rfidParamsFromJson:(NSDictionary* _Nullable)input;
48 | +(NSDictionary* _Nullable)generateRFIDParams:(RGLRFIDParams* _Nullable)input;
49 | +(RGLProcessParams* _Nullable)processParamsFromJson:(NSDictionary* _Nullable)input;
50 | +(NSDictionary* _Nullable)generateProcessParams:(RGLProcessParams* _Nullable)input;
51 | +(RGLBackendProcessingConfig* _Nullable)backendProcessingConfigFromJson:(NSDictionary* _Nullable)input;
52 | +(NSDictionary* _Nullable)generateBackendProcessingConfig:(RGLBackendProcessingConfig* _Nullable)input;
53 | +(RGLeDLDataGroup* _Nullable)eDLDataGroupsFromJson:(NSDictionary* _Nullable)input;
54 | +(NSDictionary* _Nullable)generateEDLDataGroups:(RGLeDLDataGroup* _Nullable)input;
55 | +(RGLePassportDataGroup* _Nullable)ePassportDataGroupsFromJson:(NSDictionary* _Nullable)input;
56 | +(NSDictionary* _Nullable)generateEPassportDataGroups:(RGLePassportDataGroup* _Nullable)input;
57 | +(RGLeIDDataGroup* _Nullable)eIDDataGroupsFromJson:(NSDictionary* _Nullable)input;
58 | +(NSDictionary* _Nullable)generateEIDDataGroups:(RGLeIDDataGroup* _Nullable)input;
59 | +(RGLeIDDataGroup* _Nullable)dtcDataGroupFromJson:(NSDictionary* _Nullable)input;
60 | +(NSDictionary* _Nullable)generateRGLDTCDataGroup:(RGLeIDDataGroup* _Nullable)input;
61 | +(RGLRFIDScenario* _Nullable)rfidScenarioFromJson:(NSDictionary* _Nullable)input;
62 | +(NSDictionary* _Nullable)generateRFIDScenario:(RGLRFIDScenario* _Nullable)input;
63 | +(RGLCustomization* _Nullable)customizationFromJson:(NSDictionary* _Nullable)input;
64 | +(NSDictionary* _Nullable)generateCustomization:(RGLCustomization* _Nullable)input;
65 | +(RGLFunctionality* _Nullable)functionalityFromJson:(NSDictionary* _Nullable)input;
66 | +(NSDictionary* _Nullable)generateFunctionality:(RGLFunctionality* _Nullable)input;
67 | +(RGLDocReaderDocumentsDatabase* _Nullable)docReaderDocumentsDatabaseFromJson:(NSDictionary* _Nullable)input;
68 | +(NSDictionary* _Nullable)generateDocReaderDocumentsDatabase:(RGLDocReaderDocumentsDatabase* _Nullable)input;
69 | +(NSDictionary* _Nullable)generateDocReaderVersion:(RGLDocReaderVersion* _Nullable)input;
70 | +(RGLScenario* _Nullable)scenarioFromJson:(NSDictionary* _Nullable)input;
71 | +(NSDictionary* _Nonnull)generateScenario:(RGLScenario* _Nullable)input;
72 | +(NSString* _Nullable)generateLicense:(RGLLicense* _Nullable)input;
73 | +(NSError* _Nullable)errorFromJson:(NSDictionary* _Nullable)input;
74 | +(NSDictionary* _Nullable)generateError:(NSError* _Nullable)input;
75 | +(RGLAuthenticityElement* _Nullable)authenticityElementFromJson:(NSDictionary* _Nullable)input;
76 | +(NSDictionary* _Nullable)generateAuthenticityElement:(RGLAuthenticityElement* _Nullable)input;
77 | +(RGLAuthenticityCheck* _Nullable)authenticityCheckFromJson:(NSDictionary* _Nullable)input;
78 | +(NSDictionary* _Nullable)generateAuthenticityCheck:(RGLAuthenticityCheck* _Nullable)input;
79 | +(RGLDocumentReaderAuthenticityResult* _Nullable)documentReaderAuthenticityResultFromJson:(NSDictionary* _Nullable)input;
80 | +(NSDictionary* _Nullable)generateDocumentReaderAuthenticityResult:(RGLDocumentReaderAuthenticityResult* _Nullable)input;
81 | +(RGLPDF417Info* _Nullable)pdf417InfoFromJson:(NSDictionary* _Nullable)input;
82 | +(NSDictionary* _Nullable)generatePDF417Info:(RGLPDF417Info* _Nullable)input;
83 | +(RGLDocumentReaderBarcodeField* _Nullable)documentReaderBarcodeFieldFromJson:(NSDictionary* _Nullable)input;
84 | +(NSDictionary* _Nullable)generateDocumentReaderBarcodeField:(RGLDocumentReaderBarcodeField* _Nullable)input;
85 | +(RGLDocumentReaderBarcodeResult* _Nullable)documentReaderBarcodeResultFromJson:(NSDictionary* _Nullable)input;
86 | +(NSDictionary* _Nullable)generateDocumentReaderBarcodeResult:(RGLDocumentReaderBarcodeResult* _Nullable)input;
87 | +(RGLImageQuality* _Nullable)imageQualityFromJson:(NSDictionary* _Nullable)input;
88 | +(NSDictionary* _Nullable)generateImageQuality:(RGLImageQuality* _Nullable)input;
89 | +(RGLImageQualityGroup* _Nullable)imageQualityGroupFromJson:(NSDictionary* _Nullable)input;
90 | +(NSDictionary* _Nullable)generateImageQualityGroup:(RGLImageQualityGroup* _Nullable)input;
91 | +(RGLAccessControlProcedureType* _Nullable)accessControlProcedureTypeFromJson:(NSDictionary* _Nullable)input;
92 | +(NSDictionary* _Nullable)generateAccessControlProcedureType:(RGLAccessControlProcedureType* _Nullable)input;
93 | +(RGLFileData* _Nullable)fileDataFromJson:(NSDictionary* _Nullable)input;
94 | +(NSDictionary* _Nullable)generateFileData:(RGLFileData* _Nullable)input;
95 | +(RGLCertificateData* _Nullable)certificateDataFromJson:(NSDictionary* _Nullable)input;
96 | +(NSDictionary* _Nullable)generateCertificateData:(RGLCertificateData* _Nullable)input;
97 | +(RGLSecurityObjectCertificates* _Nullable)securityObjectCertificatesFromJson:(NSDictionary* _Nullable)input;
98 | +(NSDictionary* _Nullable)generateSecurityObjectCertificates:(RGLSecurityObjectCertificates* _Nullable)input;
99 | +(RGLFile* _Nullable)fileFromJson:(NSDictionary* _Nullable)input;
100 | +(NSDictionary* _Nullable)generateFile:(RGLFile* _Nullable)input;
101 | +(RGLApplication* _Nullable)applicationFromJson:(NSDictionary* _Nullable)input;
102 | +(NSDictionary* _Nullable)generateApplication:(RGLApplication* _Nullable)input;
103 | +(RGLRFIDValue* _Nullable)rfidValueFromJson:(NSDictionary* _Nullable)input;
104 | +(NSDictionary* _Nullable)generateRFIDValue:(RGLRFIDValue* _Nullable)input;
105 | +(RGLAttribute* _Nullable)attributeFromJson:(NSDictionary* _Nullable)input;
106 | +(NSDictionary* _Nullable)generateAttribute:(RGLAttribute* _Nullable)input;
107 | +(RGLAuthority* _Nullable)authorityFromJson:(NSDictionary* _Nullable)input;
108 | +(NSDictionary* _Nullable)generateAuthority:(RGLAuthority* _Nullable)input;
109 | +(RGLCardProperties* _Nullable)cardPropertiesFromJson:(NSDictionary* _Nullable)input;
110 | +(NSDictionary* _Nullable)generateCardProperties:(RGLCardProperties* _Nullable)input;
111 | +(RGLExtension* _Nullable)extensionFromJson:(NSDictionary* _Nullable)input;
112 | +(NSDictionary* _Nullable)generateExtension:(RGLExtension* _Nullable)input;
113 | +(RGLValidity* _Nullable)validityFromJson:(NSDictionary* _Nullable)input;
114 | +(NSDictionary* _Nullable)generateValidity:(RGLValidity* _Nullable)input;
115 | +(RGLCertificateChain* _Nullable)certificateChainFromJson:(NSDictionary* _Nullable)input;
116 | +(NSDictionary* _Nullable)generateCertificateChain:(RGLCertificateChain* _Nullable)input;
117 | +(RGLDataField* _Nullable)dataFieldFromJson:(NSDictionary* _Nullable)input;
118 | +(NSDictionary* _Nullable)generateDataField:(RGLDataField* _Nullable)input;
119 | +(RGLSignerInfo* _Nullable)signerInfoFromJson:(NSDictionary* _Nullable)input;
120 | +(NSDictionary* _Nullable)generateSignerInfo:(RGLSignerInfo* _Nullable)input;
121 | +(RGLSecurityObject* _Nullable)securityObjectFromJson:(NSDictionary* _Nullable)input;
122 | +(NSDictionary* _Nullable)generateSecurityObject:(RGLSecurityObject* _Nullable)input;
123 | +(RGLRFIDSessionData* _Nullable)rfidSessionDataFromJson:(NSDictionary* _Nullable)input;
124 | +(NSDictionary* _Nullable)generateRFIDSessionData:(RGLRFIDSessionData* _Nullable)input;
125 | +(RGLBytesData* _Nullable)bytesDataFromJson:(NSDictionary* _Nullable)input;
126 | +(NSDictionary* _Nullable)generateBytesData:(RGLBytesData* _Nullable)input;
127 | +(RGLVDSNCData* _Nullable)vdsncDataFromJson:(NSDictionary* _Nullable)input;
128 | +(NSDictionary* _Nullable)generateVDSNCData:(RGLVDSNCData* _Nullable)input;
129 | +(RGLOpticalStatus* _Nullable)opticalStatusFromJson:(NSDictionary* _Nullable)input;
130 | +(NSDictionary* _Nullable)generateOpticalStatus:(RGLOpticalStatus* _Nullable)input;
131 | +(RGLRFIDSessionDataStatus* _Nullable)rfidSessionDataStatusFromJson:(NSDictionary* _Nullable)input;
132 | +(NSDictionary* _Nullable)generateRFIDSessionDataStatus:(RGLRFIDSessionDataStatus* _Nullable)input;
133 | +(RGLDocumentReaderResultsStatus* _Nullable)documentReaderResultsStatusFromJson:(NSDictionary* _Nullable)input;
134 | +(NSDictionary* _Nullable)generateDocumentReaderResultsStatus:(RGLDocumentReaderResultsStatus* _Nullable)input;
135 | +(RGLDocumentReaderComparison* _Nullable)documentReaderComparisonFromJson:(NSDictionary* _Nullable)input;
136 | +(NSDictionary* _Nullable)generateDocumentReaderComparison:(RGLDocumentReaderComparison* _Nullable)input;
137 | +(CGRect)rectFromJson:(NSDictionary* _Nullable)input;
138 | +(NSDictionary* _Nullable)generateRect:(CGRect)input;
139 | +(RGLDocumentReaderGraphicField* _Nullable)documentReaderGraphicFieldFromJson:(NSDictionary* _Nullable)input;
140 | +(NSDictionary* _Nullable)generateDocumentReaderGraphicField:(RGLDocumentReaderGraphicField* _Nullable)input;
141 | +(RGLDocumentReaderGraphicResult* _Nullable)documentReaderGraphicResultFromJson:(NSDictionary* _Nullable)input;
142 | +(NSDictionary* _Nullable)generateDocumentReaderGraphicResult:(RGLDocumentReaderGraphicResult* _Nullable)input;
143 | +(RGLDocumentReaderRfidOrigin* _Nullable)documentReaderRfidOriginFromJson:(NSDictionary* _Nullable)input;
144 | +(NSDictionary* _Nullable)generateDocumentReaderRfidOrigin:(RGLDocumentReaderRfidOrigin* _Nullable)input;
145 | +(RGLDocumentReaderSymbol* _Nullable)documentReaderSymbolFromJson:(NSDictionary* _Nullable)input;
146 | +(NSDictionary* _Nullable)generateDocumentReaderSymbol:(RGLDocumentReaderSymbol* _Nullable)input;
147 | +(RGLDocumentReaderValidity* _Nullable)documentReaderValidityFromJson:(NSDictionary* _Nullable)input;
148 | +(NSDictionary* _Nullable)generateDocumentReaderValidity:(RGLDocumentReaderValidity* _Nullable)input;
149 | +(RGLDocumentReaderValue* _Nullable)documentReaderValueFromJson:(NSDictionary* _Nullable)input;
150 | +(NSDictionary* _Nullable)generateDocumentReaderValue:(RGLDocumentReaderValue* _Nullable)input;
151 | +(RGLDocumentReaderTextField* _Nullable)documentReaderTextFieldFromJson:(NSDictionary* _Nullable)input;
152 | +(NSDictionary* _Nullable)generateDocumentReaderTextField:(RGLDocumentReaderTextField* _Nullable)input;
153 | +(RGLDocumentReaderTextSource* _Nullable)documentReaderTextSourceFromJson:(NSDictionary* _Nullable)input;
154 | +(NSDictionary* _Nullable)generateDocumentReaderTextSource:(RGLDocumentReaderTextSource* _Nullable)input;
155 | +(RGLDocumentReaderTextResult* _Nullable)documentReaderTextResultFromJson:(NSDictionary* _Nullable)input;
156 | +(NSDictionary* _Nullable)generateDocumentReaderTextResult:(RGLDocumentReaderTextResult* _Nullable)input;
157 | +(RGLDocumentReaderDocumentType* _Nullable)documentReaderDocumentTypeFromJson:(NSDictionary* _Nullable)input;
158 | +(NSDictionary* _Nullable)generateDocumentReaderDocumentType:(RGLDocumentReaderDocumentType* _Nullable)input;
159 | +(CGPoint)pointFromJson:(NSDictionary* _Nullable)input;
160 | +(NSDictionary* _Nullable)generatePoint:(CGPoint)input;
161 | +(RGLPosition* _Nullable)positionFromJson:(NSDictionary* _Nullable)input;
162 | +(NSDictionary* _Nullable)generatePosition:(RGLPosition* _Nullable)input;
163 | +(RGLDocumentReaderResults* _Nullable)documentReaderResultsFromJson:(NSDictionary* _Nullable)input;
164 | +(NSDictionary* _Nullable)generateDocumentReaderResults:(RGLDocumentReaderResults* _Nullable)input;
165 | +(NSString* _Nonnull)generateDocumentReaderNotification:(RGLRFIDNotify* _Nullable)input;
166 | +(RGLPAAttribute* _Nullable)paAttributeFromJson:(NSDictionary* _Nullable)input;
167 | +(NSDictionary* _Nullable)generatePAAttribute:(RGLPAAttribute* _Nullable)input;
168 | +(RGLPAResourcesIssuer* _Nullable)paResourcesIssuerFromJson:(NSDictionary* _Nullable)input;
169 | +(NSDictionary* _Nullable)generatePAResourcesIssuer:(RGLPAResourcesIssuer* _Nullable)input;
170 | +(RGLPKDCertificate* _Nullable)pkdCertificateFromJson:(NSDictionary* _Nullable)input;
171 | +(NSDictionary* _Nullable)generatePKDCertificate:(RGLPKDCertificate* _Nullable)input;
172 | +(NSDictionary* _Nullable)generateTAChallenge:(RGLTAChallenge* _Nullable)input;
173 | +(RGLTAChallenge* _Nullable)taChallengeFromJson:(NSDictionary* _Nullable)input;
174 | +(RGLTCCParams* _Nullable)tccParamsFromJson:(NSDictionary* _Nullable)input;
175 | +(NSDictionary* _Nullable)generateTCCParams:(RGLTCCParams* _Nullable)input;
176 | +(RGLTransactionInfo* _Nullable)transactionInfoFromJson:(NSDictionary* _Nullable)input;
177 | +(NSDictionary* _Nullable)generateTransactionInfo:(RGLTransactionInfo* _Nullable)input;
178 |
179 | @end
180 |
181 | @interface RGLWRequestInterceptorProxy : NSObject
182 | - (instancetype _Nonnull)initWithHeaders:(NSDictionary*_Nonnull)headers;
183 | @end
184 |
185 | #endif
186 |
--------------------------------------------------------------------------------
/android/src/main/java/com/regula/plugin/documentreader/Main.kt:
--------------------------------------------------------------------------------
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()
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 | "getLocale" -> getLocale(callback)
59 | "setLocale" -> setLocale(argsNullable(0))
60 | "getFunctionality" -> getFunctionality(callback)
61 | "setFunctionality" -> setFunctionality(args(0))
62 | "getProcessParams" -> getProcessParams(callback)
63 | "setProcessParams" -> setProcessParams(args(0))
64 | "getCustomization" -> getCustomization(callback)
65 | "setCustomization" -> setCustomization(args(0))
66 | "getRfidScenario" -> getRfidScenario(callback)
67 | "setRfidScenario" -> setRfidScenario(args(0))
68 | "resetConfiguration" -> resetConfiguration()
69 | "initialize" -> initialize(callback, args(0))
70 | "initializeReader" -> initialize(callback, args(0)) // deprecated
71 | "initializeReaderWithBleDeviceConfig" -> initializeReaderWithBleDeviceConfig(callback, args(0)) // deprecated
72 | "deinitialize" -> deinitialize()
73 | "prepareDatabase" -> prepareDatabase(callback, args(0))
74 | "removeDatabase" -> removeDatabase(callback)
75 | "runAutoUpdate" -> runAutoUpdate(callback, args(0))
76 | "cancelDBUpdate" -> cancelDBUpdate(callback)
77 | "checkDatabaseUpdate" -> checkDatabaseUpdate(callback, args(0))
78 | "scan" -> scan(args(0))
79 | "startScanner" -> startScanner(args(0))
80 | "recognize" -> recognize(args(0))
81 | "startNewPage" -> startNewPage()
82 | "stopScanner" -> stopScanner()
83 | "startRFIDReader" -> startRFIDReader(args(0), args(1), args(2))
84 | "readRFID" -> readRFID(args(0), args(1), args(2))
85 | "stopRFIDReader" -> stopRFIDReader()
86 | "providePACertificates" -> providePACertificates(argsNullable(0))
87 | "provideTACertificates" -> provideTACertificates(argsNullable(0))
88 | "provideTASignature" -> provideTASignature(args(0))
89 | "setTCCParams" -> setTCCParams(callback, args(0))
90 | "addPKDCertificates" -> addPKDCertificates(args(0))
91 | "clearPKDCertificates" -> clearPKDCertificates()
92 | "startNewSession" -> startNewSession()
93 | "connectBluetoothDevice" -> connectBluetoothDevice(args(0), callback)
94 | "btDeviceRequestFlashing" -> btDeviceRequestFlashing()
95 | "btDeviceRequestFlashingFullIR" -> btDeviceRequestFlashingFullIR()
96 | "btDeviceRequestTurnOffAll" -> btDeviceRequestTurnOffAll()
97 | "setLocalizationDictionary" -> setLocalizationDictionary(args(0))
98 | "getLicense" -> getLicense(callback)
99 | "getAvailableScenarios" -> getAvailableScenarios(callback)
100 | "getIsRFIDAvailableForUse" -> getIsRFIDAvailableForUse(callback)
101 | "isAuthenticatorAvailableForUse" -> isAuthenticatorAvailableForUse(callback)
102 | "isAuthenticatorRFIDAvailableForUse" -> isAuthenticatorRFIDAvailableForUse(callback)
103 | "getDocReaderVersion" -> getDocReaderVersion(callback)
104 | "getDocReaderDocumentsDatabase" -> getDocReaderDocumentsDatabase(callback)
105 | "textFieldValueByType" -> textFieldValueByType(callback, args(0), args(1))
106 | "textFieldValueByTypeLcid" -> textFieldValueByTypeLcid(callback, args(0), args(1), args(2))
107 | "textFieldValueByTypeSource" -> textFieldValueByTypeSource(callback, args(0), args(1), args(2))
108 | "textFieldValueByTypeLcidSource" -> textFieldValueByTypeLcidSource(callback, args(0), args(1), args(2), args(3))
109 | "textFieldValueByTypeSourceOriginal" -> textFieldValueByTypeSourceOriginal(callback, args(0), args(1), args(2), args(3))
110 | "textFieldValueByTypeLcidSourceOriginal" -> textFieldValueByTypeLcidSourceOriginal(callback, args(0), args(1), args(2), args(3), args(4))
111 | "textFieldByType" -> textFieldByType(callback, args(0), args(1))
112 | "textFieldByTypeLcid" -> textFieldByTypeLcid(callback, args(0), args(1), args(2))
113 | "graphicFieldByTypeSource" -> graphicFieldByTypeSource(callback, args(0), args(1), args(2))
114 | "graphicFieldByTypeSourcePageIndex" -> graphicFieldByTypeSourcePageIndex(callback, args(0), args(1), args(2), args(3))
115 | "graphicFieldByTypeSourcePageIndexLight" -> graphicFieldByTypeSourcePageIndexLight(callback, args(0), args(1), args(2), args(3), args(4))
116 | "graphicFieldImageByType" -> graphicFieldImageByType(callback, args(0), args(1))
117 | "graphicFieldImageByTypeSource" -> graphicFieldImageByTypeSource(callback, args(0), args(1), args(2))
118 | "graphicFieldImageByTypeSourcePageIndex" -> graphicFieldImageByTypeSourcePageIndex(callback, args(0), args(1), args(2), args(3))
119 | "graphicFieldImageByTypeSourcePageIndexLight" -> graphicFieldImageByTypeSourcePageIndexLight(callback, args(0), args(1), args(2), args(3), args(4))
120 | "containers" -> containers(callback, args(0), args(1))
121 | "encryptedContainers" -> encryptedContainers(callback, args(0))
122 | "finalizePackage" -> finalizePackage(callback)
123 | "endBackendTransaction" -> endBackendTransaction()
124 | "getTranslation" -> getTranslation(callback, args(0), args(1))
125 | else -> Unit
126 | }
127 |
128 | inline fun args(index: Int) = argsNullable(index)!!
129 | typealias Callback = (Any?) -> Unit
130 |
131 | const val completionEvent = "completion"
132 | const val databaseProgressEvent = "database_progress"
133 |
134 | const val rfidOnProgressEvent = "rfidOnProgressCompletion"
135 | const val rfidOnChipDetectedEvent = "rfidOnChipDetectedEvent"
136 | const val rfidOnRetryReadChipEvent = "rfidOnRetryReadChipEvent"
137 |
138 | const val paCertificateCompletionEvent = "pa_certificate_completion"
139 | const val taCertificateCompletionEvent = "ta_certificate_completion"
140 | const val taSignatureCompletionEvent = "ta_signature_completion"
141 |
142 | const val videoEncoderCompletionEvent = "video_encoder_completion"
143 | const val onCustomButtonTappedEvent = "onCustomButtonTappedEvent"
144 |
145 | fun getDocumentReaderIsReady(callback: Callback) = callback(Instance().isReady)
146 |
147 | fun getDocumentReaderStatus(callback: Callback) = callback(Instance().status)
148 |
149 | fun getRfidSessionStatus(iosOnly: Callback) = iosOnly(null)
150 |
151 | fun setRfidSessionStatus() = Unit
152 |
153 | fun getTag(callback: Callback) = callback(Instance().tag)
154 |
155 | fun setTag(tag: String?) = tag.let { Instance().tag = it }
156 |
157 | fun getTenant(callback: Callback) = callback(Instance().tenant)
158 |
159 | fun setTenant(tag: String?) = tag.let { Instance().tenant = it }
160 |
161 | fun getEnv(callback: Callback) = callback(Instance().env)
162 |
163 | fun setEnv(tag: String?) = tag.let { Instance().env = it }
164 |
165 | fun getLocale(callback: Callback) = callback(Instance().locale)
166 |
167 | fun setLocale(locale: String?) = locale.let { Instance().locale = it }
168 |
169 | fun getFunctionality(callback: Callback) = callback(getFunctionality(Instance().functionality()))
170 |
171 | fun setFunctionality(functionality: JSONObject) = setFunctionality(Instance().functionality(), functionality)
172 |
173 | fun getProcessParams(callback: Callback) = callback(getProcessParams(Instance().processParams()))
174 |
175 | fun setProcessParams(processParams: JSONObject) = setProcessParams(Instance().processParams(), processParams)
176 |
177 | fun getCustomization(callback: Callback) = callback(getCustomization(Instance().customization()))
178 |
179 | fun setCustomization(customization: JSONObject) = setCustomization(Instance().customization(), customization)
180 |
181 | fun getRfidScenario(callback: Callback) = callback(getRfidScenario(Instance().rfidScenario()))
182 |
183 | fun setRfidScenario(rfidScenario: JSONObject) = setRfidScenario(Instance().rfidScenario(), rfidScenario)
184 |
185 | fun resetConfiguration() = Instance().resetConfiguration()
186 |
187 | fun initialize(callback: Callback, config: JSONObject) =
188 | if (config.getBooleanOrNull("useBleDevice") != true)
189 | Instance().initializeReader(context, initConfigFromJSON(config), initCompletion(callback))
190 | else
191 | Instance().initializeReader(context, initBleDeviceConfigFromJSON(config), initCompletion(callback))
192 |
193 | // deprecated
194 | fun initializeReaderWithBleDeviceConfig(callback: Callback, config: JSONObject) = Instance().initializeReader(context, initBleDeviceConfigFromJSON(config), initCompletion(callback))
195 |
196 | fun deinitialize() = Instance().deinitializeReader()
197 |
198 | fun prepareDatabase(callback: Callback, databaseID: String) = Instance().prepareDatabase(
199 | context,
200 | databaseID,
201 | prepareCompletion(callback)
202 | )
203 |
204 | fun removeDatabase(callback: Callback) = callback(Instance().removeDatabase(context))
205 |
206 | fun runAutoUpdate(callback: Callback, databaseID: String) = Instance().runAutoUpdate(
207 | context,
208 | databaseID,
209 | prepareCompletion(callback)
210 | )
211 |
212 | fun cancelDBUpdate(callback: Callback) = callback(Instance().cancelDBUpdate(context))
213 |
214 | fun checkDatabaseUpdate(callback: Callback, databaseID: String) = Instance().checkDatabaseUpdate(
215 | context,
216 | databaseID
217 | ) { callback(generateDocReaderDocumentsDatabase(it)) }
218 |
219 | @Suppress("DEPRECATION")
220 | fun scan(config: JSONObject) {
221 | stopBackgroundRFID()
222 | Instance().showScanner(context, scannerConfigFromJSON(config), IDocumentReaderCompletion(completion))
223 | }
224 |
225 | fun startScanner(config: JSONObject) {
226 | stopBackgroundRFID()
227 | Instance().startScanner(context, scannerConfigFromJSON(config), IDocumentReaderCompletion(completion))
228 | }
229 |
230 | fun recognize(config: JSONObject) {
231 | stopBackgroundRFID()
232 | Instance().recognize(recognizeConfigFromJSON(config), IDocumentReaderCompletion(completion))
233 | }
234 |
235 | fun startNewPage() = Instance().startNewPage()
236 |
237 | fun stopScanner() = Instance().stopScanner(context)
238 |
239 | fun startRFIDReader(onRequestPACertificates: Boolean, onRequestTACertificates: Boolean, onRequestTASignature: Boolean) {
240 | stopBackgroundRFID()
241 | requestType = RfidReaderRequestType(
242 | onRequestPACertificates,
243 | onRequestTACertificates,
244 | onRequestTASignature
245 | )
246 | Instance().startRFIDReader(context, rfidReaderCompletion, requestType.getRfidReaderRequest())
247 | }
248 |
249 | fun readRFID(onRequestPACertificates: Boolean, onRequestTACertificates: Boolean, onRequestTASignature: Boolean) {
250 | requestType = RfidReaderRequestType(
251 | onRequestPACertificates,
252 | onRequestTACertificates,
253 | onRequestTASignature
254 | )
255 | startForegroundDispatch()
256 | }
257 |
258 | fun stopRFIDReader() {
259 | Instance().stopRFIDReader(context)
260 | stopBackgroundRFID()
261 | }
262 |
263 | fun providePACertificates(certificates: JSONArray?) = paCertificateCompletion.onCertificatesReceived(
264 | certificates.toArray(::pkdCertificateFromJSON)
265 | )
266 |
267 | fun provideTACertificates(certificates: JSONArray?) = taCertificateCompletion.onCertificatesReceived(
268 | certificates.toArray(::pkdCertificateFromJSON)
269 | )
270 |
271 | fun provideTASignature(signature: String?) = taSignatureCompletion.onSignatureReceived(
272 | signature.toByteArray()
273 | )
274 |
275 | fun setTCCParams(callback: Callback, params: JSONObject) {
276 | Instance().setTccParams(tccParamsFromJSON(params)) { success, error ->
277 | callback(generateSuccessCompletion(success, error))
278 | }
279 | }
280 |
281 | fun addPKDCertificates(certificates: JSONArray) = Instance().addPKDCertificates(
282 | certificates.toList(::pkdCertificateFromJSON)!!
283 | )
284 |
285 | fun clearPKDCertificates() = Instance().clearPKDCertificates()
286 |
287 | fun startNewSession() = Instance().startNewSession()
288 |
289 | fun setLocalizationDictionary(dictionary: JSONObject) {
290 | localizationCallbacks = LocalizationCallbacks { if (dictionary.has(it)) dictionary.getString(it) else null }
291 | Instance().setLocalizationCallback(localizationCallbacks)
292 | }
293 |
294 | fun getLicense(callback: Callback) = callback(generateLicense(Instance().license()))
295 |
296 | fun getAvailableScenarios(callback: Callback) {
297 | val scenarios: MutableList = ArrayList()
298 | for (scenario: DocumentReaderScenario in Instance().availableScenarios)
299 | scenarios.add(CoreScenarioUtil.getScenario(scenario.name))
300 | callback(scenarios.toJsonNullable(::generateDocumentReaderScenario))
301 | }
302 |
303 | fun getIsRFIDAvailableForUse(callback: Callback) = callback(Instance().isRFIDAvailableForUse)
304 |
305 | fun isAuthenticatorAvailableForUse(callback: Callback) = callback(Instance().isAuthenticatorAvailableForUse)
306 |
307 | fun isAuthenticatorRFIDAvailableForUse(callback: Callback) = callback(Instance().isAuthenticatorRFIDAvailableForUse)
308 |
309 | fun getDocReaderVersion(callback: Callback) = callback(generateDocReaderVersion(Instance().version))
310 |
311 | fun getDocReaderDocumentsDatabase(callback: Callback) = callback(Instance().version?.let {
312 | generateDocReaderDocumentsDatabase(it.database)
313 | })
314 |
315 | fun finalizePackage(callback: Callback) = Instance().finalizePackage { action, info, error ->
316 | callback(generateFinalizePackageCompletion(action, info, error))
317 | }
318 |
319 | fun endBackendTransaction() = Instance().endBackendTransaction()
320 |
321 | fun textFieldValueByType(
322 | callback: Callback,
323 | raw: String,
324 | fieldType: Int
325 | ) = callback(fromRawResults(raw).getTextFieldValueByType(fieldType))
326 |
327 | fun textFieldValueByTypeLcid(
328 | callback: Callback,
329 | raw: String,
330 | fieldType: Int,
331 | lcid: Int
332 | ) = callback(fromRawResults(raw).getTextFieldValueByType(fieldType, lcid))
333 |
334 | fun textFieldValueByTypeSource(
335 | callback: Callback,
336 | raw: String,
337 | fieldType: Int,
338 | source: Int
339 | ) = callback(fromRawResults(raw).getTextFieldValueByTypeAndSource(fieldType, source))
340 |
341 | fun textFieldValueByTypeLcidSource(
342 | callback: Callback,
343 | raw: String,
344 | fieldType: Int,
345 | lcid: Int,
346 | source: Int
347 | ) = callback(fromRawResults(raw).getTextFieldValueByType(fieldType, lcid, source))
348 |
349 | fun textFieldValueByTypeSourceOriginal(
350 | callback: Callback,
351 | raw: String,
352 | fieldType: Int,
353 | source: Int,
354 | original: Boolean
355 | ) = callback(fromRawResults(raw).getTextFieldValueByTypeAndSource(fieldType, source, original))
356 |
357 | fun textFieldValueByTypeLcidSourceOriginal(
358 | callback: Callback,
359 | raw: String,
360 | fieldType: Int,
361 | lcid: Int,
362 | source: Int,
363 | original: Boolean
364 | ) = callback(fromRawResults(raw).getTextFieldValueByType(fieldType, lcid, source, original))
365 |
366 | fun textFieldByType(
367 | callback: Callback,
368 | raw: String,
369 | fieldType: Int
370 | ) = callback(generateDocumentReaderTextField(fromRawResults(raw).getTextFieldByType(fieldType)))
371 |
372 | fun textFieldByTypeLcid(
373 | callback: Callback,
374 | raw: String,
375 | fieldType: Int,
376 | lcid: Int
377 | ) = callback(generateDocumentReaderTextField(fromRawResults(raw).getTextFieldByType(fieldType, lcid)))
378 |
379 | fun graphicFieldByTypeSource(
380 | callback: Callback,
381 | raw: String,
382 | fieldType: Int,
383 | source: Int
384 | ) = callback(generateDocumentReaderGraphicField(fromRawResults(raw).getGraphicFieldByType(fieldType, source)))
385 |
386 | fun graphicFieldByTypeSourcePageIndex(
387 | callback: Callback,
388 | raw: String,
389 | fieldType: Int,
390 | source: Int,
391 | pageIndex: Int
392 | ) = callback(generateDocumentReaderGraphicField(fromRawResults(raw).getGraphicFieldByType(fieldType, source, pageIndex)))
393 |
394 | fun graphicFieldByTypeSourcePageIndexLight(
395 | callback: Callback,
396 | raw: String,
397 | fieldType: Int,
398 | source: Int,
399 | pageIndex: Int,
400 | light: Int
401 | ) = callback(generateDocumentReaderGraphicField(fromRawResults(raw).getGraphicFieldByType(fieldType, source, pageIndex, light)))
402 |
403 | fun graphicFieldImageByType(
404 | callback: Callback,
405 | raw: String,
406 | fieldType: Int
407 | ) = callback(fromRawResults(raw).getGraphicFieldImageByType(fieldType).toBase64())
408 |
409 | fun graphicFieldImageByTypeSource(
410 | callback: Callback,
411 | raw: String,
412 | fieldType: Int,
413 | source: Int
414 | ) = callback(fromRawResults(raw).getGraphicFieldImageByType(fieldType, source).toBase64())
415 |
416 | fun graphicFieldImageByTypeSourcePageIndex(
417 | callback: Callback,
418 | raw: String,
419 | fieldType: Int,
420 | source: Int,
421 | pageIndex: Int
422 | ) = callback(fromRawResults(raw).getGraphicFieldImageByType(fieldType, source, pageIndex).toBase64())
423 |
424 | fun graphicFieldImageByTypeSourcePageIndexLight(
425 | callback: Callback,
426 | raw: String,
427 | fieldType: Int,
428 | source: Int,
429 | pageIndex: Int,
430 | light: Int
431 | ) = callback(fromRawResults(raw).getGraphicFieldImageByType(fieldType, source, pageIndex, light).toBase64())
432 |
433 | fun containers(
434 | callback: Callback,
435 | raw: String,
436 | resultType: JSONArray
437 | ) = callback(fromRawResults(raw).getContainers(resultType.toIntArray()!!))
438 |
439 | fun encryptedContainers(
440 | callback: Callback,
441 | raw: String
442 | ) = callback(fromRawResults(raw).encryptedContainers)
443 |
444 | fun getTranslation(callback: Callback, className: String, value: Int) = when (className) {
445 | "RFIDErrorCodes" -> callback(eRFID_ErrorCodes.getTranslation(context, value))
446 | "LDSParsingErrorCodes" -> callback(eLDS_ParsingErrorCodes.getTranslation(context, value))
447 | "LDSParsingNotificationCodes" -> callback(eLDS_ParsingNotificationCodes.getTranslation(context, value))
448 | "ImageQualityCheckType" -> callback(eImageQualityCheckType.getTranslation(context, value))
449 | "RFIDDataFileType" -> callback(eRFID_DataFile_Type.getTranslation(context, value))
450 | "VisualFieldType" -> callback(eVisualFieldType.getTranslation(context, value))
451 | "LCID" -> callback(LCID.getTranslation(context, value))
452 | else -> Unit
453 | }
454 |
455 | // --------------------------------------------------------------------------------------------------------------------------
456 |
457 | val completion = { action: Int, results: DocumentReaderResults?, error: DocumentReaderException? ->
458 | sendEvent(completionEvent, generateCompletion(action, results, error))
459 | if ((action == DocReaderAction.ERROR) ||
460 | (action == DocReaderAction.CANCEL) ||
461 | ((action == DocReaderAction.COMPLETE) && (results?.rfidResult == 1))
462 | ) stopBackgroundRFID()
463 | }
464 |
465 | val rfidReaderCompletion = object : IRfidReaderCompletion() {
466 | override fun onCompleted(action: Int, results: DocumentReaderResults?, error: DocumentReaderException?): Unit = completion(action, results, error)
467 | override fun onChipDetected(): Unit = sendEvent(rfidOnChipDetectedEvent)
468 | override fun onRetryReadChip(error: DocReaderRfidException) = sendEvent(rfidOnRetryReadChipEvent, generateRegulaException(error))
469 | override fun onProgress(notification: DocumentReaderNotification) = sendEvent(rfidOnProgressEvent, generateDocumentReaderNotification(notification))
470 | }
471 |
472 | fun prepareCompletion(callback: Callback) = object : IDocumentReaderPrepareDbCompletion() {
473 | override fun onPrepareProgressChanged(progress: PrepareProgress) = sendEvent(databaseProgressEvent, generatePrepareProgress(progress))
474 | override fun onPrepareCompleted(success: Boolean, error: DocumentReaderException?) = callback(generateSuccessCompletion(success, error))
475 | }
476 |
477 | fun initCompletion(callback: Callback) = IDocumentReaderInitCompletion { success, error ->
478 | if (success) {
479 | Instance().setVideoEncoderCompletion { _, file -> sendEvent(videoEncoderCompletionEvent, file.path) }
480 | Instance().setOnClickListener { sendEvent(onCustomButtonTappedEvent, it.tag) }
481 | }
482 | callback(generateSuccessCompletion(success, error))
483 | }
484 |
485 | lateinit var paCertificateCompletion: IRfidPKDCertificateCompletion
486 | lateinit var taCertificateCompletion: IRfidPKDCertificateCompletion
487 | lateinit var taSignatureCompletion: IRfidTASignatureCompletion
488 |
489 | class RfidReaderRequestType(
490 | val doPACertificates: Boolean,
491 | val doTACertificates: Boolean,
492 | val doTASignature: Boolean
493 | ) {
494 | private val onRequestPACertificates = IRfidPACertificates { serialNumber, issuer, completion ->
495 | paCertificateCompletion = completion
496 | sendEvent(paCertificateCompletionEvent, generatePACertificateCompletion(serialNumber, issuer))
497 | }
498 | private val onRequestTACertificates = IRfidTACertificates { keyCAR, completion ->
499 | taCertificateCompletion = completion
500 | sendEvent(taCertificateCompletionEvent, keyCAR)
501 | }
502 | private val onRequestTASignature = IRfidTASignature { challenge, completion ->
503 | taSignatureCompletion = completion
504 | sendEvent(taSignatureCompletionEvent, generateTAChallenge(challenge))
505 | }
506 |
507 | fun getRfidReaderRequest(): IRfidReaderRequest? = when {
508 | !doPACertificates && !doTACertificates && doTASignature -> IRfidReaderRequest(onRequestTASignature)
509 | !doPACertificates && doTACertificates && !doTASignature -> IRfidReaderRequest(onRequestTACertificates)
510 | !doPACertificates && doTACertificates && doTASignature -> IRfidReaderRequest(onRequestTACertificates, onRequestTASignature)
511 | doPACertificates && !doTACertificates && !doTASignature -> IRfidReaderRequest(onRequestPACertificates)
512 | doPACertificates && !doTACertificates && doTASignature -> IRfidReaderRequest(onRequestPACertificates, onRequestTASignature)
513 | doPACertificates && doTACertificates && !doTASignature -> IRfidReaderRequest(onRequestPACertificates, onRequestTACertificates)
514 | doPACertificates && doTACertificates && doTASignature -> IRfidReaderRequest(onRequestPACertificates, onRequestTACertificates, onRequestTASignature)
515 | else -> null
516 | }
517 | }
518 |
519 | var requestType = RfidReaderRequestType(
520 | doPACertificates = false,
521 | doTACertificates = false,
522 | doTASignature = false
523 | )
524 |
525 | @Suppress("DEPRECATION", "MissingPermission")
526 | fun newIntent(intent: Intent): Boolean {
527 | if (intent.action != NfcAdapter.ACTION_TECH_DISCOVERED) return false
528 | Instance().readRFID(
529 | IsoDep.get(intent.getParcelableExtra(NfcAdapter.EXTRA_TAG)),
530 | rfidReaderCompletion,
531 | requestType.getRfidReaderRequest()
532 | )
533 | return true
534 | }
535 |
536 | var backgroundRFIDEnabled = false
537 | lateinit var lifecycleObserver: LifecycleEventObserver
538 |
539 | fun startForegroundDispatch() {
540 | backgroundRFIDEnabled = true
541 | val filters: Array = arrayOfNulls(1)
542 | filters[0] = IntentFilter()
543 | filters[0]!!.addAction(NfcAdapter.ACTION_TECH_DISCOVERED)
544 | filters[0]!!.addCategory(Intent.CATEGORY_DEFAULT)
545 | val techList = arrayOf(arrayOf("android.nfc.tech.IsoDep"))
546 | val intent = Intent(activity, activity.javaClass)
547 | val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
548 | val pendingIntent = PendingIntent.getActivity(activity, 0, intent, flag)
549 |
550 | if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
551 | enableForegroundDispatch(pendingIntent, filters, techList)
552 | lifecycleObserver = LifecycleEventObserver { _, event ->
553 | if (backgroundRFIDEnabled) when (event) {
554 | Lifecycle.Event.ON_RESUME -> enableForegroundDispatch(pendingIntent, filters, techList)
555 | Lifecycle.Event.ON_PAUSE -> disableForegroundDispatch()
556 | else -> Unit
557 | }
558 | }
559 | activity.runOnUiThread { lifecycle.addObserver(lifecycleObserver) }
560 | }
561 |
562 | fun enableForegroundDispatch(
563 | pendingIntent: PendingIntent,
564 | filters: Array,
565 | techList: Array>
566 | ) = NfcAdapter.getDefaultAdapter(context).enableForegroundDispatch(activity, pendingIntent, filters, techList)
567 |
568 | fun disableForegroundDispatch() = NfcAdapter.getDefaultAdapter(activity).disableForegroundDispatch(activity)
569 |
570 | fun stopBackgroundRFID() {
571 | if (!backgroundRFIDEnabled) return
572 | backgroundRFIDEnabled = false
573 | if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED))
574 | disableForegroundDispatch()
575 | activity.runOnUiThread { lifecycle.removeObserver(lifecycleObserver) }
576 | }
577 |
578 | // Weak references
579 | lateinit var localizationCallbacks: LocalizationCallbacks
580 |
--------------------------------------------------------------------------------
/ios/RGLWMain.m:
--------------------------------------------------------------------------------
1 | #import "RGLWMain.h"
2 |
3 | @implementation RGLWMain
4 |
5 | +(void)methodCall:(NSString*)method :(NSArray*)args :(RGLWCallback)callback :(RGLWEventSender)eventSender {
6 | if(!this) this = [RGLWMain new];
7 | sendEvent = eventSender;
8 | NSDictionary* Switch = @{
9 | @"getDocumentReaderIsReady": ^{ [self getDocumentReaderIsReady :callback]; },
10 | @"getDocumentReaderStatus": ^{ [self getDocumentReaderStatus :callback]; },
11 | @"getRfidSessionStatus": ^{ [self getRfidSessionStatus :callback]; },
12 | @"setRfidSessionStatus": ^{ [self setRfidSessionStatus :args[0]]; },
13 | @"getTag": ^{ [self getTag :callback]; },
14 | @"setTag": ^{ [self setTag :args[0]]; },
15 | @"getTenant": ^{ [self getTenant :callback]; },
16 | @"setTenant": ^{ [self setTenant :args[0]]; },
17 | @"getEnv": ^{ [self getEnv :callback]; },
18 | @"setEnv": ^{ [self setEnv :args[0]]; },
19 | @"getLocale": ^{ [self getLocale :callback]; },
20 | @"setLocale": ^{ [self setLocale :args[0]]; },
21 | @"getFunctionality": ^{ [self getFunctionality :callback]; },
22 | @"setFunctionality": ^{ [self setFunctionality :args[0]]; },
23 | @"getProcessParams": ^{ [self getProcessParams :callback]; },
24 | @"setProcessParams": ^{ [self setProcessParams :args[0]]; },
25 | @"getCustomization": ^{ [self getCustomization :callback]; },
26 | @"setCustomization": ^{ [self setCustomization :args[0]]; },
27 | @"getRfidScenario": ^{ [self getRfidScenario :callback]; },
28 | @"setRfidScenario": ^{ [self setRfidScenario :args[0]]; },
29 | @"resetConfiguration": ^{ [self resetConfiguration]; },
30 | @"initialize": ^{ [self initialize :args[0] :callback]; },
31 | @"initializeReader": ^{ [self initialize :args[0] :callback]; }, // deprecated
32 | @"initializeReaderWithBleDeviceConfig": ^{ [self initializeReaderWithBleDeviceConfig :args[0] :callback]; }, // deprecated
33 | @"deinitializeReader": ^{ [self deinitializeReader]; },
34 | @"prepareDatabase": ^{ [self prepareDatabase :args[0] :callback]; },
35 | @"removeDatabase": ^{ [self removeDatabase :callback]; },
36 | @"runAutoUpdate": ^{ [self runAutoUpdate :args[0] :callback]; },
37 | @"cancelDBUpdate": ^{ [self cancelDBUpdate :callback]; },
38 | @"checkDatabaseUpdate": ^{ [self checkDatabaseUpdate :args[0] :callback]; },
39 | @"scan": ^{ [self scan :args[0]]; },
40 | @"startScanner": ^{ [self startScanner :args[0]]; },
41 | @"recognize": ^{ [self recognize :args[0]]; },
42 | @"startNewPage": ^{ [self startNewPage]; },
43 | @"stopScanner": ^{ [self stopScanner]; },
44 | @"startRFIDReader": ^{ [self startRFIDReader :args[0] :args[1] :args[2]]; },
45 | @"readRFID": ^{ [self readRFID :args[0] :args[1] :args[2]]; },
46 | @"stopRFIDReader": ^{ [self stopRFIDReader]; },
47 | @"providePACertificates": ^{ [self providePACertificates :args[0]]; },
48 | @"provideTACertificates": ^{ [self provideTACertificates :args[0]]; },
49 | @"provideTASignature": ^{ [self provideTASignature :args[0]]; },
50 | @"setTCCParams": ^{ [self setTCCParams :args[0] :callback]; },
51 | @"addPKDCertificates": ^{ [self addPKDCertificates :args[0]]; },
52 | @"clearPKDCertificates": ^{ [self clearPKDCertificates]; },
53 | @"startNewSession": ^{ [self startNewSession]; },
54 | @"connectBluetoothDevice": ^{ [self connectBluetoothDevice :args[0] :callback]; },
55 | @"btDeviceRequestFlashing": ^{ /* android only */ },
56 | @"btDeviceRequestFlashingFullIR": ^{ /* android only */ },
57 | @"btDeviceRequestTurnOffAll": ^{ /* android only */ },
58 | @"setLocalizationDictionary": ^{ [self setLocalizationDictionary :args[0]]; },
59 | @"getLicense": ^{ [self getLicense :callback]; },
60 | @"getAvailableScenarios": ^{ [self getAvailableScenarios :callback]; },
61 | @"getIsRFIDAvailableForUse": ^{ [self getIsRFIDAvailableForUse :callback]; },
62 | @"isAuthenticatorRFIDAvailableForUse": ^{ [self isAuthenticatorRFIDAvailableForUse :callback]; },
63 | @"isAuthenticatorAvailableForUse": ^{ [self isAuthenticatorAvailableForUse :callback]; },
64 | @"getDocReaderVersion": ^{ [self getDocReaderVersion :callback]; },
65 | @"getDocReaderDocumentsDatabase": ^{ [self getDocReaderDocumentsDatabase :callback]; },
66 | @"finalizePackage": ^{ [self finalizePackage :callback]; },
67 | @"endBackendTransaction": ^{ [self endBackendTransaction]; },
68 | @"textFieldValueByType": ^{ [self textFieldValueByType :args[0] :args[1] :callback]; },
69 | @"textFieldValueByTypeLcid": ^{ [self textFieldValueByTypeLcid :args[0] :args[1] :args[2] :callback]; },
70 | @"textFieldValueByTypeSource": ^{ [self textFieldValueByTypeSource :args[0] :args[1] :args[2] :callback]; },
71 | @"textFieldValueByTypeLcidSource": ^{ [self textFieldValueByTypeLcidSource :args[0] :args[1] :args[2] :args[3] :callback]; },
72 | @"textFieldValueByTypeSourceOriginal": ^{ [self textFieldValueByTypeSourceOriginal :args[0] :args[1] :args[2] :args[3] :callback]; },
73 | @"textFieldValueByTypeLcidSourceOriginal": ^{ [self textFieldValueByTypeLcidSourceOriginal :args[0] :args[1] :args[2] :args[3] :args[4] :callback]; },
74 | @"textFieldByType": ^{ [self textFieldByType :args[0] :args[1] :callback]; },
75 | @"textFieldByTypeLcid": ^{ [self textFieldByTypeLcid :args[0] :args[1] :args[2] :callback]; },
76 | @"graphicFieldByTypeSource": ^{ [self graphicFieldByTypeSource :args[0] :args[1] :args[2] :callback]; },
77 | @"graphicFieldByTypeSourcePageIndex": ^{ [self graphicFieldByTypeSourcePageIndex :args[0] :args[1] :args[2] :args[3] :callback]; },
78 | @"graphicFieldByTypeSourcePageIndexLight": ^{ [self graphicFieldByTypeSourcePageIndexLight :args[0] :args[1] :args[2] :args[3] :args[4] :callback]; },
79 | @"graphicFieldImageByType": ^{ [self graphicFieldImageByType :args[0] :args[1] :callback]; },
80 | @"graphicFieldImageByTypeSource": ^{ [self graphicFieldImageByTypeSource :args[0] :args[1] :args[2] :callback]; },
81 | @"graphicFieldImageByTypeSourcePageIndex": ^{ [self graphicFieldImageByTypeSourcePageIndex :args[0] :args[1] :args[2] :args[3] :callback]; },
82 | @"graphicFieldImageByTypeSourcePageIndexLight": ^{ [self graphicFieldImageByTypeSourcePageIndexLight :args[0] :args[1] :args[2] :args[3] :args[4] :callback]; },
83 | @"containers": ^{ [self containers :args[0] :args[1] :callback]; },
84 | @"encryptedContainers": ^{ [self encryptedContainers :args[0] :callback]; },
85 | @"getTranslation": ^{ [self getTranslation :args[0] :args[1] :callback]; },
86 | };
87 | ((void(^)(void))Switch[method])();
88 | }
89 |
90 | static RGLWMain* this;
91 | static RGLWEventSender sendEvent;
92 | static NSDictionary* headers;
93 |
94 | +(void)getDocumentReaderIsReady:(RGLWCallback)callback {
95 | callback([RGLDocReader.shared isDocumentReaderIsReady] ? @YES : @NO);
96 | }
97 |
98 | +(void)getDocumentReaderStatus:(RGLWCallback)callback {
99 | callback(RGLDocReader.shared.documentReaderStatus);
100 | }
101 |
102 | +(void)getRfidSessionStatus:(RGLWCallback)callback {
103 | callback(RGLDocReader.shared.rfidSessionStatus);
104 | }
105 |
106 | +(void)setRfidSessionStatus:(NSString*)status {
107 | RGLDocReader.shared.rfidSessionStatus = status;
108 | }
109 |
110 | +(void)getTag:(RGLWCallback)callback {
111 | callback([RGLDocReader.shared tag]);
112 | }
113 |
114 | +(void)setTag:(NSString*)tag {
115 | [RGLDocReader.shared setTag:tag];
116 | }
117 |
118 | +(void)getTenant:(RGLWCallback)callback {
119 | callback([RGLDocReader.shared tenant]);
120 | }
121 |
122 | +(void)setTenant:(NSString*)tag {
123 | [RGLDocReader.shared setTenant:tag];
124 | }
125 |
126 | +(void)getEnv:(RGLWCallback)callback {
127 | callback([RGLDocReader.shared env]);
128 | }
129 |
130 | +(void)setEnv:(NSString*)tag {
131 | [RGLDocReader.shared setEnv:tag];
132 | }
133 |
134 | +(void)getLocale:(RGLWCallback)callback {
135 | callback([RGLDocReader.shared languageLocaleCode]);
136 | }
137 |
138 | +(void)setLocale:(NSString*)locale {
139 | [RGLDocReader.shared setLanguageLocaleCode:locale];
140 | }
141 |
142 | +(void)getFunctionality:(RGLWCallback)callback {
143 | callback([RGLWJSONConstructor dictToString: [RGLWConfig getFunctionality: RGLDocReader.shared.functionality]]);
144 | }
145 |
146 | +(void)setFunctionality:(NSDictionary*)functionality {
147 | [RGLWConfig setFunctionality:functionality :RGLDocReader.shared.functionality];
148 | }
149 |
150 | +(void)getProcessParams:(RGLWCallback)callback {
151 | callback([RGLWJSONConstructor dictToString: [RGLWConfig getProcessParams:RGLDocReader.shared.processParams]]);
152 | }
153 |
154 | +(void)setProcessParams:(NSDictionary*)processParams {
155 | [RGLWConfig setProcessParams:processParams :RGLDocReader.shared.processParams];
156 | }
157 |
158 | +(void)getCustomization:(RGLWCallback)callback {
159 | callback([RGLWJSONConstructor dictToString: [RGLWConfig getCustomization :RGLDocReader.shared.customization]]);
160 | }
161 |
162 | +(void)setCustomization:(NSDictionary*)customization {
163 | [RGLWConfig setCustomization:customization :RGLDocReader.shared.customization];
164 | }
165 |
166 | +(void)getRfidScenario:(RGLWCallback)callback {
167 | callback([RGLWJSONConstructor dictToString: [RGLWConfig getRfidScenario:RGLDocReader.shared.rfidScenario]]);
168 | }
169 |
170 | +(void)setRfidScenario:(NSDictionary*)rfidScenario {
171 | [RGLWConfig setRfidScenario:rfidScenario :RGLDocReader.shared.rfidScenario];
172 | }
173 |
174 | +(void)resetConfiguration {
175 | RGLDocReader.shared.functionality = [RGLFunctionality new];
176 | RGLDocReader.shared.processParams = [RGLProcessParams new];
177 | RGLDocReader.shared.customization = [RGLCustomization new];
178 | RGLDocReader.shared.rfidScenario = [RGLRFIDScenario new];
179 | }
180 |
181 | +(void)initialize:(NSDictionary*)config :(RGLWCallback)callback {
182 | if (config[@"useBleDevice"] && [config[@"useBleDevice"] boolValue] == true)
183 | [RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor bleDeviceConfigFromJson:config :bluetooth] completion: [self initCompletion :callback]];
184 | else
185 | [RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor configFromJson:config] completion:[self initCompletion :callback]];
186 | }
187 |
188 | // deprecated
189 | +(void)initializeReaderWithBleDeviceConfig:(NSDictionary*)config :(RGLWCallback)callback {
190 | [RGLDocReader.shared initializeReaderWithConfig:[RGLWJSONConstructor bleDeviceConfigFromJson:config :bluetooth] completion: [self initCompletion :callback]];
191 | }
192 |
193 | +(void)deinitializeReader {
194 | [RGLDocReader.shared deinitializeReader];
195 | }
196 |
197 | +(void)prepareDatabase:(NSString*)databaseID :(RGLWCallback)callback {
198 | [RGLDocReader.shared prepareDatabase:databaseID progressHandler:nil completion:[self prepareCompletion :callback]];
199 | }
200 |
201 | +(void)removeDatabase:(RGLWCallback)callback {
202 | [RGLDocReader.shared removeDatabase:^(BOOL success, NSError * _Nullable error) {
203 | callback(success ? @YES : @NO);
204 | }];
205 | }
206 |
207 | +(void)runAutoUpdate:(NSString*)databaseID :(RGLWCallback)callback {
208 | [RGLDocReader.shared runAutoUpdate:databaseID progressHandler:nil completion:[self prepareCompletion :callback]];
209 | }
210 |
211 | +(void)cancelDBUpdate:(RGLWCallback)callback {
212 | [RGLDocReader.shared cancelDBUpdate];
213 | callback(@YES);
214 | }
215 |
216 | +(void)checkDatabaseUpdate:(NSString*)databaseID :(RGLWCallback)callback {
217 | [RGLDocReader.shared checkDatabaseUpdate:databaseID completion:^(RGLDocReaderDocumentsDatabase* database) {
218 | callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocReaderDocumentsDatabase:database]]);
219 | }];
220 | }
221 |
222 | +(void)scan:(NSDictionary*)config {
223 | dispatch_async(dispatch_get_main_queue(), ^{
224 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
225 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
226 | #pragma clang diagnostic pop
227 | [RGLDocReader.shared showScannerFromPresenter:RGLWRootViewController() config:[RGLWJSONConstructor scannerConfigFromJson:config] completion:[self completion]];
228 | });
229 | }
230 |
231 | +(void)startScanner:(NSDictionary*)config {
232 | dispatch_async(dispatch_get_main_queue(), ^{
233 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
234 | [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
235 | #pragma clang diagnostic pop
236 | [RGLDocReader.shared startScannerFromPresenter:RGLWRootViewController() config:[RGLWJSONConstructor scannerConfigFromJson:config] completion:[self completion]];
237 | });
238 | }
239 |
240 | +(void)recognize:(NSDictionary*)config {
241 | dispatch_async(dispatch_get_main_queue(), ^{
242 | [RGLDocReader.shared recognizeImageFromPresenter:RGLWRootViewController() config:[RGLWJSONConstructor recognizeConfigFromJson:config] completion:[self completion]];
243 | });
244 | }
245 |
246 | +(void)startNewPage {
247 | [RGLDocReader.shared startNewPage];
248 | }
249 |
250 | +(void)stopScanner {
251 | dispatch_async(dispatch_get_main_queue(), ^{
252 | [RGLDocReader.shared stopScanner:nil];
253 | });
254 | }
255 |
256 | +(void)startRFIDReader:(NSNumber*)paCert :(NSNumber*)taCert :(NSNumber*)taSig {
257 | this.doRequestPACertificates = paCert;
258 | this.doRequestTACertificates = taCert;
259 | this.doRequestTASignature = taSig;
260 | dispatch_async(dispatch_get_main_queue(), ^{
261 | [RGLDocReader.shared startRFIDReaderFromPresenter:RGLWRootViewController() completion:[self completion]];
262 | });
263 | }
264 |
265 | +(void)readRFID:(NSNumber*)paCert :(NSNumber*)taCert :(NSNumber*)taSig {
266 | this.doRequestPACertificates = paCert;
267 | this.doRequestTACertificates = taCert;
268 | this.doRequestTASignature = taSig;
269 | [RGLDocReader.shared readRFID:^(RGLRFIDNotificationAction notificationAction, RGLRFIDNotify* _Nullable notification) {
270 | if (notification != nil) sendEvent(rfidOnProgressEvent, [RGLWJSONConstructor generateDocumentReaderNotification:notification]);
271 | } completion :^(RGLRFIDCompleteAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error, RGLRFIDErrorCodes errorCode) {
272 | sendEvent(completionEvent, [RGLWJSONConstructor generateCompletion:[RGLWConfig generateRFIDCompleteAction: action] :results :error]);
273 | }];
274 | }
275 |
276 | +(void)stopRFIDReader {
277 | [RGLDocReader.shared stopRFIDReader:nil];
278 | }
279 |
280 | +(void)providePACertificates:(NSArray*)certificates {
281 | NSMutableArray *certificatesMutable = [NSMutableArray new];
282 | for(NSDictionary* certificateJSON in certificates)
283 | [certificatesMutable addObject:[RGLWJSONConstructor pkdCertificateFromJson:certificateJSON]];
284 | paCertificateCompletion(certificatesMutable);
285 | }
286 |
287 | +(void)provideTACertificates:(NSArray*)certificates {
288 | NSMutableArray *certificatesMutable = [NSMutableArray new];
289 | for(NSDictionary* certificateJSON in certificates)
290 | [certificatesMutable addObject:[RGLWJSONConstructor pkdCertificateFromJson:certificateJSON]];
291 | taCertificateCompletion(certificatesMutable);
292 | }
293 |
294 | +(void)provideTASignature:(NSString*)signature {
295 | taSignatureCompletion([RGLWJSONConstructor base64Decode:signature]);
296 | }
297 |
298 | +(void)setTCCParams:(NSDictionary*)params :(RGLWCallback)callback {
299 | [RGLDocReader.shared setTCCParams:[RGLWJSONConstructor tccParamsFromJson:params] completion:^(BOOL success, NSError * _Nullable error) {
300 | callback([RGLWJSONConstructor generateSuccessCompletion:success :error]);
301 | }];
302 | }
303 |
304 | +(void)addPKDCertificates:(NSArray*)certificates {
305 | NSMutableArray *certificatesMutable = [NSMutableArray new];
306 | for(NSDictionary* certificateJSON in certificates)
307 | [certificatesMutable addObject:[RGLWJSONConstructor pkdCertificateFromJson:certificateJSON]];
308 | [RGLDocReader.shared addPKDCertificates:certificatesMutable];
309 | }
310 |
311 | +(void)clearPKDCertificates {
312 | [RGLDocReader.shared clearPKDCertificates];
313 | }
314 |
315 | +(void)startNewSession {
316 | [RGLDocReader.shared startNewSession];
317 | }
318 |
319 | RGLBluetooth* bluetooth;
320 | RGLWCallback savedCallbackForBluetoothResult;
321 |
322 | +(void)connectBluetoothDevice:(NSString*)deviceName :(RGLWCallback)callback {
323 | // return if already connected
324 | if (bluetooth && bluetooth.state == RGLBluetoothConnectionStateConnected) return;
325 |
326 | // start searching devices
327 | if (!bluetooth) {
328 | bluetooth = [RGLBluetooth new];
329 | bluetooth.delegate = this;
330 | }
331 | savedCallbackForBluetoothResult = callback;
332 | [bluetooth connectWithDeviceName:deviceName];
333 | }
334 |
335 | // RGLBluetoothDelegate
336 | - (void)didChangeConnectionState:(RGLBluetooth *)bluetooth state:(RGLBluetoothConnectionState)state {
337 | if (state == RGLBluetoothConnectionStateNone && savedCallbackForBluetoothResult)
338 | [RGLWMain bluetoothDeviceConnectionFailed];
339 |
340 | // set searching timeout
341 | if (state == RGLBluetoothConnectionStateSearching)
342 | [[self class] performSelector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") withObject:nil afterDelay:7.0];
343 |
344 | if (state == RGLBluetoothConnectionStateConnected) {
345 | savedCallbackForBluetoothResult(@YES);
346 | savedCallbackForBluetoothResult = nil;
347 | [NSObject cancelPreviousPerformRequestsWithTarget:[self class] selector:NSSelectorFromString(@"bluetoothDeviceConnectionFailed") object:nil];
348 | }
349 | }
350 |
351 | +(void)bluetoothDeviceConnectionFailed {
352 | if (savedCallbackForBluetoothResult) {
353 | savedCallbackForBluetoothResult(@NO);
354 | savedCallbackForBluetoothResult = nil;
355 | }
356 | [bluetooth stopSearchDevices];
357 | [bluetooth disconnect];
358 | }
359 |
360 | +(void)setLocalizationDictionary:(NSDictionary*)dictionary {
361 | RGLDocReader.shared.localizationHandler = ^NSString * _Nullable(NSString * _Nonnull localizationKey) {
362 | if(dictionary != nil && ![dictionary isEqual:[NSNull null]] && [dictionary valueForKey:localizationKey] != nil)
363 | return [dictionary valueForKey:localizationKey];
364 | return nil;
365 | };
366 | }
367 |
368 | +(void)getLicense :(RGLWCallback)callback {
369 | callback([RGLWJSONConstructor generateLicense:RGLDocReader.shared.license]);
370 | }
371 |
372 | +(void)getAvailableScenarios :(RGLWCallback)callback {
373 | NSMutableArray *availableScenarios = [NSMutableArray new];
374 | for(RGLScenario *scenario in RGLDocReader.shared.availableScenarios)
375 | [availableScenarios addObject:[RGLWJSONConstructor generateScenario:scenario]];
376 | callback([RGLWJSONConstructor arrayToString:availableScenarios]);
377 | }
378 |
379 | +(void)getIsRFIDAvailableForUse :(RGLWCallback)callback {
380 | callback(RGLDocReader.shared.isRFIDAvailableForUse ? @YES : @NO);
381 | }
382 |
383 | +(void)getDocReaderVersion :(RGLWCallback)callback {
384 | callback([RGLWJSONConstructor generateDocReaderVersion:RGLDocReader.shared.version]);
385 | }
386 |
387 | +(void)isAuthenticatorRFIDAvailableForUse :(RGLWCallback)callback {
388 | callback(RGLDocReader.shared.isAuthenticatorRFIDAvailableForUse ? @YES : @NO);
389 | }
390 |
391 | +(void)isAuthenticatorAvailableForUse :(RGLWCallback)callback {
392 | callback(RGLDocReader.shared.isAuthenticatorAvailableForUse ? @YES : @NO);
393 | }
394 |
395 | +(void)getDocReaderDocumentsDatabase :(RGLWCallback)callback {
396 | if(RGLDocReader.shared.version != nil)
397 | callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocReaderDocumentsDatabase:RGLDocReader.shared.version.database]]);
398 | else callback(nil);
399 | }
400 |
401 | +(void)finalizePackage:(RGLWCallback)callback {
402 | [RGLDocReader.shared finalizePackageWithCompletion:^(RGLDocReaderAction action, RGLTransactionInfo* info, NSError* error) {
403 | callback([RGLWJSONConstructor generateFinalizePackageCompletion:[RGLWConfig generateDocReaderAction: action] :info :error]);
404 | }];
405 | }
406 |
407 | +(void)endBackendTransaction {
408 | [RGLDocReader.shared endBackendTransaction];
409 | }
410 |
411 | +(void)textFieldValueByType:(NSString*)rawResult :(NSNumber*)fieldType :(RGLWCallback)callback {
412 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
413 | callback([results getTextFieldValueByType:[fieldType integerValue]]);
414 | }
415 |
416 | +(void)textFieldValueByTypeLcid:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)lcid :(RGLWCallback)callback {
417 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
418 | callback([results getTextFieldValueByType:[fieldType integerValue] lcid:[lcid integerValue]]);
419 | }
420 |
421 | +(void)textFieldValueByTypeSource:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(RGLWCallback)callback {
422 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
423 | callback([results getTextFieldValueByType:[fieldType integerValue] source:[source integerValue]]);
424 | }
425 |
426 | +(void)textFieldValueByTypeLcidSource:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)lcid :(NSNumber*)source :(RGLWCallback)callback {
427 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
428 | callback([results getTextFieldValueByType:[fieldType integerValue] lcid:[lcid integerValue] source:[source integerValue]]);
429 | }
430 |
431 | +(void)textFieldValueByTypeSourceOriginal:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(BOOL)original :(RGLWCallback)callback {
432 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
433 | callback([results getTextFieldValueByType:[fieldType integerValue] source:[source integerValue] original:original]);
434 | }
435 |
436 | +(void)textFieldValueByTypeLcidSourceOriginal:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)lcid :(NSNumber*)source :(BOOL)original :(RGLWCallback)callback {
437 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
438 | callback([results getTextFieldValueByType:[fieldType integerValue] lcid:[lcid integerValue] source:[source integerValue] original:original]);
439 | }
440 |
441 | +(void)textFieldByType:(NSString*)rawResult :(NSNumber*)fieldType :(RGLWCallback)callback {
442 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
443 | RGLDocumentReaderTextField* result = [results getTextFieldByType:[fieldType integerValue]];
444 | if (result == nil) callback(nil);
445 | callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderTextField:result]]);
446 | }
447 |
448 | +(void)textFieldByTypeLcid:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)lcid :(RGLWCallback)callback {
449 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
450 | RGLDocumentReaderTextField* result = [results getTextFieldByType:[fieldType integerValue] lcid:[lcid integerValue]];
451 | if (result == nil) callback(nil);
452 | callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderTextField:result]]);
453 | }
454 |
455 | +(void)graphicFieldByTypeSource:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(RGLWCallback)callback {
456 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
457 | RGLDocumentReaderGraphicField* result = [results getGraphicFieldByType:[fieldType integerValue] source:[source integerValue]];
458 | if (result == nil) callback(nil);
459 | callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderGraphicField:result]]);
460 | }
461 |
462 | +(void)graphicFieldByTypeSourcePageIndex:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(NSNumber*)pageIndex :(RGLWCallback)callback {
463 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
464 | RGLDocumentReaderGraphicField* result = [results getGraphicFieldByType:[fieldType integerValue] source:[source integerValue] pageIndex:[pageIndex integerValue]];
465 | if (result == nil) callback(nil);
466 | callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderGraphicField:result]]);
467 | }
468 |
469 | +(void)graphicFieldByTypeSourcePageIndexLight:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(NSNumber*)pageIndex :(NSNumber*)light :(RGLWCallback)callback {
470 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
471 | RGLDocumentReaderGraphicField* result = [results getGraphicFieldByType:[fieldType integerValue] source:[source integerValue] pageIndex:[pageIndex integerValue] light:[light integerValue]];
472 | if (result == nil) callback(nil);
473 | callback([RGLWJSONConstructor dictToString:[RGLWJSONConstructor generateDocumentReaderGraphicField:result]]);
474 | }
475 |
476 | +(void)graphicFieldImageByType:(NSString*)rawResult :(NSNumber*)fieldType :(RGLWCallback)callback {
477 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
478 | callback([RGLWJSONConstructor base64WithImage:[results getGraphicFieldImageByType:[fieldType integerValue]]]);
479 | }
480 |
481 | +(void)graphicFieldImageByTypeSource:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(RGLWCallback)callback {
482 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
483 | callback([RGLWJSONConstructor base64WithImage:[results getGraphicFieldImageByType:[fieldType integerValue] source:[source integerValue]]]);
484 | }
485 |
486 | +(void)graphicFieldImageByTypeSourcePageIndex:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(NSNumber*)pageIndex :(RGLWCallback)callback {
487 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
488 | callback([RGLWJSONConstructor base64WithImage:[results getGraphicFieldImageByType:[fieldType integerValue] source:[source integerValue] pageIndex:[pageIndex integerValue]]]);
489 | }
490 |
491 | +(void)graphicFieldImageByTypeSourcePageIndexLight:(NSString*)rawResult :(NSNumber*)fieldType :(NSNumber*)source :(NSNumber*)pageIndex :(NSNumber*)light :(RGLWCallback)callback {
492 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
493 | callback([RGLWJSONConstructor base64WithImage:[results getGraphicFieldImageByType:[fieldType integerValue] source:[source integerValue] pageIndex:[pageIndex integerValue] light:[light integerValue]]]);
494 | }
495 |
496 | +(void)containers:(NSString*)rawResult :(NSArray*)resultType :(RGLWCallback)callback {
497 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
498 | callback([results getContainersByResultTypes:resultType]);
499 | }
500 |
501 | +(void)encryptedContainers:(NSString*)rawResult :(RGLWCallback)callback {
502 | RGLDocumentReaderResults* results = [RGLDocumentReaderResults initWithRawString:rawResult];
503 | callback([results getEncryptedContainers]);
504 | }
505 |
506 | +(void)getTranslation:(NSString*)className :(NSNumber*)value :(RGLWCallback)callback {
507 | if([className isEqualToString:@"RFIDErrorCodes"])
508 | callback(RGLRFIDErrorCodesGetStringValue([value intValue]));
509 | else if([className isEqualToString:@"LDSParsingErrorCodes"])
510 | callback(eLDS_ParsingErrorCodesGetStringValue([value intValue]));
511 | else if([className isEqualToString:@"LDSParsingNotificationCodes"])
512 | callback(eLDS_ParsingNotificationCodesGetStringValue([value intValue]));
513 | else if([className isEqualToString:@"ImageQualityCheckType"])
514 | callback(RGLImageQualityCheckTypeGetStringValue([RGLWConfig imageQualityCheckTypeWithNumber:value]));
515 | else if([className isEqualToString:@"RFIDDataFileType"])
516 | callback(RGLRFIDDataFileTypeGetStringValue([value intValue]));
517 | else if([className isEqualToString:@"VisualFieldType"])
518 | callback(RGLFieldTypeGetStringValue([value intValue]));
519 | else if([className isEqualToString:@"LCID"])
520 | callback([RGLDocumentReaderTextField lcidName:[value intValue]]);
521 | }
522 |
523 | +(RGLDocumentReaderCompletion _Nonnull)completion {
524 | return ^(RGLDocReaderAction action, RGLDocumentReaderResults * _Nullable results, NSError * _Nullable error) {
525 | sendEvent(completionEvent, [RGLWJSONConstructor generateCompletion:[RGLWConfig generateDocReaderAction: action] :results :error]);
526 | };
527 | }
528 |
529 | +(RGLDocumentReaderPrepareCompletion _Nonnull)prepareCompletion:(RGLWCallback)callback {
530 | RGLDocReader.shared.databaseFetchDelegate = this;
531 | return ^(BOOL success, NSError * _Nullable error) {
532 | callback([RGLWJSONConstructor generateSuccessCompletion:success :error]);
533 | };
534 | }
535 |
536 | +(RGLDocumentReaderInitializationCompletion)initCompletion:(RGLWCallback)callback {
537 | return ^(BOOL success, NSError * _Nullable error ) {
538 | if (success) {
539 | RGLDocReader.shared.rfidDelegate = this;
540 | RGLDocReader.shared.functionality.recordScanningProcessDelegate = this;
541 | RGLDocReader.shared.customization.actionDelegate = this;
542 | }
543 | callback([RGLWJSONConstructor generateSuccessCompletion:success :error]);
544 | };
545 | }
546 |
547 | // RGLDocReaderDatabaseFetchDelegate
548 | - (void)onProgressChanged:(NSNumber *)downloadedBytes totalBytes:(NSNumber *)totalBytes {
549 | int progress = 0;
550 | if (downloadedBytes > 0 && totalBytes > 0) {
551 | double percent = [downloadedBytes doubleValue] / [totalBytes doubleValue];
552 | progress = (int) (percent * 100);
553 | }
554 | NSDictionary* result = @{
555 | @"downloadedBytes":downloadedBytes,
556 | @"totalBytes":totalBytes,
557 | @"progress":@(progress)
558 | };
559 | sendEvent(databaseProgressEvent, [RGLWJSONConstructor dictToString: result]);
560 | }
561 |
562 | // RGLCustomizationActionDelegate
563 | - (void)onCustomButtonTappedWithTag:(NSInteger)tag {
564 | sendEvent(drOnCustomButtonTappedEvent, @(tag));
565 | }
566 |
567 | // RGLRecordScanningProcessDelegate
568 | - (void)didFinishRecordingToFile:(NSURL *)fileURL {
569 | sendEvent(drVideoEncoderCompletionEvent, fileURL.absoluteString);
570 | }
571 |
572 | - (void)didFailWithError:(NSError *)error {
573 | // ignore error to match android
574 | }
575 |
576 | RGLRFIDCertificatesCallback paCertificateCompletion;
577 | RGLRFIDCertificatesCallback taCertificateCompletion;
578 | RGLWRFIDSignatureCallback taSignatureCompletion;
579 |
580 | - (void)onRequestPACertificatesWithSerial:(NSData *)serialNumber issuer:(RGLPAResourcesIssuer *)issuer callback:(RGLRFIDCertificatesCallback)callback {
581 | if([self.doRequestPACertificates boolValue]) {
582 | paCertificateCompletion = callback;
583 | sendEvent(paCertificateCompletionEvent, [RGLWJSONConstructor generatePACertificateCompletion:serialNumber :issuer]);
584 | } else {
585 | paCertificateCompletion = nil;
586 | callback(nil);
587 | }
588 | }
589 |
590 | - (void)onRequestTACertificatesWithKey:(NSString *)keyCAR callback:(RGLRFIDCertificatesCallback)callback {
591 | if([self.doRequestTACertificates boolValue]) {
592 | taCertificateCompletion = callback;
593 | sendEvent(taCertificateCompletionEvent, keyCAR);
594 | } else {
595 | taCertificateCompletion = nil;
596 | callback(nil);
597 | }
598 | }
599 |
600 | - (void)onRequestTASignatureWithChallenge:(RGLTAChallenge *)challenge callback:(void(^)(NSData *signature))callback {
601 | if([self.doRequestTASignature boolValue]) {
602 | taSignatureCompletion = callback;
603 | sendEvent(taSignatureCompletionEvent, [RGLWJSONConstructor dictToString: [RGLWJSONConstructor generateTAChallenge:challenge]]);
604 | } else {
605 | taSignatureCompletion = nil;
606 | callback(nil);
607 | }
608 | }
609 |
610 | - (void)didChipConnected {
611 | sendEvent(rfidOnChipDetectedEvent, @"");
612 | }
613 |
614 | - (void)didReceivedError:(RGLRFIDErrorCodes)errorCode {
615 | NSMutableDictionary *result = [NSMutableDictionary new];
616 | result[@"code"] = [NSNumber numberWithInteger:errorCode];
617 | sendEvent(rfidOnRetryReadChipEvent, [RGLWJSONConstructor dictToString:result]);
618 | }
619 |
620 | @end
621 |
--------------------------------------------------------------------------------
/example/ios/DocumentReader.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 54;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 00E356F31AD99517003FC87E /* DocumentReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* DocumentReaderTests.m */; };
11 | 0C80B921A6F3F58F76C31292 /* libPods-DocumentReader.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-DocumentReader.a */; };
12 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
14 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
15 | 34A6AF2E2B862E4E00266440 /* db.dat in Resources */ = {isa = PBXBuildFile; fileRef = 34A6AF2D2B862E4E00266440 /* db.dat */; };
16 | 34B2241A2B61327D009FDA33 /* regula.license in Resources */ = {isa = PBXBuildFile; fileRef = 34B224192B61327D009FDA33 /* regula.license */; };
17 | 7699B88040F8A987B510C191 /* libPods-DocumentReader-DocumentReaderTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-DocumentReader-DocumentReaderTests.a */; };
18 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
19 | 970CEEFE26CC4F5086D8C455 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 0B138461659C02ED353D3184 /* PrivacyInfo.xcprivacy */; };
20 | /* End PBXBuildFile section */
21 |
22 | /* Begin PBXContainerItemProxy section */
23 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
24 | isa = PBXContainerItemProxy;
25 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
26 | proxyType = 1;
27 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
28 | remoteInfo = DocumentReader;
29 | };
30 | /* End PBXContainerItemProxy section */
31 |
32 | /* Begin PBXFileReference section */
33 | 00E356EE1AD99517003FC87E /* DocumentReaderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DocumentReaderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
34 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
35 | 00E356F21AD99517003FC87E /* DocumentReaderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DocumentReaderTests.m; sourceTree = ""; };
36 | 0B138461659C02ED353D3184 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = DocumentReader/PrivacyInfo.xcprivacy; sourceTree = ""; };
37 | 13B07F961A680F5B00A75B9A /* DocumentReader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DocumentReader.app; sourceTree = BUILT_PRODUCTS_DIR; };
38 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = DocumentReader/AppDelegate.h; sourceTree = ""; };
39 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = DocumentReader/AppDelegate.mm; sourceTree = ""; };
40 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = DocumentReader/Images.xcassets; sourceTree = ""; };
41 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = DocumentReader/Info.plist; sourceTree = ""; };
42 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = DocumentReader/main.m; sourceTree = ""; };
43 | 19F6CBCC0A4E27FBF8BF4A61 /* libPods-DocumentReader-DocumentReaderTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-DocumentReader-DocumentReaderTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
44 | 3471549F2A4D9A1500361434 /* DocumentReader.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = DocumentReader.entitlements; path = DocumentReader/DocumentReader.entitlements; sourceTree = ""; };
45 | 34A6AF2D2B862E4E00266440 /* db.dat */ = {isa = PBXFileReference; lastKnownFileType = file; path = db.dat; sourceTree = ""; };
46 | 34B224192B61327D009FDA33 /* regula.license */ = {isa = PBXFileReference; lastKnownFileType = file; path = regula.license; sourceTree = ""; };
47 | 3B4392A12AC88292D35C810B /* Pods-DocumentReader.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DocumentReader.debug.xcconfig"; path = "Target Support Files/Pods-DocumentReader/Pods-DocumentReader.debug.xcconfig"; sourceTree = ""; };
48 | 5709B34CF0A7D63546082F79 /* Pods-DocumentReader.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DocumentReader.release.xcconfig"; path = "Target Support Files/Pods-DocumentReader/Pods-DocumentReader.release.xcconfig"; sourceTree = ""; };
49 | 5B7EB9410499542E8C5724F5 /* Pods-DocumentReader-DocumentReaderTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DocumentReader-DocumentReaderTests.debug.xcconfig"; path = "Target Support Files/Pods-DocumentReader-DocumentReaderTests/Pods-DocumentReader-DocumentReaderTests.debug.xcconfig"; sourceTree = ""; };
50 | 5DCACB8F33CDC322A6C60F78 /* libPods-DocumentReader.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-DocumentReader.a"; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = DocumentReader/LaunchScreen.storyboard; sourceTree = ""; };
52 | 89C6BE57DB24E9ADA2F236DE /* Pods-DocumentReader-DocumentReaderTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DocumentReader-DocumentReaderTests.release.xcconfig"; path = "Target Support Files/Pods-DocumentReader-DocumentReaderTests/Pods-DocumentReader-DocumentReaderTests.release.xcconfig"; sourceTree = ""; };
53 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
54 | /* End PBXFileReference section */
55 |
56 | /* Begin PBXFrameworksBuildPhase section */
57 | 00E356EB1AD99517003FC87E /* Frameworks */ = {
58 | isa = PBXFrameworksBuildPhase;
59 | buildActionMask = 2147483647;
60 | files = (
61 | 7699B88040F8A987B510C191 /* libPods-DocumentReader-DocumentReaderTests.a in Frameworks */,
62 | );
63 | runOnlyForDeploymentPostprocessing = 0;
64 | };
65 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
66 | isa = PBXFrameworksBuildPhase;
67 | buildActionMask = 2147483647;
68 | files = (
69 | 0C80B921A6F3F58F76C31292 /* libPods-DocumentReader.a in Frameworks */,
70 | );
71 | runOnlyForDeploymentPostprocessing = 0;
72 | };
73 | /* End PBXFrameworksBuildPhase section */
74 |
75 | /* Begin PBXGroup section */
76 | 00E356EF1AD99517003FC87E /* DocumentReaderTests */ = {
77 | isa = PBXGroup;
78 | children = (
79 | 00E356F21AD99517003FC87E /* DocumentReaderTests.m */,
80 | 00E356F01AD99517003FC87E /* Supporting Files */,
81 | );
82 | path = DocumentReaderTests;
83 | sourceTree = "";
84 | };
85 | 00E356F01AD99517003FC87E /* Supporting Files */ = {
86 | isa = PBXGroup;
87 | children = (
88 | 00E356F11AD99517003FC87E /* Info.plist */,
89 | );
90 | name = "Supporting Files";
91 | sourceTree = "";
92 | };
93 | 13B07FAE1A68108700A75B9A /* DocumentReader */ = {
94 | isa = PBXGroup;
95 | children = (
96 | 34A6AF2D2B862E4E00266440 /* db.dat */,
97 | 34B224192B61327D009FDA33 /* regula.license */,
98 | 3471549F2A4D9A1500361434 /* DocumentReader.entitlements */,
99 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */,
100 | 13B07FB01A68108700A75B9A /* AppDelegate.mm */,
101 | 13B07FB51A68108700A75B9A /* Images.xcassets */,
102 | 13B07FB61A68108700A75B9A /* Info.plist */,
103 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
104 | 13B07FB71A68108700A75B9A /* main.m */,
105 | 0B138461659C02ED353D3184 /* PrivacyInfo.xcprivacy */,
106 | );
107 | name = DocumentReader;
108 | sourceTree = "";
109 | };
110 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
111 | isa = PBXGroup;
112 | children = (
113 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
114 | 5DCACB8F33CDC322A6C60F78 /* libPods-DocumentReader.a */,
115 | 19F6CBCC0A4E27FBF8BF4A61 /* libPods-DocumentReader-DocumentReaderTests.a */,
116 | );
117 | name = Frameworks;
118 | sourceTree = "";
119 | };
120 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
121 | isa = PBXGroup;
122 | children = (
123 | );
124 | name = Libraries;
125 | sourceTree = "";
126 | };
127 | 83CBB9F61A601CBA00E9B192 = {
128 | isa = PBXGroup;
129 | children = (
130 | 13B07FAE1A68108700A75B9A /* DocumentReader */,
131 | 832341AE1AAA6A7D00B99B32 /* Libraries */,
132 | 00E356EF1AD99517003FC87E /* DocumentReaderTests */,
133 | 83CBBA001A601CBA00E9B192 /* Products */,
134 | 2D16E6871FA4F8E400B85C8A /* Frameworks */,
135 | BBD78D7AC51CEA395F1C20DB /* Pods */,
136 | );
137 | indentWidth = 2;
138 | sourceTree = "";
139 | tabWidth = 2;
140 | usesTabs = 0;
141 | };
142 | 83CBBA001A601CBA00E9B192 /* Products */ = {
143 | isa = PBXGroup;
144 | children = (
145 | 13B07F961A680F5B00A75B9A /* DocumentReader.app */,
146 | 00E356EE1AD99517003FC87E /* DocumentReaderTests.xctest */,
147 | );
148 | name = Products;
149 | sourceTree = "";
150 | };
151 | BBD78D7AC51CEA395F1C20DB /* Pods */ = {
152 | isa = PBXGroup;
153 | children = (
154 | 3B4392A12AC88292D35C810B /* Pods-DocumentReader.debug.xcconfig */,
155 | 5709B34CF0A7D63546082F79 /* Pods-DocumentReader.release.xcconfig */,
156 | 5B7EB9410499542E8C5724F5 /* Pods-DocumentReader-DocumentReaderTests.debug.xcconfig */,
157 | 89C6BE57DB24E9ADA2F236DE /* Pods-DocumentReader-DocumentReaderTests.release.xcconfig */,
158 | );
159 | path = Pods;
160 | sourceTree = "";
161 | };
162 | /* End PBXGroup section */
163 |
164 | /* Begin PBXNativeTarget section */
165 | 00E356ED1AD99517003FC87E /* DocumentReaderTests */ = {
166 | isa = PBXNativeTarget;
167 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "DocumentReaderTests" */;
168 | buildPhases = (
169 | A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */,
170 | 00E356EA1AD99517003FC87E /* Sources */,
171 | 00E356EB1AD99517003FC87E /* Frameworks */,
172 | 00E356EC1AD99517003FC87E /* Resources */,
173 | C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */,
174 | F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */,
175 | );
176 | buildRules = (
177 | );
178 | dependencies = (
179 | 00E356F51AD99517003FC87E /* PBXTargetDependency */,
180 | );
181 | name = DocumentReaderTests;
182 | productName = DocumentReaderTests;
183 | productReference = 00E356EE1AD99517003FC87E /* DocumentReaderTests.xctest */;
184 | productType = "com.apple.product-type.bundle.unit-test";
185 | };
186 | 13B07F861A680F5B00A75B9A /* DocumentReader */ = {
187 | isa = PBXNativeTarget;
188 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "DocumentReader" */;
189 | buildPhases = (
190 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */,
191 | FD10A7F022414F080027D42C /* Start Packager */,
192 | 13B07F871A680F5B00A75B9A /* Sources */,
193 | 13B07F8C1A680F5B00A75B9A /* Frameworks */,
194 | 13B07F8E1A680F5B00A75B9A /* Resources */,
195 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
196 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
197 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,
198 | );
199 | buildRules = (
200 | );
201 | dependencies = (
202 | );
203 | name = DocumentReader;
204 | productName = DocumentReader;
205 | productReference = 13B07F961A680F5B00A75B9A /* DocumentReader.app */;
206 | productType = "com.apple.product-type.application";
207 | };
208 | /* End PBXNativeTarget section */
209 |
210 | /* Begin PBXProject section */
211 | 83CBB9F71A601CBA00E9B192 /* Project object */ = {
212 | isa = PBXProject;
213 | attributes = {
214 | LastUpgradeCheck = 1210;
215 | TargetAttributes = {
216 | 00E356ED1AD99517003FC87E = {
217 | CreatedOnToolsVersion = 6.2;
218 | TestTargetID = 13B07F861A680F5B00A75B9A;
219 | };
220 | 13B07F861A680F5B00A75B9A = {
221 | LastSwiftMigration = 1120;
222 | };
223 | };
224 | };
225 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "DocumentReader" */;
226 | compatibilityVersion = "Xcode 12.0";
227 | developmentRegion = en;
228 | hasScannedForEncodings = 0;
229 | knownRegions = (
230 | en,
231 | Base,
232 | );
233 | mainGroup = 83CBB9F61A601CBA00E9B192;
234 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
235 | projectDirPath = "";
236 | projectRoot = "";
237 | targets = (
238 | 13B07F861A680F5B00A75B9A /* DocumentReader */,
239 | 00E356ED1AD99517003FC87E /* DocumentReaderTests */,
240 | );
241 | };
242 | /* End PBXProject section */
243 |
244 | /* Begin PBXResourcesBuildPhase section */
245 | 00E356EC1AD99517003FC87E /* Resources */ = {
246 | isa = PBXResourcesBuildPhase;
247 | buildActionMask = 2147483647;
248 | files = (
249 | );
250 | runOnlyForDeploymentPostprocessing = 0;
251 | };
252 | 13B07F8E1A680F5B00A75B9A /* Resources */ = {
253 | isa = PBXResourcesBuildPhase;
254 | buildActionMask = 2147483647;
255 | files = (
256 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
257 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
258 | 34B2241A2B61327D009FDA33 /* regula.license in Resources */,
259 | 34A6AF2E2B862E4E00266440 /* db.dat in Resources */,
260 | 970CEEFE26CC4F5086D8C455 /* PrivacyInfo.xcprivacy in Resources */,
261 | );
262 | runOnlyForDeploymentPostprocessing = 0;
263 | };
264 | /* End PBXResourcesBuildPhase section */
265 |
266 | /* Begin PBXShellScriptBuildPhase section */
267 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
268 | isa = PBXShellScriptBuildPhase;
269 | buildActionMask = 2147483647;
270 | files = (
271 | );
272 | inputPaths = (
273 | "$(SRCROOT)/.xcode.env.local",
274 | "$(SRCROOT)/.xcode.env",
275 | );
276 | name = "Bundle React Native code and images";
277 | outputPaths = (
278 | );
279 | runOnlyForDeploymentPostprocessing = 0;
280 | shellPath = /bin/sh;
281 | shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
282 | };
283 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
284 | isa = PBXShellScriptBuildPhase;
285 | buildActionMask = 2147483647;
286 | files = (
287 | );
288 | inputFileListPaths = (
289 | "${PODS_ROOT}/Target Support Files/Pods-DocumentReader/Pods-DocumentReader-frameworks-${CONFIGURATION}-input-files.xcfilelist",
290 | );
291 | name = "[CP] Embed Pods Frameworks";
292 | outputFileListPaths = (
293 | "${PODS_ROOT}/Target Support Files/Pods-DocumentReader/Pods-DocumentReader-frameworks-${CONFIGURATION}-output-files.xcfilelist",
294 | );
295 | runOnlyForDeploymentPostprocessing = 0;
296 | shellPath = /bin/sh;
297 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DocumentReader/Pods-DocumentReader-frameworks.sh\"\n";
298 | showEnvVarsInLog = 0;
299 | };
300 | A55EABD7B0C7F3A422A6CC61 /* [CP] Check Pods Manifest.lock */ = {
301 | isa = PBXShellScriptBuildPhase;
302 | buildActionMask = 2147483647;
303 | files = (
304 | );
305 | inputFileListPaths = (
306 | );
307 | inputPaths = (
308 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
309 | "${PODS_ROOT}/Manifest.lock",
310 | );
311 | name = "[CP] Check Pods Manifest.lock";
312 | outputFileListPaths = (
313 | );
314 | outputPaths = (
315 | "$(DERIVED_FILE_DIR)/Pods-DocumentReader-DocumentReaderTests-checkManifestLockResult.txt",
316 | );
317 | runOnlyForDeploymentPostprocessing = 0;
318 | shellPath = /bin/sh;
319 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
320 | showEnvVarsInLog = 0;
321 | };
322 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {
323 | isa = PBXShellScriptBuildPhase;
324 | buildActionMask = 2147483647;
325 | files = (
326 | );
327 | inputFileListPaths = (
328 | );
329 | inputPaths = (
330 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
331 | "${PODS_ROOT}/Manifest.lock",
332 | );
333 | name = "[CP] Check Pods Manifest.lock";
334 | outputFileListPaths = (
335 | );
336 | outputPaths = (
337 | "$(DERIVED_FILE_DIR)/Pods-DocumentReader-checkManifestLockResult.txt",
338 | );
339 | runOnlyForDeploymentPostprocessing = 0;
340 | shellPath = /bin/sh;
341 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
342 | showEnvVarsInLog = 0;
343 | };
344 | C59DA0FBD6956966B86A3779 /* [CP] Embed Pods Frameworks */ = {
345 | isa = PBXShellScriptBuildPhase;
346 | buildActionMask = 2147483647;
347 | files = (
348 | );
349 | inputFileListPaths = (
350 | "${PODS_ROOT}/Target Support Files/Pods-DocumentReader-DocumentReaderTests/Pods-DocumentReader-DocumentReaderTests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
351 | );
352 | name = "[CP] Embed Pods Frameworks";
353 | outputFileListPaths = (
354 | "${PODS_ROOT}/Target Support Files/Pods-DocumentReader-DocumentReaderTests/Pods-DocumentReader-DocumentReaderTests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
355 | );
356 | runOnlyForDeploymentPostprocessing = 0;
357 | shellPath = /bin/sh;
358 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DocumentReader-DocumentReaderTests/Pods-DocumentReader-DocumentReaderTests-frameworks.sh\"\n";
359 | showEnvVarsInLog = 0;
360 | };
361 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = {
362 | isa = PBXShellScriptBuildPhase;
363 | buildActionMask = 2147483647;
364 | files = (
365 | );
366 | inputFileListPaths = (
367 | "${PODS_ROOT}/Target Support Files/Pods-DocumentReader/Pods-DocumentReader-resources-${CONFIGURATION}-input-files.xcfilelist",
368 | );
369 | name = "[CP] Copy Pods Resources";
370 | outputFileListPaths = (
371 | "${PODS_ROOT}/Target Support Files/Pods-DocumentReader/Pods-DocumentReader-resources-${CONFIGURATION}-output-files.xcfilelist",
372 | );
373 | runOnlyForDeploymentPostprocessing = 0;
374 | shellPath = /bin/sh;
375 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DocumentReader/Pods-DocumentReader-resources.sh\"\n";
376 | showEnvVarsInLog = 0;
377 | };
378 | F6A41C54EA430FDDC6A6ED99 /* [CP] Copy Pods Resources */ = {
379 | isa = PBXShellScriptBuildPhase;
380 | buildActionMask = 2147483647;
381 | files = (
382 | );
383 | inputFileListPaths = (
384 | "${PODS_ROOT}/Target Support Files/Pods-DocumentReader-DocumentReaderTests/Pods-DocumentReader-DocumentReaderTests-resources-${CONFIGURATION}-input-files.xcfilelist",
385 | );
386 | name = "[CP] Copy Pods Resources";
387 | outputFileListPaths = (
388 | "${PODS_ROOT}/Target Support Files/Pods-DocumentReader-DocumentReaderTests/Pods-DocumentReader-DocumentReaderTests-resources-${CONFIGURATION}-output-files.xcfilelist",
389 | );
390 | runOnlyForDeploymentPostprocessing = 0;
391 | shellPath = /bin/sh;
392 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-DocumentReader-DocumentReaderTests/Pods-DocumentReader-DocumentReaderTests-resources.sh\"\n";
393 | showEnvVarsInLog = 0;
394 | };
395 | FD10A7F022414F080027D42C /* Start Packager */ = {
396 | isa = PBXShellScriptBuildPhase;
397 | buildActionMask = 2147483647;
398 | files = (
399 | );
400 | inputFileListPaths = (
401 | );
402 | inputPaths = (
403 | );
404 | name = "Start Packager";
405 | outputFileListPaths = (
406 | );
407 | outputPaths = (
408 | );
409 | runOnlyForDeploymentPostprocessing = 0;
410 | shellPath = /bin/sh;
411 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n";
412 | showEnvVarsInLog = 0;
413 | };
414 | /* End PBXShellScriptBuildPhase section */
415 |
416 | /* Begin PBXSourcesBuildPhase section */
417 | 00E356EA1AD99517003FC87E /* Sources */ = {
418 | isa = PBXSourcesBuildPhase;
419 | buildActionMask = 2147483647;
420 | files = (
421 | 00E356F31AD99517003FC87E /* DocumentReaderTests.m in Sources */,
422 | );
423 | runOnlyForDeploymentPostprocessing = 0;
424 | };
425 | 13B07F871A680F5B00A75B9A /* Sources */ = {
426 | isa = PBXSourcesBuildPhase;
427 | buildActionMask = 2147483647;
428 | files = (
429 | 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
430 | 13B07FC11A68108700A75B9A /* main.m in Sources */,
431 | );
432 | runOnlyForDeploymentPostprocessing = 0;
433 | };
434 | /* End PBXSourcesBuildPhase section */
435 |
436 | /* Begin PBXTargetDependency section */
437 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
438 | isa = PBXTargetDependency;
439 | target = 13B07F861A680F5B00A75B9A /* DocumentReader */;
440 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
441 | };
442 | /* End PBXTargetDependency section */
443 |
444 | /* Begin XCBuildConfiguration section */
445 | 00E356F61AD99517003FC87E /* Debug */ = {
446 | isa = XCBuildConfiguration;
447 | baseConfigurationReference = 5B7EB9410499542E8C5724F5 /* Pods-DocumentReader-DocumentReaderTests.debug.xcconfig */;
448 | buildSettings = {
449 | BUNDLE_LOADER = "$(TEST_HOST)";
450 | GCC_PREPROCESSOR_DEFINITIONS = (
451 | "DEBUG=1",
452 | "$(inherited)",
453 | );
454 | INFOPLIST_FILE = DocumentReaderTests/Info.plist;
455 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
456 | LD_RUNPATH_SEARCH_PATHS = (
457 | "$(inherited)",
458 | "@executable_path/Frameworks",
459 | "@loader_path/Frameworks",
460 | );
461 | OTHER_LDFLAGS = (
462 | "-ObjC",
463 | "-lc++",
464 | "$(inherited)",
465 | );
466 | PRODUCT_BUNDLE_IDENTIFIER = com.regula.dr.fullrfid;
467 | PRODUCT_NAME = "$(TARGET_NAME)";
468 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DocumentReader.app/DocumentReader";
469 | };
470 | name = Debug;
471 | };
472 | 00E356F71AD99517003FC87E /* Release */ = {
473 | isa = XCBuildConfiguration;
474 | baseConfigurationReference = 89C6BE57DB24E9ADA2F236DE /* Pods-DocumentReader-DocumentReaderTests.release.xcconfig */;
475 | buildSettings = {
476 | BUNDLE_LOADER = "$(TEST_HOST)";
477 | COPY_PHASE_STRIP = NO;
478 | INFOPLIST_FILE = DocumentReaderTests/Info.plist;
479 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
480 | LD_RUNPATH_SEARCH_PATHS = (
481 | "$(inherited)",
482 | "@executable_path/Frameworks",
483 | "@loader_path/Frameworks",
484 | );
485 | OTHER_LDFLAGS = (
486 | "-ObjC",
487 | "-lc++",
488 | "$(inherited)",
489 | );
490 | PRODUCT_BUNDLE_IDENTIFIER = com.regula.dr.fullrfid;
491 | PRODUCT_NAME = "$(TARGET_NAME)";
492 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DocumentReader.app/DocumentReader";
493 | };
494 | name = Release;
495 | };
496 | 13B07F941A680F5B00A75B9A /* Debug */ = {
497 | isa = XCBuildConfiguration;
498 | baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-DocumentReader.debug.xcconfig */;
499 | buildSettings = {
500 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
501 | CLANG_ENABLE_MODULES = YES;
502 | CODE_SIGN_ENTITLEMENTS = DocumentReader/DocumentReader.entitlements;
503 | CURRENT_PROJECT_VERSION = 1;
504 | ENABLE_BITCODE = NO;
505 | INFOPLIST_FILE = DocumentReader/Info.plist;
506 | LD_RUNPATH_SEARCH_PATHS = (
507 | "$(inherited)",
508 | "@executable_path/Frameworks",
509 | );
510 | MARKETING_VERSION = 1.0;
511 | OTHER_LDFLAGS = (
512 | "$(inherited)",
513 | "-ObjC",
514 | "-lc++",
515 | );
516 | PRODUCT_BUNDLE_IDENTIFIER = regula.DocumentReader;
517 | PRODUCT_NAME = DocumentReader;
518 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
519 | SUPPORTS_MACCATALYST = NO;
520 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
521 | SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
522 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
523 | SWIFT_VERSION = 5.0;
524 | TARGETED_DEVICE_FAMILY = 1;
525 | VERSIONING_SYSTEM = "apple-generic";
526 | };
527 | name = Debug;
528 | };
529 | 13B07F951A680F5B00A75B9A /* Release */ = {
530 | isa = XCBuildConfiguration;
531 | baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-DocumentReader.release.xcconfig */;
532 | buildSettings = {
533 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
534 | CLANG_ENABLE_MODULES = YES;
535 | CODE_SIGN_ENTITLEMENTS = DocumentReader/DocumentReader.entitlements;
536 | CURRENT_PROJECT_VERSION = 1;
537 | INFOPLIST_FILE = DocumentReader/Info.plist;
538 | LD_RUNPATH_SEARCH_PATHS = (
539 | "$(inherited)",
540 | "@executable_path/Frameworks",
541 | );
542 | MARKETING_VERSION = 1.0;
543 | OTHER_LDFLAGS = (
544 | "$(inherited)",
545 | "-ObjC",
546 | "-lc++",
547 | );
548 | PRODUCT_BUNDLE_IDENTIFIER = regula.DocumentReader;
549 | PRODUCT_NAME = DocumentReader;
550 | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
551 | SUPPORTS_MACCATALYST = NO;
552 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
553 | SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
554 | SWIFT_VERSION = 5.0;
555 | TARGETED_DEVICE_FAMILY = 1;
556 | VERSIONING_SYSTEM = "apple-generic";
557 | };
558 | name = Release;
559 | };
560 | 83CBBA201A601CBA00E9B192 /* Debug */ = {
561 | isa = XCBuildConfiguration;
562 | buildSettings = {
563 | ALWAYS_SEARCH_USER_PATHS = NO;
564 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
565 | CLANG_CXX_LANGUAGE_STANDARD = "c++20";
566 | CLANG_CXX_LIBRARY = "libc++";
567 | CLANG_ENABLE_MODULES = YES;
568 | CLANG_ENABLE_OBJC_ARC = YES;
569 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
570 | CLANG_WARN_BOOL_CONVERSION = YES;
571 | CLANG_WARN_COMMA = YES;
572 | CLANG_WARN_CONSTANT_CONVERSION = YES;
573 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
574 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
575 | CLANG_WARN_EMPTY_BODY = YES;
576 | CLANG_WARN_ENUM_CONVERSION = YES;
577 | CLANG_WARN_INFINITE_RECURSION = YES;
578 | CLANG_WARN_INT_CONVERSION = YES;
579 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
580 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
581 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
582 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
583 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
584 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
585 | CLANG_WARN_STRICT_PROTOTYPES = YES;
586 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
587 | CLANG_WARN_UNREACHABLE_CODE = YES;
588 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
589 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
590 | COPY_PHASE_STRIP = NO;
591 | ENABLE_STRICT_OBJC_MSGSEND = YES;
592 | ENABLE_TESTABILITY = YES;
593 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
594 | GCC_C_LANGUAGE_STANDARD = gnu99;
595 | GCC_DYNAMIC_NO_PIC = NO;
596 | GCC_NO_COMMON_BLOCKS = YES;
597 | GCC_OPTIMIZATION_LEVEL = 0;
598 | GCC_PREPROCESSOR_DEFINITIONS = (
599 | "DEBUG=1",
600 | "$(inherited)",
601 | );
602 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
603 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
604 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
605 | GCC_WARN_UNDECLARED_SELECTOR = YES;
606 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
607 | GCC_WARN_UNUSED_FUNCTION = YES;
608 | GCC_WARN_UNUSED_VARIABLE = YES;
609 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
610 | LD_RUNPATH_SEARCH_PATHS = (
611 | /usr/lib/swift,
612 | "$(inherited)",
613 | );
614 | LIBRARY_SEARCH_PATHS = (
615 | "\"$(SDKROOT)/usr/lib/swift\"",
616 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
617 | "\"$(inherited)\"",
618 | );
619 | MTL_ENABLE_DEBUG_INFO = YES;
620 | ONLY_ACTIVE_ARCH = YES;
621 | OTHER_CFLAGS = "$(inherited)";
622 | OTHER_CPLUSPLUSFLAGS = (
623 | "$(OTHER_CFLAGS)",
624 | "-DFOLLY_NO_CONFIG",
625 | "-DFOLLY_MOBILE=1",
626 | "-DFOLLY_USE_LIBCPP=1",
627 | );
628 | OTHER_LDFLAGS = (
629 | "$(inherited)",
630 | " ",
631 | );
632 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
633 | SDKROOT = iphoneos;
634 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
635 | USE_HERMES = true;
636 | };
637 | name = Debug;
638 | };
639 | 83CBBA211A601CBA00E9B192 /* Release */ = {
640 | isa = XCBuildConfiguration;
641 | buildSettings = {
642 | ALWAYS_SEARCH_USER_PATHS = NO;
643 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
644 | CLANG_CXX_LANGUAGE_STANDARD = "c++20";
645 | CLANG_CXX_LIBRARY = "libc++";
646 | CLANG_ENABLE_MODULES = YES;
647 | CLANG_ENABLE_OBJC_ARC = YES;
648 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
649 | CLANG_WARN_BOOL_CONVERSION = YES;
650 | CLANG_WARN_COMMA = YES;
651 | CLANG_WARN_CONSTANT_CONVERSION = YES;
652 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
653 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
654 | CLANG_WARN_EMPTY_BODY = YES;
655 | CLANG_WARN_ENUM_CONVERSION = YES;
656 | CLANG_WARN_INFINITE_RECURSION = YES;
657 | CLANG_WARN_INT_CONVERSION = YES;
658 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
659 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
660 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
661 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
662 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
663 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
664 | CLANG_WARN_STRICT_PROTOTYPES = YES;
665 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
666 | CLANG_WARN_UNREACHABLE_CODE = YES;
667 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
668 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
669 | COPY_PHASE_STRIP = YES;
670 | ENABLE_NS_ASSERTIONS = NO;
671 | ENABLE_STRICT_OBJC_MSGSEND = YES;
672 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
673 | GCC_C_LANGUAGE_STANDARD = gnu99;
674 | GCC_NO_COMMON_BLOCKS = YES;
675 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
676 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
677 | GCC_WARN_UNDECLARED_SELECTOR = YES;
678 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
679 | GCC_WARN_UNUSED_FUNCTION = YES;
680 | GCC_WARN_UNUSED_VARIABLE = YES;
681 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
682 | LD_RUNPATH_SEARCH_PATHS = (
683 | /usr/lib/swift,
684 | "$(inherited)",
685 | );
686 | LIBRARY_SEARCH_PATHS = (
687 | "\"$(SDKROOT)/usr/lib/swift\"",
688 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
689 | "\"$(inherited)\"",
690 | );
691 | MTL_ENABLE_DEBUG_INFO = NO;
692 | OTHER_CFLAGS = "$(inherited)";
693 | OTHER_CPLUSPLUSFLAGS = (
694 | "$(OTHER_CFLAGS)",
695 | "-DFOLLY_NO_CONFIG",
696 | "-DFOLLY_MOBILE=1",
697 | "-DFOLLY_USE_LIBCPP=1",
698 | );
699 | OTHER_LDFLAGS = (
700 | "$(inherited)",
701 | " ",
702 | );
703 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
704 | SDKROOT = iphoneos;
705 | USE_HERMES = true;
706 | VALIDATE_PRODUCT = YES;
707 | };
708 | name = Release;
709 | };
710 | /* End XCBuildConfiguration section */
711 |
712 | /* Begin XCConfigurationList section */
713 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "DocumentReaderTests" */ = {
714 | isa = XCConfigurationList;
715 | buildConfigurations = (
716 | 00E356F61AD99517003FC87E /* Debug */,
717 | 00E356F71AD99517003FC87E /* Release */,
718 | );
719 | defaultConfigurationIsVisible = 0;
720 | defaultConfigurationName = Release;
721 | };
722 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "DocumentReader" */ = {
723 | isa = XCConfigurationList;
724 | buildConfigurations = (
725 | 13B07F941A680F5B00A75B9A /* Debug */,
726 | 13B07F951A680F5B00A75B9A /* Release */,
727 | );
728 | defaultConfigurationIsVisible = 0;
729 | defaultConfigurationName = Release;
730 | };
731 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "DocumentReader" */ = {
732 | isa = XCConfigurationList;
733 | buildConfigurations = (
734 | 83CBBA201A601CBA00E9B192 /* Debug */,
735 | 83CBBA211A601CBA00E9B192 /* Release */,
736 | );
737 | defaultConfigurationIsVisible = 0;
738 | defaultConfigurationName = Release;
739 | };
740 | /* End XCConfigurationList section */
741 | };
742 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
743 | }
744 |
--------------------------------------------------------------------------------