@qore-id/react-native-qoreid-sdk 1.1.1 → 1.1.3

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.
@@ -92,7 +92,7 @@ dependencies {
92
92
  // For < 0.71, this will be from the local maven repo
93
93
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
94
94
  //noinspection GradleDynamicVersion
95
- implementation 'com.qoreid:qoreid-sdk:1.1.40'
95
+ implementation 'com.qoreid:qoreid-sdk:+'
96
96
  // implementation 'com.qoreid:qoreid-sdk-dev-min:1.1.43'
97
97
  implementation "com.facebook.react:react-native:+"
98
98
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
@@ -1,6 +1,5 @@
1
1
  package com.qoreidsdk
2
2
 
3
-
4
3
  import android.app.Activity
5
4
  import android.content.Intent
6
5
  import android.os.Build
@@ -18,49 +17,49 @@ import com.qoreid.sdk.core.models.QoreIDResult
18
17
  import com.qoreid.sdk.core.models.SuccessResult
19
18
  import java.util.HashMap
20
19
 
21
-
22
20
  class QoreidSdkModule(val reactContext: ReactApplicationContext) :
23
- ReactContextBaseJavaModule(reactContext) {
21
+ ReactContextBaseJavaModule(reactContext) {
24
22
  private var qoreIdResult: QoreIDResult? = null
25
23
 
26
24
  private val activityEventListener =
27
- object : BaseActivityEventListener() {
28
- override fun onActivityResult(
29
- activity: Activity?,
30
- requestCode: Int,
31
- resultCode: Int,
32
- intent: Intent?
33
- ) {
34
-
35
- if (resultCode == QORE_ID_RESULT_CODE && intent != null) {
36
- qoreIdResult = if (Build.VERSION.SDK_INT < 33) {
37
- intent.extras?.getSerializable(QORE_ID_RESULT_EXTRA_KEY) as QoreIDResult
38
- } else {
39
- intent.extras?.getSerializable(
40
- QORE_ID_RESULT_EXTRA_KEY,
41
- QoreIDResult::class.java
42
- )
25
+ object : BaseActivityEventListener() {
26
+ override fun onActivityResult(
27
+ activity: Activity?,
28
+ requestCode: Int,
29
+ resultCode: Int,
30
+ intent: Intent?
31
+ ) {
32
+
33
+ if (resultCode == QORE_ID_RESULT_CODE && intent != null) {
34
+ qoreIdResult =
35
+ if (Build.VERSION.SDK_INT < 33) {
36
+ intent.extras?.getSerializable(QORE_ID_RESULT_EXTRA_KEY) as
37
+ QoreIDResult
38
+ } else {
39
+ intent.extras?.getSerializable(
40
+ QORE_ID_RESULT_EXTRA_KEY,
41
+ QoreIDResult::class.java
42
+ )
43
+ }
44
+ processQoreIDResult(reactContext, qoreIdResult!!)
43
45
  }
44
- processQoreIDResult(reactContext, qoreIdResult!!)
45
46
  }
46
47
  }
47
48
 
48
- }
49
-
50
-
51
49
  init {
52
50
  reactContext.addActivityEventListener(activityEventListener)
53
- // QoreIDSdk.Callbacks.onFlowRequestId {
54
- // Log.i("QORE_ID", it.toString())
55
- //
56
- // val event = Arguments.createMap().apply {
57
- // putString("data", it.toString())
58
- // putString("message", "QOREID SDK INITIALIZED")
59
- // putString("event", "SESSION_RESULT")
60
- // }
61
- //
62
- // sendEvent(reactContext, "onResult", event)
63
- // }
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)
62
+ }
64
63
  }
65
64
 
66
65
  override fun getName(): String {
@@ -72,87 +71,89 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
72
71
  val data = readableData.toHashMap()
73
72
 
74
73
  if (currentActivity == null) {
75
- Log.e("Error", "No current activity");
74
+ Log.e("Error", "No current activity")
76
75
  return
77
76
  }
78
77
 
79
78
  val config = data?.get("config") as? HashMap<*, *>
80
79
  val apD = data?.get("applicantData") as? HashMap<*, *>
81
- val applicantData = ApplicantData(
82
- apD?.get("firstName") as String,
83
- apD?.get("lastName") as String,
84
- apD?.get("phoneNumber") as String?,
85
- apD?.get("middleName") as String?,
86
- apD?.get("dob") as String?,
87
- apD?.get("gender") as String?
88
- )
89
-
80
+ val applicantData =
81
+ ApplicantData(
82
+ apD?.get("firstName") as String,
83
+ apD?.get("lastName") as String,
84
+ apD?.get("phoneNumber") as String?,
85
+ apD?.get("middleName") as String?,
86
+ apD?.get("dob") as String?,
87
+ apD?.get("email") as String?,
88
+ apD?.get("gender") as String?
89
+ )
90
90
 
91
91
  val adD = data?.get("addressData") as? HashMap<*, *>
92
- val addressData = AddressData(
93
- adD?.get("address") as String?,
94
- adD?.get("city") as String?,
95
- adD?.get("lga") as String?,
96
- adD?.get("state") as String?,
97
- )
92
+ val addressData =
93
+ AddressData(
94
+ adD?.get("address") as String?,
95
+ adD?.get("city") as String?,
96
+ adD?.get("lga") as String?,
97
+ adD?.get("state") as String?,
98
+ )
98
99
  val flowId = config?.get("flowId") as? Double
99
100
 
100
- val qoreIDParams = if (flowId?.toLong() != 0L) {
101
- QoreIDParams()
102
- .clientId(config?.get("clientId") as String)
103
- .customerReference(config?.get("customerReference") as String)
104
- .inputData(applicantData, addressData)
105
- .ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
106
- .workflow(flowId!!.toLong())
107
- // .workflowDefaultIdentity(config?.get("defaultIdType") as String)
108
- } else {
109
- QoreIDParams()
110
- .clientId(config?.get("clientId") as String)
111
- .customerReference(config?.get("customerReference") as String)
112
- .inputData(applicantData, addressData)
113
- .ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
114
- .collection(config?.get("productCode") as String)
115
- }
101
+ val qoreIDParams =
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
+ }
116
119
 
117
- QoreIDSdk.s(BuildConfig.s);
120
+ QoreIDSdk.s(BuildConfig.s)
118
121
  QoreIDSdk.params(qoreIDParams)
119
122
  QoreIDSdk.launch(requireNotNull(currentActivity))
120
-
121
123
  }
122
124
 
123
125
  fun processQoreIDResult(context: ReactContext, qoreIdResult: QoreIDResult) {
124
126
  when (qoreIdResult) {
125
127
  is ErrorResult -> {
126
128
  // Handle error.
127
- val event = Arguments.createMap().apply {
128
- putString("code", qoreIdResult.code.toString())
129
- putString("data", qoreIdResult.data.toString())
130
- putString("message", qoreIdResult.message)
131
- putString("event", "ERROR_RESULT")
132
- }
129
+ val event =
130
+ Arguments.createMap().apply {
131
+ putString("code", qoreIdResult.code.toString())
132
+ putString("data", qoreIdResult.data.toString())
133
+ putString("message", qoreIdResult.message)
134
+ putString("event", "ERROR_RESULT")
135
+ }
133
136
 
134
137
  sendEvent(context, "onResult", event)
135
-
136
138
  }
137
-
138
139
  is SuccessResult -> {
139
140
  // Handle success.
140
- val event = Arguments.createMap().apply {
141
- putString("data", qoreIdResult.data.toString())
142
- putString("message", qoreIdResult.message)
143
- putString("event", "SUCCESS_RESULT")
144
- }
141
+ val event =
142
+ Arguments.createMap().apply {
143
+ putString("data", qoreIdResult.data.toString())
144
+ putString("message", qoreIdResult.message)
145
+ putString("event", "SUCCESS_RESULT")
146
+ }
145
147
 
146
148
  sendEvent(context, "onResult", event)
147
149
  }
148
150
  }
149
151
  }
150
152
 
151
-
152
153
  private fun sendEvent(reactContext: ReactContext, eventName: String, params: WritableMap?) {
153
154
  reactContext
154
- .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
155
- .emit(eventName, params)
155
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
156
+ .emit(eventName, params)
156
157
  }
157
158
 
158
159
  companion object {
@@ -160,7 +161,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
160
161
 
161
162
  @JvmStatic
162
163
  fun initialize(activity: Activity) {
163
- QoreIDSdk.initialize(activity);
164
+ QoreIDSdk.initialize(activity)
164
165
  }
165
166
  }
166
167
  }
@@ -27,7 +27,9 @@ class QoreidSdk: RCTEventEmitter {
27
27
  firstname:_applicant?["firstName"] as? String,
28
28
  lastname:_applicant?["lastName"] as? String,
29
29
  phone: _applicant?["phoneNumber"] as? String,
30
- middlename: _applicant?["middleName"] as? String
30
+ middlename: _applicant?["middleName"] as? String,
31
+ dob: _applicant?["dob"] as? String,
32
+ email: _applicant?["email"] as? String
31
33
  )
32
34
 
33
35
  let addressData = AddressData(
@@ -69,7 +71,7 @@ class QoreidSdk: RCTEventEmitter {
69
71
  if let params = param {
70
72
  DispatchQueue.main.async {
71
73
  let vc = ViewController()
72
- vc.param = param
74
+ vc.param = params
73
75
  vc.onQoreIdResult = { [weak self] result in
74
76
  self?.onQoreIdResultReceived(result: result)
75
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qore-id/react-native-qoreid-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "QoreId React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
  s.dependency "React-Core"
19
- s.dependency 'QoreIDSDK', '1.0.1'
19
+ s.dependency 'QoreIDSDK'
20
20
 
21
21
  # Don't install the dependencies when we run `pod install` in the old architecture.
22
22
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then