assentify-sdk-react-native 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -0
- package/README.md +65 -0
- package/android/build.gradle +111 -0
- package/android/gradle.properties +9 -0
- package/android/src/main/AndroidManifest.xml +55 -0
- package/android/src/main/java/com/assentifysdk/AndroidProgressBarModule.kt +33 -0
- package/android/src/main/java/com/assentifysdk/AssentifySdkBaseModule.kt +39 -0
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +432 -0
- package/android/src/main/java/com/assentifysdk/AssentifySdkPackage.kt +19 -0
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +309 -0
- package/android/src/main/java/com/assentifysdk/ImageToBase64Converter.kt +40 -0
- package/android/src/main/java/com/assentifysdk/ReactApplicationContextObject.kt +14 -0
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +431 -0
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +328 -0
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +364 -0
- package/android/src/main/java/com/assentifysdk/StepsKeys.kt +91 -0
- package/android/src/main/res/drawable/back_icon.png +0 -0
- package/android/src/main/res/drawable/button_rounded_background.xml +6 -0
- package/android/src/main/res/drawable/card.gif +0 -0
- package/android/src/main/res/drawable/expire.png +0 -0
- package/android/src/main/res/drawable/id.gif +0 -0
- package/android/src/main/res/drawable/id_warning.png +0 -0
- package/android/src/main/res/drawable/info_icon.png +0 -0
- package/android/src/main/res/drawable/info_rounded_background.xml +6 -0
- package/android/src/main/res/drawable/passport.gif +0 -0
- package/android/src/main/res/drawable/rounded_background.xml +3 -0
- package/android/src/main/res/drawable/sending.png +0 -0
- package/android/src/main/res/drawable/warning.png +0 -0
- package/android/src/main/res/drawable/zoom_in.png +0 -0
- package/android/src/main/res/drawable/zoom_out.png +0 -0
- package/android/src/main/res/layout/activity_face_scan.xml +242 -0
- package/android/src/main/res/layout/activity_scan.xml +297 -0
- package/android/src/main/res/raw/sending_video.MP4 +0 -0
- package/android/src/main/res/values/colors.xml +8 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/android/src/main/res/values/styles.xml +4 -0
- package/assentify-sdk.podspec +43 -0
- package/ios/AssentifySdkBaseModule.swift +15 -0
- package/ios/Info.plist +27 -0
- package/ios/NativeAssentifySdk-Bridging-Header.h +3 -0
- package/ios/NativeAssentifySdk.mm +45 -0
- package/ios/NativeAssentifySdk.swift +460 -0
- package/ios/Resources/card.gif +0 -0
- package/ios/Resources/expire.png +0 -0
- package/ios/Resources/id.gif +0 -0
- package/ios/Resources/id_warning.png +0 -0
- package/ios/Resources/info_icon.png +0 -0
- package/ios/Resources/passport.gif +0 -0
- package/ios/Resources/sending.png +0 -0
- package/ios/Resources/warning.png +0 -0
- package/ios/Resources/zoom_in.png +0 -0
- package/ios/Resources/zoom_out.png +0 -0
- package/ios/UIComponents/RNIOSProgressBar.h +4 -0
- package/ios/UIComponents/RNIOSProgressBar.m +34 -0
- package/ios/UIComponents/RNPassportScanner.m +26 -0
- package/ios/UIComponents/RNPassportScanner.swift +245 -0
- package/ios/UIComponents/RNTMapManager.h +4 -0
- package/ios/UIComponents/RNTMapManager.m +19 -0
- package/ios/View/DataDecoder.swift +469 -0
- package/ios/View/FaceMatchController.swift +258 -0
- package/ios/View/IDCardController.swift +360 -0
- package/ios/View/OtherController.swift +283 -0
- package/ios/View/PassportController.swift +302 -0
- package/ios/View/UI.swift +298 -0
- package/lib/commonjs/AssentifyProvider.js +202 -0
- package/lib/commonjs/AssentifyProvider.js.map +1 -0
- package/lib/commonjs/AssentifyWrapper.js +76 -0
- package/lib/commonjs/AssentifyWrapper.js.map +1 -0
- package/lib/commonjs/Language.js +27 -0
- package/lib/commonjs/Language.js.map +1 -0
- package/lib/commonjs/helpers/index.js +2 -0
- package/lib/commonjs/helpers/index.js.map +1 -0
- package/lib/commonjs/helpers/parsers/FaceMatchParser.js +27 -0
- package/lib/commonjs/helpers/parsers/FaceMatchParser.js.map +1 -0
- package/lib/commonjs/helpers/parsers/IDCardParser.js +25 -0
- package/lib/commonjs/helpers/parsers/IDCardParser.js.map +1 -0
- package/lib/commonjs/helpers/parsers/OtherIDParser.js +29 -0
- package/lib/commonjs/helpers/parsers/OtherIDParser.js.map +1 -0
- package/lib/commonjs/helpers/parsers/PassportParser.js +25 -0
- package/lib/commonjs/helpers/parsers/PassportParser.js.map +1 -0
- package/lib/commonjs/index.js +49 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types.js +42 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/AssentifyProvider.js +193 -0
- package/lib/module/AssentifyProvider.js.map +1 -0
- package/lib/module/AssentifyWrapper.js +70 -0
- package/lib/module/AssentifyWrapper.js.map +1 -0
- package/lib/module/Language.js +21 -0
- package/lib/module/Language.js.map +1 -0
- package/lib/module/helpers/index.js +2 -0
- package/lib/module/helpers/index.js.map +1 -0
- package/lib/module/helpers/parsers/FaceMatchParser.js +21 -0
- package/lib/module/helpers/parsers/FaceMatchParser.js.map +1 -0
- package/lib/module/helpers/parsers/IDCardParser.js +19 -0
- package/lib/module/helpers/parsers/IDCardParser.js.map +1 -0
- package/lib/module/helpers/parsers/OtherIDParser.js +23 -0
- package/lib/module/helpers/parsers/OtherIDParser.js.map +1 -0
- package/lib/module/helpers/parsers/PassportParser.js +19 -0
- package/lib/module/helpers/parsers/PassportParser.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +36 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/babel.config.d.ts +3 -0
- package/lib/typescript/babel.config.d.ts.map +1 -0
- package/lib/typescript/commitlint.config.d.ts +7 -0
- package/lib/typescript/commitlint.config.d.ts.map +1 -0
- package/lib/typescript/example/babel.config.d.ts +8 -0
- package/lib/typescript/example/babel.config.d.ts.map +1 -0
- package/lib/typescript/example/index.d.ts +2 -0
- package/lib/typescript/example/index.d.ts.map +1 -0
- package/lib/typescript/example/jest.config.d.ts +2 -0
- package/lib/typescript/example/jest.config.d.ts.map +1 -0
- package/lib/typescript/example/metro.config.d.ts +3 -0
- package/lib/typescript/example/metro.config.d.ts.map +1 -0
- package/lib/typescript/example/react-native.config.d.ts +6 -0
- package/lib/typescript/example/react-native.config.d.ts.map +1 -0
- package/lib/typescript/example/src/App.d.ts +3 -0
- package/lib/typescript/example/src/App.d.ts.map +1 -0
- package/lib/typescript/example/src/Home.d.ts +4 -0
- package/lib/typescript/example/src/Home.d.ts.map +1 -0
- package/lib/typescript/example/src/navigator.d.ts +4 -0
- package/lib/typescript/example/src/navigator.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts +3 -0
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +11 -0
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Language.d.ts +22 -0
- package/lib/typescript/lib/commonjs/Language.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/helpers/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FaceMatchParser.d.ts +12 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FaceMatchParser.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/IDCardParser.d.ts +11 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/IDCardParser.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/OtherIDParser.d.ts +13 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/OtherIDParser.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/PassportParser.d.ts +11 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/PassportParser.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/types.d.ts +18 -0
- package/lib/typescript/lib/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts +3 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +10 -0
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -0
- package/lib/typescript/lib/module/Language.d.ts +21 -0
- package/lib/typescript/lib/module/Language.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/index.d.ts +1 -0
- package/lib/typescript/lib/module/helpers/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/FaceMatchParser.d.ts +11 -0
- package/lib/typescript/lib/module/helpers/parsers/FaceMatchParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/IDCardParser.d.ts +10 -0
- package/lib/typescript/lib/module/helpers/parsers/IDCardParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/OtherIDParser.d.ts +12 -0
- package/lib/typescript/lib/module/helpers/parsers/OtherIDParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/PassportParser.d.ts +10 -0
- package/lib/typescript/lib/module/helpers/parsers/PassportParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +12 -0
- package/lib/typescript/lib/module/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/types.d.ts +17 -0
- package/lib/typescript/lib/module/types.d.ts.map +1 -0
- package/lib/typescript/src/AssentifyProvider.d.ts +4 -0
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -0
- package/lib/typescript/src/AssentifyWrapper.d.ts +12 -0
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -0
- package/lib/typescript/src/Language.d.ts +22 -0
- package/lib/typescript/src/Language.d.ts.map +1 -0
- package/lib/typescript/src/helpers/index.d.ts +1 -0
- package/lib/typescript/src/helpers/index.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/FaceMatchParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/FaceMatchParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/IDCardParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/IDCardParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/OtherIDParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/OtherIDParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/PassportParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/PassportParser.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +12 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +308 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +201 -0
- package/src/AssentifyProvider.tsx +189 -0
- package/src/AssentifyWrapper.ts +142 -0
- package/src/Language.ts +22 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/parsers/FaceMatchParser.ts +28 -0
- package/src/helpers/parsers/IDCardParser.ts +27 -0
- package/src/helpers/parsers/OtherIDParser.ts +31 -0
- package/src/helpers/parsers/PassportParser.ts +27 -0
- package/src/index.ts +6 -0
- package/src/types.ts +373 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "assentify-sdk"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
+
s.source = { :git => "https://github.com/AssentifyLTD/Assentify.SDK.ReactNative.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.swift_versions = ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
|
|
18
|
+
|
|
19
|
+
s.ios.deployment_target = '14.0'
|
|
20
|
+
s.pod_target_xcconfig = {
|
|
21
|
+
'DEFINES_MODULE' => 'YES'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
26
|
+
|
|
27
|
+
s.resources = ["ios/Resources/info_icon.png",
|
|
28
|
+
"ios/Resources/zoom_in.png",
|
|
29
|
+
"ios/Resources/zoom_out.png",
|
|
30
|
+
"ios/Resources/expire.png",
|
|
31
|
+
"ios/Resources/id_warning.png",
|
|
32
|
+
"ios/Resources/warning.png",
|
|
33
|
+
"ios/Resources/sending.png",
|
|
34
|
+
"ios/Resources/id.gif",
|
|
35
|
+
"ios/Resources/passport.gif",
|
|
36
|
+
"ios/Resources/card.gif",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
s.dependency "React-Core"
|
|
41
|
+
s.dependency "AssentifySdk", '0.0.43'
|
|
42
|
+
|
|
43
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ObjectiveC
|
|
2
|
+
import UIKit
|
|
3
|
+
import Foundation
|
|
4
|
+
|
|
5
|
+
@objc(AssentifySdkBaseModule)
|
|
6
|
+
class AssentifySdkBaseModule: RCTEventEmitter {
|
|
7
|
+
|
|
8
|
+
override func supportedEvents() -> [String]! {
|
|
9
|
+
return ["AssentifySdkInitError"]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc func emitSdkInitError(_ errorMessage: String) {
|
|
13
|
+
sendEvent(withName: "AssentifySdkInitError", body: ["error": errorMessage])
|
|
14
|
+
}
|
|
15
|
+
}
|
package/ios/Info.plist
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleIconName</key>
|
|
6
|
+
<string>AppIcon</string>
|
|
7
|
+
<key>UIApplicationSceneManifest</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>UIApplicationSupportsMultipleScenes</key>
|
|
10
|
+
<false/>
|
|
11
|
+
<key>UISceneConfigurations</key>
|
|
12
|
+
<dict>
|
|
13
|
+
<key>UIWindowSceneSessionRoleApplication</key>
|
|
14
|
+
<array>
|
|
15
|
+
<dict>
|
|
16
|
+
<key>UISceneConfigurationName</key>
|
|
17
|
+
<string>Default Configuration</string>
|
|
18
|
+
<key>UISceneDelegateClassName</key>
|
|
19
|
+
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
|
20
|
+
<key>UISceneStoryboardFile</key>
|
|
21
|
+
<string>Main</string>
|
|
22
|
+
</dict>
|
|
23
|
+
</array>
|
|
24
|
+
</dict>
|
|
25
|
+
</dict>
|
|
26
|
+
</dict>
|
|
27
|
+
</plist>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import "React/RCTEventEmitter.h"
|
|
3
|
+
|
|
4
|
+
@interface RCT_EXTERN_MODULE(NativeAssentifySdk, RCTEventEmitter)
|
|
5
|
+
|
|
6
|
+
RCT_EXTERN_METHOD(initialize: (NSString *)apiKey
|
|
7
|
+
tenantIdentifier:(NSString *)tenantIdentifier
|
|
8
|
+
instanceHash:(NSString *)interaction
|
|
9
|
+
processMrz:(BOOL *)processMrz
|
|
10
|
+
storeCapturedDocument:(BOOL *)storeCapturedDocument
|
|
11
|
+
performLivenessDocument:(BOOL *)performLivenessDocument
|
|
12
|
+
performLivenessFace:(BOOL *)performLivenessFace
|
|
13
|
+
storeImageStream:(BOOL *)storeImageStream
|
|
14
|
+
saveCapturedVideoID:(BOOL *)saveCapturedVideoID
|
|
15
|
+
saveCapturedVideoFace:(BOOL *)saveCapturedVideoFace
|
|
16
|
+
ENV_CustomColor:(NSString *)ENV_CustomColor
|
|
17
|
+
enableDetect:(BOOL *)enableDetect
|
|
18
|
+
enableGuide:(BOOL *)enableGuide
|
|
19
|
+
)
|
|
20
|
+
RCT_EXTERN_METHOD(startScanPassport:
|
|
21
|
+
(NSString *)language
|
|
22
|
+
)
|
|
23
|
+
RCT_EXTERN_METHOD(startScanOtherIDPage:
|
|
24
|
+
(NSString *)language
|
|
25
|
+
)
|
|
26
|
+
RCT_EXTERN_METHOD(startScanIDPage:(NSString *)kycDocumentDetails
|
|
27
|
+
language:(NSString *)language
|
|
28
|
+
flippingCard:(BOOL)flippingCard
|
|
29
|
+
)
|
|
30
|
+
RCT_EXTERN_METHOD(startFaceMatch:(NSString *)imageUrl
|
|
31
|
+
showCountDown:(BOOL)showCountDown
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
RCT_EXTERN_METHOD(submitData:(NSDictionary *)data)
|
|
35
|
+
RCT_EXTERN_METHOD(supportedEvents)
|
|
36
|
+
|
|
37
|
+
+ (BOOL)requiresMainQueueSetup
|
|
38
|
+
{
|
|
39
|
+
return NO;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import ObjectiveC
|
|
2
|
+
import UIKit
|
|
3
|
+
import Foundation
|
|
4
|
+
import AssentifySdk
|
|
5
|
+
|
|
6
|
+
@objc(NativeAssentifySdk)
|
|
7
|
+
class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDelegate{
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
private var assentifySdk :AssentifySdk?
|
|
11
|
+
private var stepDefinitions :[StepDefinitions]?
|
|
12
|
+
private var configModel :ConfigModel?
|
|
13
|
+
private var timeStarted :String?
|
|
14
|
+
private var holdHandColor: String?;
|
|
15
|
+
private var processingColor: String?;
|
|
16
|
+
private var templatesByCountry: [TemplatesByCountry]?;
|
|
17
|
+
private var apiKey:String?;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@objc
|
|
21
|
+
func initialize(_
|
|
22
|
+
apiKey: String,
|
|
23
|
+
tenantIdentifier: String,
|
|
24
|
+
instanceHash: String,
|
|
25
|
+
processMrz: Bool = true,
|
|
26
|
+
storeCapturedDocument: Bool = true,
|
|
27
|
+
performLivenessDocument: Bool = false,
|
|
28
|
+
performLivenessFace: Bool = false,
|
|
29
|
+
storeImageStream: Bool = true,
|
|
30
|
+
saveCapturedVideoID: Bool = true,
|
|
31
|
+
saveCapturedVideoFace: Bool = true,
|
|
32
|
+
ENV_CustomColor: String = "#f5a103",
|
|
33
|
+
enableDetect: Bool = true,
|
|
34
|
+
enableGuide: Bool = true
|
|
35
|
+
|
|
36
|
+
) -> Void {
|
|
37
|
+
|
|
38
|
+
if(apiKey.isEmpty || tenantIdentifier.isEmpty || instanceHash.isEmpty ){
|
|
39
|
+
print("apiKey, tenantIdentifier, instanceHash a are mandatory parameters")
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
self.apiKey = apiKey
|
|
44
|
+
|
|
45
|
+
print("apiKey: \(apiKey)")
|
|
46
|
+
print("tenantIdentifier: \(tenantIdentifier)")
|
|
47
|
+
print("instanceHash: \(instanceHash)")
|
|
48
|
+
print("processMrz: \(Bool(processMrz))")
|
|
49
|
+
print("storeCapturedDocument: \(Bool(storeCapturedDocument))")
|
|
50
|
+
print("performLivenessDocument: \(Bool(performLivenessDocument))")
|
|
51
|
+
print("performLivenessFace: \(Bool(performLivenessFace))")
|
|
52
|
+
print("storeImageStream: \(Bool(storeImageStream))")
|
|
53
|
+
print("saveCapturedVideoID: \(Bool(saveCapturedVideoID))")
|
|
54
|
+
print("saveCapturedVideoFace: \(Bool(saveCapturedVideoFace))")
|
|
55
|
+
print("ENV_CustomColor: \(ENV_CustomColor)")
|
|
56
|
+
print("enableDetect: \(enableDetect)")
|
|
57
|
+
print("enableGuide: \(enableGuide)")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
let eventResultMap: [String: Any] = [
|
|
61
|
+
"assentifySdkInitStart": true,
|
|
62
|
+
]
|
|
63
|
+
DispatchQueue.main.async {
|
|
64
|
+
self.sendEvent(withName: "AppResult",body : eventResultMap)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
UserDefaults.standard.set(instanceHash, forKey:"instanceHash")
|
|
68
|
+
// UserDefaults.standard.set(previewURL, forKey:"previewURL")
|
|
69
|
+
|
|
70
|
+
let environmentalConditions = EnvironmentalConditions(
|
|
71
|
+
enableDetect: enableDetect, enableGuide: enableGuide,
|
|
72
|
+
BRIGHTNESS_HIGH_THRESHOLD: 500.0,
|
|
73
|
+
BRIGHTNESS_LOW_THRESHOLD: 0.0,
|
|
74
|
+
PREDICTION_LOW_PERCENTAGE: 50.0,
|
|
75
|
+
PREDICTION_HIGH_PERCENTAGE: 100.0,
|
|
76
|
+
CustomColor: "#ffffff",
|
|
77
|
+
HoldHandColor: ENV_CustomColor
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
self.holdHandColor = ENV_CustomColor;
|
|
81
|
+
self.processingColor = "#ffffff";
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
self.assentifySdk = AssentifySdk(
|
|
85
|
+
apiKey: apiKey,
|
|
86
|
+
tenantIdentifier: tenantIdentifier,
|
|
87
|
+
interaction: instanceHash,
|
|
88
|
+
environmentalConditions: environmentalConditions,
|
|
89
|
+
assentifySdkDelegate: self,
|
|
90
|
+
processMrz: processMrz,
|
|
91
|
+
storeCapturedDocument: storeCapturedDocument,
|
|
92
|
+
performLivenessDocument: performLivenessDocument,
|
|
93
|
+
performLivenessFace: performLivenessFace,
|
|
94
|
+
storeImageStream: storeImageStream,
|
|
95
|
+
saveCapturedVideoID: saveCapturedVideoID,
|
|
96
|
+
saveCapturedVideoFace: saveCapturedVideoFace
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
func onAssentifySdkInitError(message: String) {
|
|
103
|
+
DispatchQueue.main.async {
|
|
104
|
+
let eventResultMap: [String: Any] = ["assentifySdkInitSuccess": false]
|
|
105
|
+
self.sendEvent(withName: "AppResult",body : eventResultMap)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
func onAssentifySdkInitSuccess(configModel: ConfigModel) {
|
|
110
|
+
UserDefaults.standard.set(nil, forKey:"FaceModel")
|
|
111
|
+
UserDefaults.standard.set(nil, forKey:"PassportModel")
|
|
112
|
+
UserDefaults.standard.set(nil, forKey:"IDModel")
|
|
113
|
+
UserDefaults.standard.set(nil, forKey:"IDBackModel")
|
|
114
|
+
UserDefaults.standard.set(nil, forKey:"OtherModel")
|
|
115
|
+
self.stepDefinitions = configModel.stepDefinitions;
|
|
116
|
+
self.configModel = configModel;
|
|
117
|
+
|
|
118
|
+
self.templatesByCountry = self.assentifySdk!.getTemplates();
|
|
119
|
+
do {
|
|
120
|
+
let jsonData = try JSONEncoder().encode(self.templatesByCountry)
|
|
121
|
+
let jsonString = String(decoding: jsonData, as: UTF8.self)
|
|
122
|
+
let eventResultMap: [String: Any] = ["AssentifySdkHasTemplates": jsonString, "assentifySdkInitSuccess": true]
|
|
123
|
+
DispatchQueue.main.async {
|
|
124
|
+
self.sendEvent(withName: "AppResult",body : eventResultMap)
|
|
125
|
+
}
|
|
126
|
+
} catch {
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
override func supportedEvents() -> [String]! {
|
|
133
|
+
return [
|
|
134
|
+
"AppResult",
|
|
135
|
+
"EventResult",
|
|
136
|
+
"EventError",
|
|
137
|
+
"onEnvironmentalConditionsChange",
|
|
138
|
+
"onUploadFailed",
|
|
139
|
+
"onDocumentCropped",
|
|
140
|
+
"onDocumentCaptured",
|
|
141
|
+
"onQualityCheckAvailable",
|
|
142
|
+
"onFaceExtracted",
|
|
143
|
+
"onNoFaceDetected",
|
|
144
|
+
"onFaceDetected",
|
|
145
|
+
"onNoMrzDetected",
|
|
146
|
+
"onMrzDetected",
|
|
147
|
+
"onMrzExtracted",
|
|
148
|
+
"onCardDetected",
|
|
149
|
+
"onComplete",
|
|
150
|
+
"onLivenessUpdate",
|
|
151
|
+
"onUpdated",
|
|
152
|
+
"onStatusUpdated",
|
|
153
|
+
"onClipPreparationComplete",
|
|
154
|
+
"onRetry",
|
|
155
|
+
"onSend",
|
|
156
|
+
"onError",
|
|
157
|
+
"onWrongTemplate",
|
|
158
|
+
"onBackClick",
|
|
159
|
+
"SubmitResult"
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
func navigateToPassportController(language: String) {
|
|
165
|
+
DispatchQueue.main.async {
|
|
166
|
+
|
|
167
|
+
self.timeStarted = self.getTimeUTC();
|
|
168
|
+
if let currentViewController = UIViewController.currentViewController {
|
|
169
|
+
let viewController = PassportController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor:self.holdHandColor!,processingColor: self.processingColor!,language: language,showCountDown: true,apiKey: self.apiKey!)
|
|
170
|
+
viewController.modalPresentationStyle = .fullScreen
|
|
171
|
+
currentViewController.present(viewController, animated: true, completion: nil)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
func navigateToOtherController(language: String ) {
|
|
178
|
+
DispatchQueue.main.async {
|
|
179
|
+
self.timeStarted = self.getTimeUTC();
|
|
180
|
+
if let currentViewController = UIViewController.currentViewController {
|
|
181
|
+
let viewController = OtherController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor:self.holdHandColor!,processingColor: self.processingColor!,language: language,showCountDown: true,apiKey: self.apiKey!)
|
|
182
|
+
viewController.modalPresentationStyle = .fullScreen
|
|
183
|
+
currentViewController.present(viewController, animated: true, completion: nil)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
func navigateToIDCardController(jsonStringKycDocumentDetails: String,language: String,flippingCard:Bool) {
|
|
190
|
+
if(jsonStringKycDocumentDetails.isEmpty) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
let jsonData = Data(jsonStringKycDocumentDetails.utf8)
|
|
194
|
+
let kycDocumentDetails: [KycDocumentDetails] = try! JSONDecoder().decode([KycDocumentDetails].self, from: jsonData)
|
|
195
|
+
DispatchQueue.main.async {
|
|
196
|
+
self.timeStarted = self.getTimeUTC();
|
|
197
|
+
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
198
|
+
let viewController = IDCardController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor: self.holdHandColor!,processingColor: self.processingColor!,kycDocumentDetails: kycDocumentDetails,language:language,flippingCard: flippingCard,titleID:self.getIdTitle(kycDocumentDetails:kycDocumentDetails ), showCountDown: true,apiKey: self.apiKey!)
|
|
199
|
+
viewController.modalPresentationStyle = .fullScreen
|
|
200
|
+
currentViewController.present(viewController, animated: true, completion: nil)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
func navigateToFaceMatchontroller(imageUrl: String ,showCountDown:Bool) {
|
|
207
|
+
DispatchQueue.main.async {
|
|
208
|
+
let imageDocUrl = URL(string: imageUrl)
|
|
209
|
+
self.imageToBase64(from: imageDocUrl!) { base64String in
|
|
210
|
+
DispatchQueue.main.async {
|
|
211
|
+
if let currentViewController = UIViewController.currentViewController {
|
|
212
|
+
let viewController = FaceMAtchController(assentifySdk: self.assentifySdk!,
|
|
213
|
+
nativeAssentifySdk: self,
|
|
214
|
+
holdHandColor: self.holdHandColor!,
|
|
215
|
+
processingColor: self.processingColor!,
|
|
216
|
+
secondImage:base64String!,
|
|
217
|
+
showCountDown: showCountDown
|
|
218
|
+
)
|
|
219
|
+
viewController.modalPresentationStyle = .fullScreen
|
|
220
|
+
currentViewController.present(viewController, animated: true, completion: nil)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
@objc
|
|
230
|
+
func startScanPassport(_ language: String ) {
|
|
231
|
+
/** Nav To Passport Scan Page **/
|
|
232
|
+
navigateToPassportController(language: language)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@objc
|
|
236
|
+
func startScanOtherIDPage(_ language: String) {
|
|
237
|
+
/** Nav To Other Scan Page **/
|
|
238
|
+
navigateToOtherController(language: language);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@objc
|
|
242
|
+
func startScanIDPage(_ kycDocumentDetails: String ,language: String,flippingCard:Bool) {
|
|
243
|
+
navigateToIDCardController(jsonStringKycDocumentDetails: kycDocumentDetails,language:language,flippingCard:flippingCard)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@objc
|
|
247
|
+
func startFaceMatch(_ imageUrl: String ,showCountDown:Bool) {
|
|
248
|
+
navigateToFaceMatchontroller(imageUrl: imageUrl,showCountDown:showCountDown)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@objc
|
|
254
|
+
func submitData(_ data: [String: Any]) {
|
|
255
|
+
|
|
256
|
+
DispatchQueue.main.async {
|
|
257
|
+
let instanceHashValue = UserDefaults.standard.string(forKey: "instanceHash") ?? ""
|
|
258
|
+
|
|
259
|
+
var submitRequestModel : [SubmitRequestModel] = []
|
|
260
|
+
var extractedInformationWrapUp: [String: String] = [:]
|
|
261
|
+
var extractedInformationBlockLoader: [String: String] = [:]
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
self.stepDefinitions?.forEach({ step in
|
|
269
|
+
if(step.stepDefinition == StepsName.DocumentCapture){
|
|
270
|
+
if let savedData = UserDefaults.standard.data(forKey: "OutputPropertiesDoc") {
|
|
271
|
+
if let outputProperties = try? JSONSerialization.jsonObject(with: savedData, options: []) as? [String: Any] {
|
|
272
|
+
submitRequestModel.append(SubmitRequestModel(
|
|
273
|
+
stepId: step.stepId,
|
|
274
|
+
stepDefinition:StepsName.DocumentCapture,
|
|
275
|
+
extractedInformation:self.convertAnyDictToStringDict(dict: outputProperties)
|
|
276
|
+
))
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
}
|
|
282
|
+
if(step.stepDefinition == StepsName.FaceMatch){
|
|
283
|
+
if let savedData = UserDefaults.standard.data(forKey: "OutputPropertiesFace") {
|
|
284
|
+
if let outputProperties = try? JSONSerialization.jsonObject(with: savedData, options: []) as? [String: Any] {
|
|
285
|
+
submitRequestModel.append(SubmitRequestModel(
|
|
286
|
+
stepId: step.stepId,
|
|
287
|
+
stepDefinition:StepsName.FaceMatch,
|
|
288
|
+
extractedInformation:self.convertAnyDictToStringDict(dict: outputProperties)
|
|
289
|
+
))
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if(step.stepDefinition == StepsName.WrapUp){
|
|
296
|
+
step.outputProperties.forEach({ property in
|
|
297
|
+
if (property.key.contains(WrapUpKeys.TimeEnded)) {
|
|
298
|
+
extractedInformationWrapUp[property.key] = self.getTimeUTC();
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
submitRequestModel.append(SubmitRequestModel(
|
|
302
|
+
stepId: step.stepId,
|
|
303
|
+
stepDefinition:StepsName.WrapUp,
|
|
304
|
+
extractedInformation:extractedInformationWrapUp
|
|
305
|
+
))
|
|
306
|
+
}
|
|
307
|
+
if(step.stepDefinition == StepsName.BlockLoader){
|
|
308
|
+
step.outputProperties.forEach({ property in
|
|
309
|
+
if (property.key.contains(BlockLoaderKeys.DeviceName)) {
|
|
310
|
+
extractedInformationBlockLoader[property.key] = "iOS";
|
|
311
|
+
}
|
|
312
|
+
if (property.key.contains(BlockLoaderKeys.FlowName)) {
|
|
313
|
+
extractedInformationBlockLoader[property.key] = self.configModel?.flowName
|
|
314
|
+
}
|
|
315
|
+
if (property.key.contains(BlockLoaderKeys.Application)) {
|
|
316
|
+
extractedInformationBlockLoader[property.key] = self.configModel?.instanceId
|
|
317
|
+
}
|
|
318
|
+
if (property.key.contains(BlockLoaderKeys.TimeStarted)) {
|
|
319
|
+
extractedInformationBlockLoader[property.key] = self.timeStarted;
|
|
320
|
+
}
|
|
321
|
+
if (property.key.contains(BlockLoaderKeys.UserAgent)) {
|
|
322
|
+
extractedInformationBlockLoader[property.key] = "SDK";
|
|
323
|
+
}
|
|
324
|
+
if (property.key.contains(BlockLoaderKeys.InstanceHash)) {
|
|
325
|
+
extractedInformationBlockLoader[property.key] = self.configModel?.instanceHash
|
|
326
|
+
|
|
327
|
+
}
|
|
328
|
+
if (property.key.contains(BlockLoaderKeys.interactionID)) {
|
|
329
|
+
extractedInformationBlockLoader[property.key] = self.configModel?.instanceId
|
|
330
|
+
}
|
|
331
|
+
if !data.isEmpty {
|
|
332
|
+
for (keyData, valueData) in data {
|
|
333
|
+
if property.key.contains(keyData) {
|
|
334
|
+
extractedInformationBlockLoader[property.key] = String(describing: valueData)
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
})
|
|
339
|
+
|
|
340
|
+
submitRequestModel.append(SubmitRequestModel(
|
|
341
|
+
stepId:step.stepId,
|
|
342
|
+
stepDefinition:StepsName.BlockLoader,
|
|
343
|
+
extractedInformation:extractedInformationBlockLoader
|
|
344
|
+
))
|
|
345
|
+
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
})
|
|
349
|
+
|
|
350
|
+
submitRequestModel.forEach { item in
|
|
351
|
+
print(item.stepDefinition)
|
|
352
|
+
print(item.extractedInformation)
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
var submitData = self.assentifySdk?.startSubmitData(submitDataDelegate: self, submitRequestModel:submitRequestModel)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
func onSubmitError(message: String) {
|
|
362
|
+
DispatchQueue.main.async {
|
|
363
|
+
let eventResultMap: [String: Any] = [
|
|
364
|
+
"success": false,
|
|
365
|
+
]
|
|
366
|
+
self.sendEvent(withName: "SubmitResult",body : eventResultMap)
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
func onSubmitSuccess() {
|
|
371
|
+
DispatchQueue.main.async {
|
|
372
|
+
let eventResultMap: [String: Any] = [
|
|
373
|
+
"success": true,
|
|
374
|
+
]
|
|
375
|
+
self.sendEvent(withName: "SubmitResult",body : eventResultMap)
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
func convertAnyDictToStringDict(dict: [String: Any]) -> [String: String] {
|
|
381
|
+
var stringDict: [String: String] = [:]
|
|
382
|
+
|
|
383
|
+
for (key, value) in dict {
|
|
384
|
+
if let stringValue = value as? String {
|
|
385
|
+
stringDict[key] = stringValue
|
|
386
|
+
} else {
|
|
387
|
+
stringDict[key] = "\(value)"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
return stringDict
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
func getTimeUTC() -> String{
|
|
396
|
+
let currentDate = Date()
|
|
397
|
+
let formatter = DateFormatter()
|
|
398
|
+
formatter.dateFormat = "dd/MM/yyyy HH:mm:ss"
|
|
399
|
+
formatter.timeZone = TimeZone(abbreviation: "UTC")
|
|
400
|
+
let utcTime = formatter.string(from: currentDate)
|
|
401
|
+
return utcTime;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
func getIdTitle(kycDocumentDetails: [KycDocumentDetails]) -> String {
|
|
405
|
+
var title = ""
|
|
406
|
+
|
|
407
|
+
for country in self.templatesByCountry ?? [] {
|
|
408
|
+
for template in country.templates {
|
|
409
|
+
if !template.kycDocumentDetails.isEmpty {
|
|
410
|
+
if kycDocumentDetails[0].templateProcessingKeyInformation == template.kycDocumentDetails[0].templateProcessingKeyInformation {
|
|
411
|
+
title = template.kycDocumentType
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return title
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
func imageToBase64(from url: URL, completion: @escaping (String?) -> Void) {
|
|
421
|
+
|
|
422
|
+
var request = URLRequest(url: url)
|
|
423
|
+
|
|
424
|
+
let headers = ["X-Api-Key": self.apiKey]
|
|
425
|
+
|
|
426
|
+
for (headerField, headerValue) in headers {
|
|
427
|
+
request.setValue(headerValue, forHTTPHeaderField: headerField)
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
|
431
|
+
guard let imageData = data, error == nil else {
|
|
432
|
+
print("Failed to download image from URL: \(error?.localizedDescription ?? "Unknown error")")
|
|
433
|
+
completion(nil)
|
|
434
|
+
return
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
let base64String = imageData.base64EncodedString()
|
|
438
|
+
|
|
439
|
+
completion(base64String)
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
task.resume()
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
extension UIViewController {
|
|
447
|
+
static var currentViewController: UIViewController? {
|
|
448
|
+
var viewController = UIApplication.shared.windows.first?.rootViewController
|
|
449
|
+
|
|
450
|
+
while let presentedViewController = viewController?.presentedViewController {
|
|
451
|
+
viewController = presentedViewController
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return viewController
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#import <React/RCTViewManager.h>
|
|
2
|
+
|
|
3
|
+
@interface RNIOSProgressBar : RCTViewManager
|
|
4
|
+
|
|
5
|
+
@end
|
|
6
|
+
|
|
7
|
+
#import <React/RCTConvert.h>
|
|
8
|
+
#import <React/RCTUIManager.h>
|
|
9
|
+
|
|
10
|
+
@interface ProgressBarView : UIProgressView
|
|
11
|
+
|
|
12
|
+
@end
|
|
13
|
+
|
|
14
|
+
@implementation ProgressBarView
|
|
15
|
+
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation RNIOSProgressBar
|
|
19
|
+
|
|
20
|
+
RCT_EXPORT_MODULE()
|
|
21
|
+
|
|
22
|
+
- (UIView *)view
|
|
23
|
+
{
|
|
24
|
+
// Progressbar UI
|
|
25
|
+
ProgressBarView *progressBar = [[ProgressBarView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
|
|
26
|
+
return progressBar;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Progress bar properties
|
|
30
|
+
RCT_EXPORT_VIEW_PROPERTY(progress, float)
|
|
31
|
+
RCT_EXPORT_VIEW_PROPERTY(progressTintColor, UIColor)
|
|
32
|
+
RCT_EXPORT_VIEW_PROPERTY(trackTintColor, UIColor)
|
|
33
|
+
|
|
34
|
+
@end
|