@qore-id/react-native-qoreid-sdk 1.1.4 → 1.2.2
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 +1 -1
- package/README.md +1 -1
- package/android/build.gradle +69 -63
- package/android/gradle.properties +5 -9
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +169 -137
- package/android/src/main/java/com/qoreidsdk/QoreidSdkPackage.kt +1 -4
- package/ios/QoreidSdk.m +4 -13
- package/ios/QoreidSdk.swift +30 -23
- package/lib/commonjs/index.js +2 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/qoreIdSdk.js +32 -6
- package/lib/commonjs/qoreIdSdk.js.map +1 -1
- package/lib/commonjs/types.d.js.map +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/qoreIdSdk.js +33 -6
- package/lib/module/qoreIdSdk.js.map +1 -1
- package/lib/module/types.d.js +1 -1
- package/lib/module/types.d.js.map +1 -1
- package/lib/module/utils.js +2 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/{qoreIdSdk.d.ts → src/qoreIdSdk.d.ts} +6 -1
- package/lib/typescript/src/qoreIdSdk.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/package.json +64 -42
- package/qore-id-react-native-qoreid-sdk.podspec +23 -16
- package/src/index.tsx +1 -0
- package/src/qoreIdSdk.tsx +40 -5
- package/src/types.d.ts +22 -3
- package/android/src/main/java/com/qoreidsdk/QoreIdJSData.kt +0 -50
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +0 -5
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/WorkspaceSettings.xcsettings +0 -14
- package/ios/QoreidSdk.xcodeproj/xcuserdata/e.ugwuoke.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/lib/typescript/index.d.ts +0 -3
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/qoreIdSdk.d.ts.map +0 -1
- package/lib/typescript/utils.d.ts.map +0 -1
- /package/lib/typescript/{utils.d.ts → src/utils.d.ts} +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 QoreID
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
package/android/build.gradle
CHANGED
|
@@ -1,98 +1,104 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
repositories {
|
|
5
|
-
google()
|
|
6
|
-
mavenCentral()
|
|
7
|
-
}
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["RNQoreIDSdk_kotlinVersion"]
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def reactNativeArchitectures() {
|
|
18
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
19
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
def isNewArchitectureEnabled() {
|
|
17
|
-
|
|
23
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
apply plugin: "com.android.library"
|
|
21
27
|
apply plugin: "kotlin-android"
|
|
22
|
-
apply plugin: "maven-publish"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
|
|
26
28
|
|
|
27
29
|
if (isNewArchitectureEnabled()) {
|
|
28
|
-
|
|
30
|
+
apply plugin: "com.facebook.react"
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
def getExtOrDefault(name) {
|
|
32
|
-
|
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["RNQoreIDSdk_" + name]
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
def getExtOrIntegerDefault(name) {
|
|
36
|
-
|
|
38
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RNQoreIDSdk_" + name]).toInteger()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def supportsNamespace() {
|
|
42
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
43
|
+
def major = parsed[0].toInteger()
|
|
44
|
+
def minor = parsed[1].toInteger()
|
|
45
|
+
|
|
46
|
+
// Namespace support was added in 7.3.0
|
|
47
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
android {
|
|
40
|
-
|
|
51
|
+
if (supportsNamespace()) {
|
|
52
|
+
namespace "com.qoreidsdk"
|
|
53
|
+
|
|
41
54
|
sourceSets {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
defaultConfig {
|
|
48
|
-
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
49
|
-
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
50
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
51
|
-
buildConfigField "String", "s", "\"react_native_android_sdk\""
|
|
52
|
-
multiDexEnabled true
|
|
53
|
-
}
|
|
54
|
-
buildTypes {
|
|
55
|
-
release {
|
|
56
|
-
minifyEnabled false
|
|
57
|
-
}
|
|
58
|
-
debug {
|
|
59
|
-
gradle.properties['isReleaseBuild'] = false
|
|
60
|
-
}
|
|
55
|
+
main {
|
|
56
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
57
|
+
}
|
|
61
58
|
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
62
|
+
|
|
63
|
+
defaultConfig {
|
|
64
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
|
+
buildConfigField "String", "s", "\"react_native_android_sdk\""
|
|
67
|
+
multiDexEnabled true
|
|
68
|
+
}
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
buildTypes {
|
|
71
|
+
release {
|
|
72
|
+
minifyEnabled false
|
|
65
73
|
}
|
|
74
|
+
}
|
|
66
75
|
|
|
76
|
+
lintOptions {
|
|
77
|
+
disable "GradleCompatible"
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
compileOptions {
|
|
81
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
82
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
83
|
+
}
|
|
67
84
|
}
|
|
68
85
|
|
|
69
86
|
repositories {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
87
|
+
mavenCentral()
|
|
88
|
+
google()
|
|
89
|
+
mavenLocal()
|
|
90
|
+
maven { url "https://repo.qoreid.com/repository/maven-releases/" }
|
|
91
|
+
maven { url 'https://jitpack.io' }
|
|
75
92
|
}
|
|
76
93
|
|
|
77
94
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
78
95
|
|
|
79
|
-
|
|
80
96
|
dependencies {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
88
|
-
|
|
97
|
+
implementation 'com.qoreid:qoreid-sdk:+'
|
|
98
|
+
// For < 0.71, this will be from the local maven repo
|
|
99
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
100
|
+
//noinspection GradleDynamicVersion
|
|
101
|
+
implementation "com.facebook.react:react-native:+"
|
|
102
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
89
103
|
}
|
|
90
104
|
|
|
91
|
-
|
|
92
|
-
if (isNewArchitectureEnabled()) {
|
|
93
|
-
react {
|
|
94
|
-
jsRootDir = file("../src/")
|
|
95
|
-
libraryName = "QoreidSdk"
|
|
96
|
-
codegenJavaPackageName = "com.qoreidsdk"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
android.useAndroidX=true
|
|
7
|
-
android.enableJetifier=true
|
|
8
|
-
isReleaseBuild=true
|
|
9
|
-
|
|
1
|
+
RNQoreIDSdk_kotlinVersion=1.7.0
|
|
2
|
+
RNQoreIDSdk_minSdkVersion=21
|
|
3
|
+
RNQoreIDSdk_targetSdkVersion=31
|
|
4
|
+
RNQoreIDSdk_compileSdkVersion=31
|
|
5
|
+
RNQoreIDSdk_ndkversion=21.4.7075529
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
package com.qoreidsdk
|
|
2
2
|
|
|
3
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
3
4
|
import android.app.Activity
|
|
4
5
|
import android.content.Intent
|
|
5
6
|
import android.os.Build
|
|
6
7
|
import android.util.Log
|
|
7
|
-
import
|
|
8
|
+
import androidx.annotation.RequiresApi
|
|
9
|
+
import com.facebook.react.bridge.Arguments
|
|
10
|
+
import com.facebook.react.bridge.BaseActivityEventListener
|
|
11
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
12
|
+
import com.facebook.react.bridge.ReactMethod
|
|
13
|
+
import com.facebook.react.bridge.ReadableMap
|
|
14
|
+
import com.facebook.react.bridge.WritableMap
|
|
8
15
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
16
|
+
import com.qoreid.sdk.core.OnFlowRequestIdCallback
|
|
9
17
|
import com.qoreid.sdk.core.QoreIDParams
|
|
10
18
|
import com.qoreid.sdk.core.QoreIDSdk
|
|
11
19
|
import com.qoreid.sdk.core.QoreIDSdk.QORE_ID_RESULT_CODE
|
|
@@ -15,153 +23,177 @@ import com.qoreid.sdk.core.models.ApplicantData
|
|
|
15
23
|
import com.qoreid.sdk.core.models.ErrorResult
|
|
16
24
|
import com.qoreid.sdk.core.models.QoreIDResult
|
|
17
25
|
import com.qoreid.sdk.core.models.SuccessResult
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
class QoreidSdkModule(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
import com.qoreid.sdk.core.models.VerificationExtraData
|
|
27
|
+
|
|
28
|
+
class QoreidSdkModule(context: ReactApplicationContext) :
|
|
29
|
+
ReactContextBaseJavaModule(context) {
|
|
30
|
+
|
|
31
|
+
override fun getName(): String {
|
|
32
|
+
return NAME
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private var qoreIdResult: QoreIDResult? = null
|
|
36
|
+
|
|
37
|
+
private val activityEventListener =
|
|
38
|
+
object : BaseActivityEventListener() {
|
|
39
|
+
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
|
40
|
+
override fun onActivityResult(
|
|
41
|
+
activity: Activity?,
|
|
42
|
+
requestCode: Int,
|
|
43
|
+
resultCode: Int,
|
|
44
|
+
intent: Intent?
|
|
45
|
+
) {
|
|
46
|
+
|
|
47
|
+
if (resultCode == QORE_ID_RESULT_CODE && intent != null) {
|
|
48
|
+
qoreIdResult =
|
|
49
|
+
if (Build.VERSION.SDK_INT < 33) {
|
|
50
|
+
intent.extras?.getSerializable(QORE_ID_RESULT_EXTRA_KEY) as
|
|
51
|
+
QoreIDResult
|
|
52
|
+
} else {
|
|
53
|
+
intent.extras?.getSerializable(
|
|
54
|
+
QORE_ID_RESULT_EXTRA_KEY,
|
|
55
|
+
QoreIDResult::class.java
|
|
56
|
+
)
|
|
47
57
|
}
|
|
48
|
-
|
|
49
|
-
init {
|
|
50
|
-
reactContext.addActivityEventListener(activityEventListener)
|
|
51
|
-
QoreIDSdk.Callbacks.onFlowRequestId {
|
|
52
|
-
Log.i("QORE_ID", it.toString())
|
|
53
|
-
|
|
54
|
-
val event =
|
|
55
|
-
Arguments.createMap().apply {
|
|
56
|
-
putString("data", it.toString())
|
|
57
|
-
putString("message", "QOREID SDK INITIALIZED")
|
|
58
|
-
putString("event", "SESSION_RESULT")
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
sendEvent(reactContext, "onResult", event)
|
|
58
|
+
processQoreIDResult(context, qoreIdResult!!)
|
|
62
59
|
}
|
|
60
|
+
}
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
init {
|
|
64
|
+
context.addActivityEventListener(activityEventListener)
|
|
65
|
+
|
|
66
|
+
QoreIDSdk.Callbacks.onFlowRequestId(object : OnFlowRequestIdCallback {
|
|
67
|
+
override fun onValue(flowRequestId: Long) {
|
|
68
|
+
Log.i("QORE_ID", flowRequestId.toString())
|
|
69
|
+
val event =
|
|
70
|
+
Arguments.createMap().apply {
|
|
71
|
+
putString("data", flowRequestId.toString())
|
|
72
|
+
putString("message", "QOREID SDK INITIALIZED")
|
|
73
|
+
putString("event", "SESSION_RESULT")
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
sendEvent(context, "onResult", event)
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@ReactMethod
|
|
82
|
+
fun launchQoreidSdk(readableData: ReadableMap) {
|
|
83
|
+
val data = readableData.toHashMap()
|
|
84
|
+
|
|
85
|
+
if (currentActivity == null) {
|
|
86
|
+
Log.e("Error", "No current activity")
|
|
87
|
+
return
|
|
67
88
|
}
|
|
68
89
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (flowId?.toLong() != 0L) {
|
|
103
|
-
QoreIDParams()
|
|
104
|
-
.clientId(config?.get("clientId") as String)
|
|
105
|
-
.customerReference(config?.get("customerReference") as String)
|
|
106
|
-
.inputData(applicantData, addressData)
|
|
107
|
-
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
108
|
-
.workflow(flowId!!.toLong())
|
|
109
|
-
// .workflowDefaultIdentity(config?.get("defaultIdType") as
|
|
110
|
-
// String)
|
|
111
|
-
} else {
|
|
112
|
-
QoreIDParams()
|
|
113
|
-
.clientId(config?.get("clientId") as String)
|
|
114
|
-
.customerReference(config?.get("customerReference") as String)
|
|
115
|
-
.inputData(applicantData, addressData)
|
|
116
|
-
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
117
|
-
.collection(config?.get("productCode") as String)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
QoreIDSdk.s(BuildConfig.s)
|
|
121
|
-
QoreIDSdk.params(qoreIDParams)
|
|
122
|
-
QoreIDSdk.launch(requireNotNull(currentActivity))
|
|
90
|
+
val config = data?.get("config") as? HashMap<*, *>
|
|
91
|
+
val apD = data?.get("applicantData") as? HashMap<*, *>
|
|
92
|
+
val applicantData =
|
|
93
|
+
ApplicantData(
|
|
94
|
+
apD?.get("firstName") as String,
|
|
95
|
+
apD?.get("lastName") as String,
|
|
96
|
+
apD?.get("phoneNumber") as String?,
|
|
97
|
+
apD?.get("middleName") as String?,
|
|
98
|
+
apD?.get("dob") as String?,
|
|
99
|
+
apD?.get("email") as String?,
|
|
100
|
+
apD?.get("gender") as String?
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
val adD = data?.get("addressData") as? HashMap<*, *>
|
|
104
|
+
val addressData =
|
|
105
|
+
AddressData(
|
|
106
|
+
adD?.get("address") as String?,
|
|
107
|
+
adD?.get("city") as String?,
|
|
108
|
+
adD?.get("lga") as String?,
|
|
109
|
+
adD?.get("state") as String?,
|
|
110
|
+
)
|
|
111
|
+
val flowId = config?.get("flowId") as? Double
|
|
112
|
+
|
|
113
|
+
val _extraData = data?.get("extraData") as? HashMap<*, *>?
|
|
114
|
+
var extraData: VerificationExtraData? = null
|
|
115
|
+
|
|
116
|
+
if (!_extraData.isNullOrEmpty()) {
|
|
117
|
+
extraData = VerificationExtraData(
|
|
118
|
+
_extraData.get("organisationId") as String,
|
|
119
|
+
_extraData.get("organisationName") as String,
|
|
120
|
+
_extraData?.get("requestSource") as String,
|
|
121
|
+
_extraData?.get("internalReferenceId") as String
|
|
122
|
+
)
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
125
|
+
val qoreIDParams =
|
|
126
|
+
if (flowId?.toLong() != 0L) {
|
|
127
|
+
QoreIDParams()
|
|
128
|
+
.clientId(config?.get("clientId") as String)
|
|
129
|
+
.customerReference(config?.get("customerReference") as String)
|
|
130
|
+
.inputData(applicantData, addressData, null, extraData)
|
|
131
|
+
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
132
|
+
.workflow(flowId!!.toLong())
|
|
133
|
+
.workflowDefaultIdentity(
|
|
134
|
+
config?.get("defaultIdType") as
|
|
135
|
+
String
|
|
136
|
+
)
|
|
137
|
+
} else {
|
|
138
|
+
QoreIDParams()
|
|
139
|
+
.clientId(config?.get("clientId") as String)
|
|
140
|
+
.customerReference(config?.get("customerReference") as String)
|
|
141
|
+
.inputData(applicantData, addressData, null, extraData)
|
|
142
|
+
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
143
|
+
.collection(config?.get("productCode") as String)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
QoreIDSdk.s(BuildConfig.s)
|
|
147
|
+
QoreIDSdk.params(qoreIDParams)
|
|
148
|
+
QoreIDSdk.launch(requireNotNull(currentActivity))
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
fun processQoreIDResult(context: ReactApplicationContext, qoreIdResult: QoreIDResult) {
|
|
152
|
+
when (qoreIdResult) {
|
|
153
|
+
is ErrorResult -> {
|
|
154
|
+
// Handle error.
|
|
155
|
+
val event =
|
|
156
|
+
Arguments.createMap().apply {
|
|
157
|
+
putString("code", qoreIdResult.code.toString())
|
|
158
|
+
putString("data", qoreIdResult.data.toString())
|
|
159
|
+
putString("message", qoreIdResult.message)
|
|
160
|
+
putString("event", "ERROR_RESULT")
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
sendEvent(context, "onResult", event)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
is SuccessResult -> {
|
|
167
|
+
// Handle success.
|
|
168
|
+
val event =
|
|
169
|
+
Arguments.createMap().apply {
|
|
170
|
+
putString("data", qoreIdResult.data.toString())
|
|
171
|
+
putString("message", qoreIdResult.message)
|
|
172
|
+
putString("event", "SUCCESS_RESULT")
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
sendEvent(context, "onResult", event)
|
|
176
|
+
}
|
|
151
177
|
}
|
|
178
|
+
}
|
|
152
179
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
180
|
+
private fun sendEvent(
|
|
181
|
+
reactContext: ReactApplicationContext,
|
|
182
|
+
eventName: String,
|
|
183
|
+
params: WritableMap?
|
|
184
|
+
) {
|
|
185
|
+
reactContext
|
|
186
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
187
|
+
.emit(eventName, params)
|
|
188
|
+
}
|
|
158
189
|
|
|
159
|
-
companion object {
|
|
160
|
-
const val NAME = "QoreidSdk"
|
|
161
190
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
191
|
+
companion object {
|
|
192
|
+
const val NAME = "QoreidSdk"
|
|
193
|
+
|
|
194
|
+
@JvmStatic
|
|
195
|
+
fun initialize(activity: Activity) {
|
|
196
|
+
QoreIDSdk.initialize(activity)
|
|
166
197
|
}
|
|
198
|
+
}
|
|
167
199
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
package com.qoreidsdk
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
3
|
import com.facebook.react.ReactPackage
|
|
6
4
|
import com.facebook.react.bridge.NativeModule
|
|
7
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
@@ -14,7 +12,6 @@ class QoreidSdkPackage : ReactPackage {
|
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
17
|
-
return
|
|
15
|
+
return emptyList()
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
}
|
package/ios/QoreidSdk.m
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
#import <React/RCTBridgeModule.h>
|
|
2
2
|
#import <UIKit/UIKit.h>
|
|
3
3
|
|
|
4
|
+
@interface RCT_EXTERN_MODULE (QoreidSdk, NSObject)
|
|
4
5
|
|
|
6
|
+
RCT_EXTERN_METHOD(launchQoreidSdk : (NSDictionary *)data)
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
RCT_EXTERN_METHOD (launchQoreidSdk: (NSDictionary *) data)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// Don't compile this code when we build for the old architecture.
|
|
12
|
-
#ifdef RCT_NEW_ARCH_ENABLED
|
|
13
|
-
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
14
|
-
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
15
|
-
{
|
|
16
|
-
return std::make_shared<facebook::react::NativeQoreidSdkSpecJSI>(params);
|
|
8
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
9
|
+
return NO;
|
|
17
10
|
}
|
|
18
|
-
#endif
|
|
19
11
|
|
|
20
12
|
@end
|
|
21
|
-
|