assentify-sdk-react-native 0.0.16 → 0.0.17

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.
Files changed (40) hide show
  1. package/README.md +5 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +47 -45
  4. package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +7 -16
  5. package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +15 -36
  6. package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +8 -14
  7. package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +11 -18
  8. package/assentify-sdk.podspec +1 -1
  9. package/ios/NativeAssentifySdk.mm +4 -0
  10. package/ios/NativeAssentifySdk.swift +34 -25
  11. package/ios/View/FaceMatchController.swift +5 -3
  12. package/ios/View/IDCardController.swift +5 -4
  13. package/ios/View/OtherController.swift +5 -4
  14. package/ios/View/PassportController.swift +6 -5
  15. package/lib/commonjs/AssentifyProvider.js +3 -1
  16. package/lib/commonjs/AssentifyProvider.js.map +1 -1
  17. package/lib/commonjs/AssentifyWrapper.js +8 -8
  18. package/lib/commonjs/AssentifyWrapper.js.map +1 -1
  19. package/lib/module/AssentifyProvider.js +3 -1
  20. package/lib/module/AssentifyProvider.js.map +1 -1
  21. package/lib/module/AssentifyWrapper.js +8 -8
  22. package/lib/module/AssentifyWrapper.js.map +1 -1
  23. package/lib/typescript/example/src/Home.d.ts.map +1 -1
  24. package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
  25. package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +4 -4
  26. package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
  27. package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
  28. package/lib/typescript/lib/module/AssentifyWrapper.d.ts +4 -4
  29. package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
  30. package/lib/typescript/lib/module/index.d.ts +4 -4
  31. package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
  32. package/lib/typescript/src/AssentifyWrapper.d.ts +4 -4
  33. package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
  34. package/lib/typescript/src/index.d.ts +4 -4
  35. package/lib/typescript/src/types.d.ts +4 -0
  36. package/lib/typescript/src/types.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/src/AssentifyProvider.tsx +3 -1
  39. package/src/AssentifyWrapper.ts +8 -8
  40. package/src/types.ts +5 -0
package/README.md CHANGED
@@ -92,6 +92,11 @@ yarn add assentify-sdk-react-native
92
92
  ```
93
93
 
94
94
  ## Versions
95
+
96
+ **0.0.17**
97
+ - Active liveness improvements
98
+ - Multiple Steps handling
99
+
95
100
  **0.0.16**
96
101
  - Active liveness
97
102
 
@@ -99,7 +99,7 @@ dependencies {
99
99
  implementation "com.facebook.react:react-native:+"
100
100
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
101
101
 
102
- implementation 'com.github.AssentifyLTD:Assentify.SDK.Android:0.0.68'
102
+ implementation 'com.github.AssentifyLTD:Assentify.SDK.Android:0.0.69'
103
103
 
104
104
  /* Assentify Sdk Dependencies */
105
105
  implementation 'com.google.code.gson:gson:2.8.9'
@@ -15,6 +15,7 @@ import android.util.Log
15
15
  import com.assentify.sdk.Core.Constants.EnvironmentalConditions
16
16
  import com.assentify.sdk.RemoteClient.Models.ConfigModel
17
17
  import com.assentify.sdk.RemoteClient.Models.StepDefinitions
18
+ import com.assentify.sdk.RemoteClient.Models.StepMap
18
19
  import com.assentify.sdk.RemoteClient.Models.TemplatesByCountry
19
20
  import com.assentify.sdk.RemoteClient.Models.encodeTemplatesByCountryToJson
20
21
  import com.assentify.sdk.SubmitData.SubmitDataCallback
@@ -51,6 +52,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
51
52
  private lateinit var contextAwareSigning: ContextAwareSigning;
52
53
  private lateinit var userDocumentResponseModel: CreateUserDocumentResponseModel;
53
54
  private var documentURL = "";
55
+
54
56
  @ReactMethod
55
57
  fun initialize(
56
58
  apiKey: String,
@@ -130,7 +132,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
130
132
  }
131
133
 
132
134
  @ReactMethod
133
- fun startScanPassport(language: String) {
135
+ fun startScanPassport(language: String,stepID :Int) {
134
136
  timeStarted = getCurrentDateTimeUTC();
135
137
  /** Nav To Passport Scan Page */
136
138
  val intent = Intent(reactApplicationContext, ScanPassportActivity::class.java)
@@ -141,12 +143,13 @@ class AssentifySdkModule(context: ReactApplicationContext) :
141
143
  intent.putExtra("language", language)
142
144
  intent.putExtra("showCountDown", true)
143
145
  intent.putExtra("apiKey", this.apiKey)
146
+ intent.putExtra("stepID", stepID)
144
147
  reactApplicationContext?.startActivity(intent)
145
148
  }
146
149
  }
147
150
 
148
151
  @ReactMethod
149
- fun startScanOtherIDPage(language: String) {
152
+ fun startScanOtherIDPage(language: String ,stepID :Int) {
150
153
  timeStarted = getCurrentDateTimeUTC();
151
154
  /** Nav To Other Scan Page */
152
155
  val intent = Intent(currentActivity, ScanOtherActivity::class.java)
@@ -156,6 +159,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
156
159
  intent.putExtra("language", language)
157
160
  intent.putExtra("showCountDown", true)
158
161
  intent.putExtra("apiKey", this.apiKey)
162
+ intent.putExtra("stepID", stepID)
159
163
  currentActivity?.startActivity(intent)
160
164
  }
161
165
 
@@ -164,6 +168,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
164
168
  jsonStringKycDocumentDetails: String,
165
169
  language: String,
166
170
  flippingCard: Boolean,
171
+ stepID :Int
167
172
  ) {
168
173
  timeStarted = getCurrentDateTimeUTC();
169
174
  try {
@@ -178,6 +183,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
178
183
  intent.putExtra("title", getIdTitle(jsonStringKycDocumentDetails!!))
179
184
  intent.putExtra("showCountDown", true)
180
185
  intent.putExtra("apiKey", this.apiKey)
186
+ intent.putExtra("stepID", stepID)
181
187
  currentActivity?.startActivity(intent)
182
188
  } catch (e: Exception) {
183
189
  Log.e(NAME, e.toString())
@@ -185,7 +191,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
185
191
  }
186
192
 
187
193
  @ReactMethod
188
- fun startFaceMatch(imageUrl: String, showCountDown: Boolean) {
194
+ fun startFaceMatch(imageUrl: String, showCountDown: Boolean,stepID :Int) {
189
195
  /** Nav To Face Match Page **/
190
196
  var base64Image = ImageToBase64Converter(apiKey).execute(imageUrl).get()
191
197
  val sharedPreferences = reactApplicationContext.getSharedPreferences(
@@ -200,6 +206,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
200
206
  intent.putExtra("holdHandColor", environmentalConditions.HoldHandColor)
201
207
  intent.putExtra("processingColor", environmentalConditions.CustomColor)
202
208
  intent.putExtra("showCountDown", showCountDown)
209
+ intent.putExtra("stepID", stepID)
203
210
  currentActivity?.startActivity(intent)
204
211
  }
205
212
 
@@ -217,7 +224,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
217
224
  try {
218
225
  val documentCaptureStepModelPreferences =
219
226
  reactApplicationContext.getSharedPreferences(
220
- "DocumentCaptureStepModel",
227
+ "SubmitStepModel",
221
228
  Context.MODE_PRIVATE
222
229
  )
223
230
  documentCaptureStepModelPreferences.edit().clear().apply()
@@ -230,6 +237,8 @@ class AssentifySdkModule(context: ReactApplicationContext) :
230
237
  editor.putString("Steps", json)
231
238
  editor.apply()
232
239
 
240
+ val jsonStepDefinitions: String = gson.toJson(configModel.stepDefinitions)
241
+
233
242
  /** Store React Application Context */
234
243
  AssentifySdkObject.setAssentifySdkObject(assentifySdk)
235
244
  ReactApplicationContextObject.setReactApplicationContextObject(reactApplicationContext)
@@ -244,9 +253,10 @@ class AssentifySdkModule(context: ReactApplicationContext) :
244
253
 
245
254
  val eventResultMap =
246
255
  Arguments.createMap().apply {
247
- val jsonString = encodeTemplatesByCountryToJson(templatesByCountry)
256
+ val jsonTemplates = encodeTemplatesByCountryToJson(templatesByCountry)
248
257
  putBoolean("assentifySdkInitSuccess", true)
249
- putString("AssentifySdkHasTemplates", jsonString)
258
+ putString("AssentifySdkHasTemplates", jsonTemplates)
259
+ putString("StepDefinitions", jsonStepDefinitions)
250
260
  }
251
261
  sendEvent("AppResult", eventResultMap)
252
262
  } catch (e: Exception) {
@@ -269,7 +279,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
269
279
  var wrapUp: SubmitRequestModel? = null
270
280
  var blockLoader: SubmitRequestModel? = null
271
281
  var contextAwareSigningModel: SubmitRequestModel? = null
272
-
282
+ var submitRequestList: MutableList<SubmitRequestModel> = mutableListOf()
273
283
  val sharedStepDefinitions =
274
284
  reactApplicationContext.getSharedPreferences("StepDefinitions", Context.MODE_PRIVATE)
275
285
  val gson = Gson()
@@ -279,21 +289,21 @@ class AssentifySdkModule(context: ReactApplicationContext) :
279
289
 
280
290
  steps!!.forEach { item ->
281
291
  // ** Context Aware Signing *//
282
- if(this.documentURL != ""){
283
- if (item.stepDefinition == StepsName.ContextAwareSigning) {
292
+ if (item.stepDefinition == StepsName.ContextAwareSigning) {
293
+ if (this.documentURL != "") {
284
294
  val values: MutableMap<String, String> = mutableMapOf()
285
295
  item.outputProperties.forEach { property ->
286
296
  if (property.key.contains(ContextAwareSigningKeys.DocumentURL)) {
287
297
  values.put(property.key, this.documentURL)
288
298
  }
289
299
  }
290
- contextAwareSigningModel = SubmitRequestModel(item.stepId, StepsName.ContextAwareSigning, values)
300
+ contextAwareSigningModel =
301
+ SubmitRequestModel(item.stepId, StepsName.ContextAwareSigning, values)
291
302
  }
292
303
  }
293
304
 
294
-
295
305
  // ** WrapUp *//
296
- if (item.stepDefinition == StepsName.WrapUp) {
306
+ else if (item.stepDefinition == StepsName.WrapUp) {
297
307
  val values: MutableMap<String, String> = mutableMapOf()
298
308
  item.outputProperties.forEach { property ->
299
309
  if (property.key.contains(WrapUpKeys.TimeEnded)) {
@@ -303,7 +313,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
303
313
  wrapUp = SubmitRequestModel(item.stepId, StepsName.WrapUp, values)
304
314
  }
305
315
  // ** BlockLoader *//
306
- if (item.stepDefinition == StepsName.BlockLoader) {
316
+ else if (item.stepDefinition == StepsName.BlockLoader) {
307
317
  val values: MutableMap<String, String> = mutableMapOf()
308
318
  item.outputProperties.forEach { property ->
309
319
  if (property.key.contains(BlockLoaderKeys.TimeStarted)) {
@@ -335,47 +345,34 @@ class AssentifySdkModule(context: ReactApplicationContext) :
335
345
  }
336
346
 
337
347
  blockLoader = SubmitRequestModel(item.stepId, StepsName.BlockLoader, values)
348
+ } else {
349
+ // ** Created Steps *//
350
+ val sharedStepDefinitionsDoc =
351
+ reactApplicationContext.getSharedPreferences(
352
+ "SubmitStepModel",
353
+ Context.MODE_PRIVATE
354
+ )
355
+ val gsonSharedStepDefinitions = Gson()
356
+ val jsonSharedStepDefinitions: String =
357
+ sharedStepDefinitionsDoc.getString(item.stepId.toString(), "")!!
358
+ val sharedStepDefinitionsStep: SubmitRequestModel =
359
+ gsonSharedStepDefinitions.fromJson(
360
+ jsonSharedStepDefinitions,
361
+ object : TypeToken<SubmitRequestModel>() {}.type
362
+ )
363
+ submitRequestList.add(sharedStepDefinitionsStep)
338
364
  }
339
365
  }
340
366
 
341
- // ** Doc *//
342
- val sharedStepDefinitionsDoc =
343
- reactApplicationContext.getSharedPreferences(
344
- "DocumentCaptureStepModel",
345
- Context.MODE_PRIVATE
346
- )
347
- val gsonSharedStepDefinitionsDoc = Gson()
348
- val jsonSharedStepDefinitionsDoc: String =
349
- sharedStepDefinitionsDoc.getString("DocumentCaptureStep", "")!!
350
- val sharedStepDefinitionsStepDoc: SubmitRequestModel =
351
- gsonSharedStepDefinitionsDoc.fromJson(
352
- jsonSharedStepDefinitionsDoc,
353
- object : TypeToken<SubmitRequestModel>() {}.type
354
- )
355
367
 
356
- // ** Face *//
357
- val sharedStepDefinitionsFace =
358
- reactApplicationContext.getSharedPreferences("FaceMatchStepModel", Context.MODE_PRIVATE)
359
- val gsonSharedStepDefinitionsFace = Gson()
360
- val jsonSharedStepDefinitionsFace: String =
361
- sharedStepDefinitionsFace.getString("FaceMatchStep", "")!!
362
- val sharedStepDefinitionsStepFace: SubmitRequestModel =
363
- gsonSharedStepDefinitionsFace.fromJson(
364
- jsonSharedStepDefinitionsFace,
365
- object : TypeToken<SubmitRequestModel>() {}.type
366
- )
367
368
 
368
- var submitRequestList: MutableList<SubmitRequestModel> = mutableListOf()
369
- submitRequestList.add(sharedStepDefinitionsStepDoc)
370
- submitRequestList.add(sharedStepDefinitionsStepFace)
371
369
  submitRequestList.add(wrapUp!!)
372
370
  submitRequestList.add(blockLoader!!)
373
- if(contextAwareSigningModel !=null){
371
+ if (contextAwareSigningModel != null) {
374
372
  submitRequestList.add(contextAwareSigningModel!!)
375
373
  }
376
374
 
377
375
 
378
-
379
376
  assentifySdk.startSubmitData(this@AssentifySdkModule, submitRequestList)
380
377
  }
381
378
  }
@@ -406,13 +403,18 @@ class AssentifySdkModule(context: ReactApplicationContext) :
406
403
 
407
404
  @ReactMethod
408
405
  fun createUserDocumentInstance(data: ReadableMap? = null) {
409
- val map: Map<String, String> = data?.toHashMap()?.mapValues { it.value.toString() } ?: emptyMap()
406
+ val map: Map<String, String> =
407
+ data?.toHashMap()?.mapValues { it.value.toString() } ?: emptyMap()
410
408
  contextAwareSigning.createUserDocumentInstance(map)
411
409
  }
412
410
 
413
411
  @ReactMethod
414
412
  fun signature(signature: String) {
415
- contextAwareSigning.signature(this.userDocumentResponseModel.templateInstanceId,this.userDocumentResponseModel.documentId,signature);
413
+ contextAwareSigning.signature(
414
+ this.userDocumentResponseModel.templateInstanceId,
415
+ this.userDocumentResponseModel.documentId,
416
+ signature
417
+ );
416
418
  }
417
419
 
418
420
 
@@ -20,6 +20,7 @@ import com.assentify.sdk.Models.encodeBaseResponseDataModelToJson
20
20
  import com.assentify.sdk.RemoteClient.Models.KycDocumentDetails
21
21
  import com.assentify.sdk.FaceMatch.FaceMatchCallback
22
22
  import com.assentify.sdk.RemoteClient.Models.StepDefinitions
23
+ import com.assentify.sdk.RemoteClient.Models.StepMap
23
24
  import com.assentify.sdk.FaceMatch.FaceResponseModel
24
25
  import com.assentify.sdk.FaceMatch.FaceMatch
25
26
  import com.google.gson.Gson
@@ -31,7 +32,6 @@ import android.content.Intent
31
32
  import com.facebook.react.modules.core.DeviceEventManagerModule
32
33
  import com.facebook.react.bridge.Arguments
33
34
  import com.facebook.react.bridge.ReactApplicationContext
34
- import android.util.Log
35
35
  import com.assentify.sdk.Core.Constants.BrightnessEvents
36
36
  import com.assentify.sdk.Core.Constants.FaceEvents
37
37
  import com.assentify.sdk.Core.Constants.ActiveLiveEvents
@@ -55,6 +55,7 @@ private lateinit var assentifySdk: AssentifySdk
55
55
  private lateinit var processingColor: String;
56
56
  private var showCountDown: Boolean = true;
57
57
  private var start: Boolean = false;
58
+ private var stepID: Int = -1;
58
59
  private var currentActiveLiveEvents: ActiveLiveEvents = ActiveLiveEvents.Good
59
60
 
60
61
 
@@ -66,6 +67,7 @@ private lateinit var assentifySdk: AssentifySdk
66
67
  showCountDown = intent.getBooleanExtra("showCountDown",true)
67
68
  holdHandColor = intent.getStringExtra("holdHandColor")!!
68
69
  processingColor = intent.getStringExtra("processingColor")!!
70
+ stepID = intent.getIntExtra("stepID",-1)!!
69
71
 
70
72
  startAssentifySdk()
71
73
 
@@ -171,7 +173,7 @@ private lateinit var assentifySdk: AssentifySdk
171
173
  faceMatch = assentifySdk!!.startFaceMatch(
172
174
  this@FaceMatchActivity,
173
175
  base64SecondImage!!,
174
- showCountDown
176
+ showCountDown,stepID!!
175
177
  );
176
178
  Thread.sleep(500);
177
179
  var fragmentManager = supportFragmentManager
@@ -216,30 +218,19 @@ private lateinit var assentifySdk: AssentifySdk
216
218
 
217
219
  override fun onComplete(dataModel: FaceResponseModel) {
218
220
  triggerCompleteEvent("onComplete",dataModel)
219
- val sharedStepDefinitions =
220
- reactApplicationContext.getSharedPreferences("StepDefinitions", Context.MODE_PRIVATE)
221
- val gson = Gson()
222
- val json: String = sharedStepDefinitions.getString("Steps", "")!!
223
- val steps: List<StepDefinitions>? =
224
- gson.fromJson(json, object : TypeToken<List<StepDefinitions>>() {}.type)
225
- steps!!.forEach { item ->
226
- if (item.stepDefinition == StepsName.FaceMatch) {
221
+ val documentCaptureSharedPreferences = reactApplicationContext.getSharedPreferences("SubmitStepModel", Context.MODE_PRIVATE)
227
222
  val documentCaptureModel = SubmitRequestModel(
228
- item.stepId, StepsName.FaceMatch,
223
+ stepID, StepsName.FaceMatch,
229
224
  convertMap(dataModel.faceExtractedModel!!.outputProperties)
230
225
  );
231
- val documentCaptureSharedPreferences =
232
- reactApplicationContext.getSharedPreferences("FaceMatchStepModel", Context.MODE_PRIVATE)
233
226
  val documentCaptureSharedPreferencesEditor = documentCaptureSharedPreferences.edit()
234
227
  val documentCaptureGson = Gson()
235
228
  val documentCaptureStep: String = documentCaptureGson.toJson(documentCaptureModel)
236
229
  documentCaptureSharedPreferencesEditor.putString(
237
- "FaceMatchStep",
230
+ stepID.toString(),
238
231
  documentCaptureStep
239
232
  );
240
233
  documentCaptureSharedPreferencesEditor.apply()
241
- }
242
- }
243
234
 
244
235
  runOnUiThread{
245
236
  start = false
@@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken
27
27
  import com.facebook.react.bridge.ReactApplicationContext
28
28
  import pl.droidsonroids.gif.GifImageView
29
29
  import com.assentify.sdk.RemoteClient.Models.StepDefinitions
30
+ import com.assentify.sdk.RemoteClient.Models.StepMap
30
31
  import ImageToBase64Converter
31
32
  import android.content.Intent
32
33
  import com.assentify.sdk.Core.Constants.BrightnessEvents
@@ -63,7 +64,7 @@ class ScanIDActivity: AppCompatActivity(),
63
64
  private var showCountDown: Boolean = true;
64
65
  private var apiKey: String = "";
65
66
  val values: MutableMap<String, String> = mutableMapOf()
66
-
67
+ private var stepID: Int = -1;
67
68
  override fun onCreate(savedInstanceState: Bundle?) {
68
69
  super.onCreate(savedInstanceState)
69
70
  setContentView(R.layout.activity_scan)
@@ -81,6 +82,7 @@ class ScanIDActivity: AppCompatActivity(),
81
82
  isFlippingCard = intent.getBooleanExtra("flippingCard",false)!!
82
83
  showCountDown = intent.getBooleanExtra("showCountDown",true)
83
84
  apiKey = intent.getStringExtra("apiKey")!!
85
+ stepID = intent.getIntExtra("stepID",-1)!!
84
86
  startAssentifySdk()
85
87
 
86
88
 
@@ -192,7 +194,7 @@ class ScanIDActivity: AppCompatActivity(),
192
194
  fun startAssentifySdk() {
193
195
  assentifySdk = AssentifySdkObject.getAssentifySdkObject();
194
196
  scanID = assentifySdk!!.startScanIDCard(
195
- this@ScanIDActivity,kycDocumentDetails,language
197
+ this@ScanIDActivity,kycDocumentDetails,language,stepID!!
196
198
  );
197
199
  Thread.sleep(500);
198
200
  var fragmentManager = supportFragmentManager
@@ -254,35 +256,24 @@ class ScanIDActivity: AppCompatActivity(),
254
256
  if(order == kycDocumentDetails.size -1 ){
255
257
  scanID.stopScanning();
256
258
  /** Data To Submit **/
257
- val sharedStepDefinitions =
258
- getSharedPreferences("StepDefinitions", Context.MODE_PRIVATE)
259
- val gson = Gson()
260
- val json: String = sharedStepDefinitions.getString("Steps", "")!!
261
- val steps: List<StepDefinitions>? =
262
- gson.fromJson(json, object : TypeToken<List<StepDefinitions>>() {}.type)
263
- steps!!.forEach { item ->
264
- if (item.stepDefinition == StepsName.DocumentCapture) {
259
+
260
+ val documentCaptureSharedPreferences = reactApplicationContext.getSharedPreferences("SubmitStepModel", Context.MODE_PRIVATE)
265
261
  val documentCaptureModel = SubmitRequestModel(
266
- item.stepId!!, item.stepDefinition,
262
+ stepID!!,StepsName.DocumentCapture,
267
263
  values
268
264
  );
269
- val documentCaptureSharedPreferences =
270
- getSharedPreferences(
271
- "DocumentCaptureStepModel",
272
- Context.MODE_PRIVATE
273
- )
274
265
  val documentCaptureSharedPreferencesEditor =
275
266
  documentCaptureSharedPreferences.edit()
276
267
  val documentCaptureGson = Gson()
277
268
  val documentCaptureStep: String =
278
269
  documentCaptureGson.toJson(documentCaptureModel)
279
270
  documentCaptureSharedPreferencesEditor.putString(
280
- "DocumentCaptureStep",
271
+ stepID.toString(),
281
272
  documentCaptureStep
282
273
  );
283
274
  documentCaptureSharedPreferencesEditor.apply()
284
- }
285
- }
275
+
276
+
286
277
  /** **/
287
278
  runOnUiThread {
288
279
  finish()
@@ -311,35 +302,23 @@ class ScanIDActivity: AppCompatActivity(),
311
302
  }else{
312
303
  scanID.stopScanning();
313
304
  /** Data To Submit **/
314
- val sharedStepDefinitions =
315
- getSharedPreferences("StepDefinitions", Context.MODE_PRIVATE)
316
- val gson = Gson()
317
- val json: String = sharedStepDefinitions.getString("Steps", "")!!
318
- val steps: List<StepDefinitions>? =
319
- gson.fromJson(json, object : TypeToken<List<StepDefinitions>>() {}.type)
320
- steps!!.forEach { item ->
321
- if (item.stepDefinition == StepsName.DocumentCapture) {
305
+ val documentCaptureSharedPreferences = reactApplicationContext.getSharedPreferences("SubmitStepModel", Context.MODE_PRIVATE)
322
306
  val documentCaptureModel = SubmitRequestModel(
323
- item.stepId!!, item.stepDefinition,
307
+ stepID!!,StepsName.DocumentCapture,
324
308
  values
325
309
  );
326
- val documentCaptureSharedPreferences =
327
- getSharedPreferences(
328
- "DocumentCaptureStepModel",
329
- Context.MODE_PRIVATE
330
- )
331
310
  val documentCaptureSharedPreferencesEditor =
332
311
  documentCaptureSharedPreferences.edit()
333
312
  val documentCaptureGson = Gson()
334
313
  val documentCaptureStep: String =
335
314
  documentCaptureGson.toJson(documentCaptureModel)
336
315
  documentCaptureSharedPreferencesEditor.putString(
337
- "DocumentCaptureStep",
316
+ stepID.toString(),
338
317
  documentCaptureStep
339
318
  );
340
319
  documentCaptureSharedPreferencesEditor.apply()
341
- }
342
- }
320
+
321
+
343
322
  /** **/
344
323
  runOnUiThread {
345
324
  finish()
@@ -58,6 +58,7 @@ class ScanOtherActivity: AppCompatActivity(),
58
58
  private var start: Boolean = false;
59
59
  private var showCountDown: Boolean = true;
60
60
  private var apiKey: String = "";
61
+ private var stepID: Int = -1;
61
62
  override fun onCreate(savedInstanceState: Bundle?) {
62
63
  super.onCreate(savedInstanceState)
63
64
  setContentView(R.layout.activity_scan)
@@ -67,6 +68,7 @@ class ScanOtherActivity: AppCompatActivity(),
67
68
  language = intent.getStringExtra("language")!!
68
69
  apiKey = intent.getStringExtra("apiKey")!!
69
70
  showCountDown = intent.getBooleanExtra("showCountDown",true)
71
+ stepID = intent.getIntExtra("stepID",-1)!!
70
72
  startAssentifySdk()
71
73
 
72
74
 
@@ -174,7 +176,7 @@ class ScanOtherActivity: AppCompatActivity(),
174
176
  assentifySdk = AssentifySdkObject.getAssentifySdkObject();
175
177
  scanOther = assentifySdk!!.startScanOther(
176
178
  this@ScanOtherActivity,
177
- language
179
+ language,stepID!!
178
180
  );
179
181
  Thread.sleep(500);
180
182
  var fragmentManager = supportFragmentManager
@@ -215,26 +217,18 @@ class ScanOtherActivity: AppCompatActivity(),
215
217
  override fun onComplete(dataModel: OtherResponseModel) {
216
218
  triggerCompleteEvent("onComplete",dataModel)
217
219
  /** Steps **/
218
- val sharedStepDefinitions =
219
- reactApplicationContext.getSharedPreferences("StepDefinitions", Context.MODE_PRIVATE)
220
- val gson = Gson()
221
- val json: String = sharedStepDefinitions.getString("Steps", "")!!
222
- val steps: List<StepDefinitions>? =
223
- gson.fromJson(json, object : TypeToken<List<StepDefinitions>>() {}.type)
224
- steps!!.forEach { item ->
225
- if (item.stepDefinition == StepsName.DocumentCapture) {
220
+ val documentCaptureSharedPreferences = reactApplicationContext.getSharedPreferences("SubmitStepModel", Context.MODE_PRIVATE)
226
221
  val documentCaptureModel = SubmitRequestModel(
227
- item.stepId, StepsName.DocumentCapture,
222
+ stepID, StepsName.DocumentCapture,
228
223
  convertMap(dataModel.otherExtractedModel!!.transformedProperties)
229
224
  );
230
- val documentCaptureSharedPreferences = reactApplicationContext.getSharedPreferences("DocumentCaptureStepModel", Context.MODE_PRIVATE)
231
225
  val documentCaptureSharedPreferencesEditor = documentCaptureSharedPreferences.edit()
232
226
  val documentCaptureGson = Gson()
233
227
  val documentCaptureStep: String = documentCaptureGson.toJson(documentCaptureModel)
234
- documentCaptureSharedPreferencesEditor.putString("DocumentCaptureStep", documentCaptureStep);
228
+ documentCaptureSharedPreferencesEditor.putString(stepID.toString(), documentCaptureStep);
235
229
  documentCaptureSharedPreferencesEditor.apply()
236
- }
237
- }
230
+
231
+
238
232
  /** End **/
239
233
  runOnUiThread {
240
234
  scanOther.stopScanning();
@@ -17,6 +17,7 @@ import androidx.appcompat.widget.Toolbar
17
17
  import com.google.gson.Gson
18
18
  import com.google.gson.reflect.TypeToken
19
19
  import com.assentify.sdk.RemoteClient.Models.StepDefinitions
20
+ import com.assentify.sdk.RemoteClient.Models.StepMap
20
21
  import com.assentify.sdk.Models.BaseResponseDataModel
21
22
  import com.assentify.sdk.ScanPassport.PassportResponseModel
22
23
  import com.assentify.sdk.ScanPassport.ScanPassportCallback
@@ -33,7 +34,6 @@ import android.graphics.PorterDuff
33
34
  import android.widget.LinearLayout
34
35
  import android.widget.RelativeLayout
35
36
  import java.text.SimpleDateFormat
36
- import android.util.Log
37
37
  import com.assentify.sdk.Core.Constants.BrightnessEvents
38
38
 
39
39
  class ScanPassportActivity : AppCompatActivity(),
@@ -58,6 +58,7 @@ class ScanPassportActivity : AppCompatActivity(),
58
58
  private var start: Boolean = false;
59
59
  private var isDone: Boolean = false;
60
60
  private var apiKey: String = "";
61
+ private var stepID: Int = -1;
61
62
 
62
63
  override fun onCreate(savedInstanceState: Bundle?) {
63
64
  super.onCreate(savedInstanceState)
@@ -68,6 +69,7 @@ class ScanPassportActivity : AppCompatActivity(),
68
69
  language = intent.getStringExtra("language")!!
69
70
  apiKey = intent.getStringExtra("apiKey")!!
70
71
  showCountDown = intent.getBooleanExtra("showCountDown",true)
72
+ stepID = intent.getIntExtra("stepID",-1)!!
71
73
 
72
74
  startAssentifySdk()
73
75
 
@@ -174,7 +176,7 @@ class ScanPassportActivity : AppCompatActivity(),
174
176
  assentifySdk = AssentifySdkObject.getAssentifySdkObject();
175
177
  scanPassport = assentifySdk!!.startScanPassport(
176
178
  this@ScanPassportActivity,
177
- language
179
+ language,stepID!!
178
180
  );
179
181
  Thread.sleep(500);
180
182
  var fragmentManager = supportFragmentManager
@@ -228,31 +230,22 @@ class ScanPassportActivity : AppCompatActivity(),
228
230
  } else {
229
231
  triggerCompleteEvent("onComplete", dataModel)
230
232
  /** Steps **/
231
- val sharedStepDefinitions =
232
- reactApplicationContext.getSharedPreferences("StepDefinitions", Context.MODE_PRIVATE)
233
- val gson = Gson()
234
- val json: String = sharedStepDefinitions.getString("Steps", "")!!
235
- val steps: List<StepDefinitions>? =
236
- gson.fromJson(json, object : TypeToken<List<StepDefinitions>>() {}.type)
237
- steps!!.forEach { item ->
238
- if (item.stepDefinition == StepsName.DocumentCapture) {
233
+ val documentCaptureSharedPreferences = reactApplicationContext.getSharedPreferences("SubmitStepModel", Context.MODE_PRIVATE)
239
234
  val documentCaptureModel = SubmitRequestModel(
240
- item.stepId, StepsName.DocumentCapture,
235
+ stepID, StepsName.DocumentCapture,
241
236
  convertMap(dataModel.passportExtractedModel!!.transformedProperties)
242
237
  );
243
- val documentCaptureSharedPreferences = reactApplicationContext.getSharedPreferences(
244
- "DocumentCaptureStepModel",
245
- Context.MODE_PRIVATE
246
- )
238
+
247
239
  val documentCaptureSharedPreferencesEditor = documentCaptureSharedPreferences.edit()
248
240
  val documentCaptureGson = Gson()
249
241
  val documentCaptureStep: String = documentCaptureGson.toJson(documentCaptureModel)
250
242
  documentCaptureSharedPreferencesEditor.putString(
251
- "DocumentCaptureStep",
243
+ stepID.toString(),
252
244
  documentCaptureStep
253
245
  );
254
246
  documentCaptureSharedPreferencesEditor.apply()
255
- }
247
+
248
+
256
249
  runOnUiThread {
257
250
  scanPassport.stopScanning();
258
251
  /** End **/
@@ -276,7 +269,7 @@ class ScanPassportActivity : AppCompatActivity(),
276
269
 
277
270
 
278
271
  }
279
- }
272
+
280
273
  }
281
274
 
282
275
 
@@ -38,6 +38,6 @@ Pod::Spec.new do |s|
38
38
 
39
39
 
40
40
  s.dependency "React-Core"
41
- s.dependency "AssentifySdk", '0.0.53'
41
+ s.dependency "AssentifySdk", '0.0.54'
42
42
 
43
43
  end
@@ -19,16 +19,20 @@ RCT_EXTERN_METHOD(initialize: (NSString *)apiKey
19
19
  )
20
20
  RCT_EXTERN_METHOD(startScanPassport:
21
21
  (NSString *)language
22
+ stepID:(NSNumber *)stepID
22
23
  )
23
24
  RCT_EXTERN_METHOD(startScanOtherIDPage:
24
25
  (NSString *)language
26
+ stepID:(NSNumber *)stepID
25
27
  )
26
28
  RCT_EXTERN_METHOD(startScanIDPage:(NSString *)kycDocumentDetails
27
29
  language:(NSString *)language
28
30
  flippingCard:(BOOL)flippingCard
31
+ stepID:(NSNumber *)stepID
29
32
  )
30
33
  RCT_EXTERN_METHOD(startFaceMatch:(NSString *)imageUrl
31
34
  showCountDown:(BOOL)showCountDown
35
+ stepID:(NSNumber *)stepID
32
36
  )
33
37
 
34
38
  RCT_EXTERN_METHOD(startContextAwareSigning)