assentify-sdk-react-native 0.0.42 → 1.0.0-Beta

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 (104) hide show
  1. package/README.md +5 -1
  2. package/android/build.gradle +29 -32
  3. package/android/gradle.properties +2 -2
  4. package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +81 -118
  5. package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +27 -24
  6. package/android/src/main/java/com/assentifysdk/FlowActivity.kt +191 -0
  7. package/android/src/main/java/com/assentifysdk/QrActivity.kt +10 -11
  8. package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +83 -98
  9. package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +7 -6
  10. package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +8 -13
  11. package/android/src/main/res/layout/activity_face_scan.xml +1 -1
  12. package/android/src/main/res/layout/activity_flow.xml +9 -0
  13. package/android/src/main/res/layout/activity_scan.xml +1 -1
  14. package/assentify-sdk.podspec +2 -1
  15. package/ios/NativeAssentifySdk.mm +24 -4
  16. package/ios/NativeAssentifySdk.swift +229 -30
  17. package/ios/UIComponents/RNPassportScanner.swift +4 -3
  18. package/ios/View/FaceMatchController.swift +131 -124
  19. package/ios/View/IDCardController.swift +48 -35
  20. package/ios/View/OtherController.swift +9 -18
  21. package/ios/View/PassportController.swift +82 -121
  22. package/ios/View/QrController.swift +9 -6
  23. package/lib/commonjs/AssentifyProvider.js +88 -101
  24. package/lib/commonjs/AssentifyProvider.js.map +1 -1
  25. package/lib/commonjs/AssentifyWrapper.js +11 -17
  26. package/lib/commonjs/AssentifyWrapper.js.map +1 -1
  27. package/lib/commonjs/BackgroundType.js +11 -0
  28. package/lib/commonjs/BackgroundType.js.map +1 -0
  29. package/lib/commonjs/helpers/parsers/FlowCompletedModelParser.js +26 -0
  30. package/lib/commonjs/helpers/parsers/FlowCompletedModelParser.js.map +1 -0
  31. package/lib/commonjs/index.js +4 -4
  32. package/lib/commonjs/index.js.map +1 -1
  33. package/lib/commonjs/types.js.map +1 -1
  34. package/lib/module/AssentifyProvider.js +86 -98
  35. package/lib/module/AssentifyProvider.js.map +1 -1
  36. package/lib/module/AssentifyWrapper.js +11 -17
  37. package/lib/module/AssentifyWrapper.js.map +1 -1
  38. package/lib/module/BackgroundType.js +5 -0
  39. package/lib/module/BackgroundType.js.map +1 -0
  40. package/lib/module/helpers/parsers/FlowCompletedModelParser.js +20 -0
  41. package/lib/module/helpers/parsers/FlowCompletedModelParser.js.map +1 -0
  42. package/lib/module/index.js +1 -1
  43. package/lib/module/index.js.map +1 -1
  44. package/lib/module/types.js.map +1 -1
  45. package/lib/typescript/example/babel.config.d.ts +153 -1
  46. package/lib/typescript/example/babel.config.d.ts.map +1 -1
  47. package/lib/typescript/example/metro.config.d.ts +2 -2
  48. package/lib/typescript/example/metro.config.d.ts.map +1 -1
  49. package/lib/typescript/example/react-native.config.d.ts +153 -1
  50. package/lib/typescript/example/react-native.config.d.ts.map +1 -1
  51. package/lib/typescript/example/src/App.d.ts.map +1 -1
  52. package/lib/typescript/example/src/Home.d.ts.map +1 -1
  53. package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts +3 -1
  54. package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
  55. package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +4 -6
  56. package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
  57. package/lib/typescript/lib/commonjs/BackgroundType.d.ts +6 -0
  58. package/lib/typescript/lib/commonjs/BackgroundType.d.ts.map +1 -0
  59. package/lib/typescript/lib/commonjs/helpers/parsers/FlowCompletedModelParser.d.ts +11 -0
  60. package/lib/typescript/lib/commonjs/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
  61. package/lib/typescript/lib/module/AssentifyProvider.d.ts +4 -2
  62. package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
  63. package/lib/typescript/lib/module/AssentifyWrapper.d.ts +4 -6
  64. package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
  65. package/lib/typescript/lib/module/BackgroundType.d.ts +5 -0
  66. package/lib/typescript/lib/module/BackgroundType.d.ts.map +1 -0
  67. package/lib/typescript/lib/module/helpers/parsers/FlowCompletedModelParser.d.ts +10 -0
  68. package/lib/typescript/lib/module/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
  69. package/lib/typescript/lib/module/index.d.ts +5 -7
  70. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  71. package/lib/typescript/src/AssentifyProvider.d.ts +5 -2
  72. package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
  73. package/lib/typescript/src/AssentifyWrapper.d.ts +6 -7
  74. package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
  75. package/lib/typescript/src/BackgroundType.d.ts +6 -0
  76. package/lib/typescript/src/BackgroundType.d.ts.map +1 -0
  77. package/lib/typescript/src/helpers/parsers/FaceMatchParser.d.ts.map +1 -1
  78. package/lib/typescript/src/helpers/parsers/FlowCompletedModelParser.d.ts +4 -0
  79. package/lib/typescript/src/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
  80. package/lib/typescript/src/helpers/parsers/IDCardParser.d.ts.map +1 -1
  81. package/lib/typescript/src/helpers/parsers/OtherIDParser.d.ts.map +1 -1
  82. package/lib/typescript/src/helpers/parsers/PassportParser.d.ts.map +1 -1
  83. package/lib/typescript/src/index.d.ts +5 -7
  84. package/lib/typescript/src/index.d.ts.map +1 -1
  85. package/lib/typescript/src/types.d.ts +11 -2
  86. package/lib/typescript/src/types.d.ts.map +1 -1
  87. package/package.json +14 -10
  88. package/src/AssentifyProvider.tsx +196 -147
  89. package/src/AssentifyWrapper.ts +55 -27
  90. package/src/BackgroundType.ts +7 -0
  91. package/src/helpers/parsers/FlowCompletedModelParser.ts +31 -0
  92. package/src/index.ts +1 -1
  93. package/src/types.ts +13 -2
  94. package/lib/commonjs/DoneFlags.js +0 -14
  95. package/lib/commonjs/DoneFlags.js.map +0 -1
  96. package/lib/module/DoneFlags.js +0 -8
  97. package/lib/module/DoneFlags.js.map +0 -1
  98. package/lib/typescript/lib/commonjs/DoneFlags.d.ts +0 -9
  99. package/lib/typescript/lib/commonjs/DoneFlags.d.ts.map +0 -1
  100. package/lib/typescript/lib/module/DoneFlags.d.ts +0 -8
  101. package/lib/typescript/lib/module/DoneFlags.d.ts.map +0 -1
  102. package/lib/typescript/src/DoneFlags.d.ts +0 -9
  103. package/lib/typescript/src/DoneFlags.d.ts.map +0 -1
  104. package/src/DoneFlags.ts +0 -11
package/README.md CHANGED
@@ -58,7 +58,7 @@ yarn add assentify-sdk-react-native
58
58
  ## Installation iOS
59
59
  **Podfile**
60
60
  ```
61
- platform :ios, '14.0'
61
+ platform :ios, '18.0'
62
62
  dynamic_frameworks = ['AssentifySdk', 'TensorFlowLiteSwift']
63
63
 
64
64
  permissions_path = '../node_modules/react-native-permissions/ios'
@@ -92,6 +92,10 @@ yarn add assentify-sdk-react-native
92
92
  ```
93
93
 
94
94
  ## Versions
95
+
96
+ **1.0.0-Beta**
97
+ 1. **Full Flows Integration**
98
+
95
99
  **0.0.42**
96
100
  1. **Updated Gson to version 2.11.0**
97
101
  2. **Updated AndroidX Navigation to version 2.8.4**
@@ -1,37 +1,40 @@
1
1
  buildscript {
2
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["AssentifySdk_kotlinVersion"]
3
+ def kotlin_version = rootProject.ext.has("kotlinVersion")
4
+ ? rootProject.ext.get("kotlinVersion")
5
+ : project.properties["AssentifySdk_kotlinVersion"]
4
6
 
5
7
  repositories {
6
8
  google()
7
9
  mavenCentral()
10
+
8
11
  }
9
12
 
10
13
  dependencies {
11
- classpath 'com.android.tools.build:gradle:8.1.1'
14
+ classpath 'com.android.tools.build:gradle:8.13.1'
12
15
  classpath 'de.undercouch:gradle-download-task:4.1.1'
13
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
14
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.20"
15
17
  }
16
18
  }
17
19
 
18
20
  def isNewArchitectureEnabled() {
19
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
21
+ return rootProject.hasProperty("newArchEnabled") &&
22
+ rootProject.getProperty("newArchEnabled") == "true"
20
23
  }
21
24
 
22
25
  apply plugin: "com.android.library"
23
26
  apply plugin: "kotlin-android"
24
27
 
25
- if (isNewArchitectureEnabled()) {
26
- apply plugin: "com.facebook.react"
27
- }
28
-
29
28
  def getExtOrDefault(name) {
30
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["AssentifySdk_" + name]
29
+ return rootProject.ext.has(name)
30
+ ? rootProject.ext.get(name)
31
+ : project.properties["AssentifySdk_" + name]
31
32
  }
32
33
 
33
34
  def getExtOrIntegerDefault(name) {
34
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["AssentifySdk_" + name]).toInteger()
35
+ return rootProject.ext.has(name)
36
+ ? rootProject.ext.get(name)
37
+ : (project.properties["AssentifySdk_" + name]).toInteger()
35
38
  }
36
39
 
37
40
  def supportsNamespace() {
@@ -59,7 +62,6 @@ android {
59
62
  defaultConfig {
60
63
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
61
64
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
62
-
63
65
  }
64
66
 
65
67
  buildTypes {
@@ -73,42 +75,37 @@ android {
73
75
  }
74
76
 
75
77
  compileOptions {
76
- sourceCompatibility JavaVersion.VERSION_1_8
77
- targetCompatibility JavaVersion.VERSION_1_8
78
+ sourceCompatibility JavaVersion.VERSION_17
79
+ targetCompatibility JavaVersion.VERSION_17
78
80
  }
81
+
82
+ kotlinOptions {
83
+ jvmTarget = "17"
84
+ }
85
+
79
86
  packagingOptions {
80
87
  pickFirst '**/libc++_shared.so'
81
88
  pickFirst '**/libfbjni.so'
82
89
  }
83
-
84
90
  }
85
91
 
86
92
  repositories {
87
- jcenter()
88
- mavenCentral()
89
93
  google()
94
+ mavenCentral()
90
95
  maven { url 'https://jitpack.io' }
91
96
  }
92
97
 
93
98
  def kotlin_version = getExtOrDefault("kotlinVersion")
94
99
 
95
100
  dependencies {
96
- // For < 0.71, this will be from the local maven repo
97
- // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
98
- //noinspection GradleDynamicVersion
99
- implementation "com.facebook.react:react-native:+"
101
+ compileOnly("com.facebook.react:react-android")
100
102
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
101
103
 
102
- implementation 'com.github.AssentifyLTD:Assentify.SDK.Android:0.0.90'
103
-
104
- /* Assentify Sdk Dependencies */
105
- implementation 'com.google.code.gson:gson:2.11.0'
106
- implementation 'androidx.navigation:navigation-fragment-ktx:2.8.4'
107
- implementation 'androidx.navigation:navigation-ui-ktx:2.8.4'
108
- implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.29'
109
- implementation 'com.squareup.picasso:picasso:2.8'
110
-
111
-
104
+ implementation 'com.github.AssentifyLTD:Assentify.SDK.Android:1.0.0-Beta.10'
112
105
 
106
+ implementation 'com.google.code.gson:gson:2.13.2'
107
+ implementation 'androidx.navigation:navigation-fragment-ktx:2.9.7'
108
+ implementation 'androidx.navigation:navigation-ui-ktx:2.9.7'
109
+ implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.31'
110
+ implementation 'com.squareup.picasso:picasso:2.71828'
113
111
  }
114
-
@@ -1,7 +1,7 @@
1
- AssentifySdk_kotlinVersion=1.8.22
1
+ AssentifySdk_kotlinVersion=2.1.20
2
2
  AssentifySdk_minSdkVersion=24
3
3
  AssentifySdk_targetSdkVersion=33
4
- AssentifySdk_compileSdkVersion=33
4
+ AssentifySdk_compileSdkVersion=36
5
5
  AssentifySdk_ndkversion=25.1.8937393
6
6
  android.useAndroidX=true
7
7
  android.enableJetifier=true
@@ -35,14 +35,13 @@ import ImageToBase64Converter
35
35
  import com.assentify.sdk.RemoteClient.Models.CreateUserDocumentResponseModel
36
36
  import com.assentify.sdk.RemoteClient.Models.DocumentTokensModel
37
37
  import com.assentify.sdk.RemoteClient.Models.SignatureResponseModel
38
- import com.assentify.sdk.CheckEnvironment.ContextAwareSigning
39
- import com.assentify.sdk.ContextAware.ContextAwareSigningCallback
40
38
  import com.assentify.sdk.Core.Constants.ActiveLiveType
39
+ import com.assentify.sdk.Core.Constants.StepsNames
41
40
 
41
+ import com.facebook.react.bridge.ReadableArray
42
42
 
43
43
  class AssentifySdkModule(context: ReactApplicationContext) :
44
- AssentifySdkBaseModule(context), AssentifySdkCallback, SubmitDataCallback,
45
- ContextAwareSigningCallback {
44
+ AssentifySdkBaseModule(context), AssentifySdkCallback, SubmitDataCallback{
46
45
 
47
46
  private lateinit var assentifySdk: AssentifySdk
48
47
  private lateinit var timeStarted: String
@@ -52,7 +51,6 @@ class AssentifySdkModule(context: ReactApplicationContext) :
52
51
  private val mainHandler = Handler(Looper.getMainLooper())
53
52
  private lateinit var environmentalConditions: EnvironmentalConditions
54
53
  private lateinit var templatesByCountry: List<TemplatesByCountry>
55
- private lateinit var contextAwareSigning: ContextAwareSigning;
56
54
  private lateinit var userDocumentResponseModel: CreateUserDocumentResponseModel;
57
55
  private var documentURL = "";
58
56
 
@@ -64,7 +62,6 @@ class AssentifySdkModule(context: ReactApplicationContext) :
64
62
  performLivenessFace: Boolean? = null,
65
63
  ENV_CustomColor: String? = null,
66
64
  enableDetect: Boolean = true,
67
- enableGuide: Boolean = true,
68
65
  androidMotionCardLimit :Int = 10,
69
66
  androidMotionPassportLimit:Int = 15,
70
67
  iOSMotionCardsLimit:Int = 30,
@@ -75,12 +72,13 @@ class AssentifySdkModule(context: ReactApplicationContext) :
75
72
  iOSBrightnessLowThreshold:Int = 50,
76
73
  activeLiveType : String = "NONE",
77
74
  activeLivenessCheckCount:Int = 0,
78
- retryCount:Int = 3,
79
75
  faceLivenessRetryCount:Int = 2,
80
76
  minRam:Int = 8,
81
77
  iOSMinRam:Int = 2,
82
78
  minCPUCores:Int = 6,
83
- manualClickColor: String? = null
79
+ manualClickColor: String? = null,
80
+
81
+ countDownNumbersColor: String? = null
84
82
 
85
83
  ) {
86
84
  try {
@@ -104,7 +102,6 @@ class AssentifySdkModule(context: ReactApplicationContext) :
104
102
  println("$tag performLivenessFace: $performLivenessFace")
105
103
  println("$tag ENV_CustomColor: $ENV_CustomColor")
106
104
  println("$tag enableDetect: $enableDetect")
107
- println("$tag enableGuide: $enableGuide")
108
105
  println("$tag androidMotionCardLimit: $androidMotionCardLimit")
109
106
  println("$tag androidMotionPassportLimit: $androidMotionPassportLimit")
110
107
  println("$tag iOSMotionCardsLimit: $iOSMotionCardsLimit")
@@ -115,12 +112,12 @@ class AssentifySdkModule(context: ReactApplicationContext) :
115
112
  println("$tag iOSBrightnessLowThreshold: $iOSBrightnessLowThreshold")
116
113
  println("$tag ActiveLiveType: $activeLiveType")
117
114
  println("$tag ActiveLivenessCheckCount: $activeLivenessCheckCount")
118
- println("$tag RetryCount: $retryCount")
119
115
  println("$tag FaceLivenessRetryCount: $faceLivenessRetryCount")
120
116
  println("$tag MinRam: $minRam")
121
117
  println("$tag iOSMinRam: $iOSMinRam")
122
118
  println("$tag MinCPUCores: $minCPUCores")
123
119
  println("$tag ManualClickColor: $manualClickColor")
120
+ println("$tag countDownNumbersColor: $countDownNumbersColor")
124
121
  println("$tag ==============================================")
125
122
 
126
123
  val typeActive: ActiveLiveType = when (activeLiveType) {
@@ -134,16 +131,14 @@ class AssentifySdkModule(context: ReactApplicationContext) :
134
131
  environmentalConditions =
135
132
  EnvironmentalConditions(
136
133
  enableDetect,
137
- enableGuide,
138
- "#ffffff",
139
134
  ENV_CustomColor ?: "#f5a103",
135
+ CountDownNumbersColor = countDownNumbersColor!!,
140
136
  MotionCardLimit = androidMotionCardLimit,
141
137
  MotionPassportLimit = androidMotionPassportLimit,
142
138
  BRIGHTNESS_HIGH_THRESHOLD = androidBrightnessHighThreshold,
143
139
  BRIGHTNESS_LOW_THRESHOLD = androidBrightnessLowThreshold,
144
140
  activeLiveType = typeActive,
145
141
  activeLivenessCheckCount = activeLivenessCheckCount,
146
- retryCount = retryCount,
147
142
  faceLivenessRetryCount = faceLivenessRetryCount ,
148
143
  minRam = minRam,
149
144
  minCPUCores = minCPUCores
@@ -183,7 +178,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
183
178
  if (intent.resolveActivity(reactApplicationContext.packageManager) !== null) {
184
179
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
185
180
  intent.putExtra("holdHandColor", environmentalConditions.HoldHandColor)
186
- intent.putExtra("processingColor", environmentalConditions.CustomColor)
181
+ intent.putExtra("processingColor", "#ffffff")
187
182
  intent.putExtra("language", language)
188
183
  intent.putExtra("showCountDown", true)
189
184
  intent.putExtra("apiKey", this.apiKey)
@@ -200,7 +195,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
200
195
  val intent = Intent(reactApplicationContext.currentActivity, ScanOtherActivity::class.java)
201
196
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
202
197
  intent.putExtra("holdHandColor", environmentalConditions.HoldHandColor)
203
- intent.putExtra("processingColor", environmentalConditions.CustomColor)
198
+ intent.putExtra("processingColor", "#ffffff")
204
199
  intent.putExtra("language", language)
205
200
  intent.putExtra("showCountDown", true)
206
201
  intent.putExtra("apiKey", this.apiKey)
@@ -210,7 +205,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
210
205
  }
211
206
 
212
207
  @ReactMethod
213
- fun startScanQrPage( jsonStringKycDocumentDetails: String,
208
+ fun startScanQrPage( templatesByCountryObject: String,
214
209
  language: String,
215
210
  stepID :Int) {
216
211
  timeStarted = getCurrentDateTimeUTC();
@@ -218,8 +213,8 @@ class AssentifySdkModule(context: ReactApplicationContext) :
218
213
  val intent = Intent(reactApplicationContext.currentActivity, QrActivity::class.java)
219
214
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
220
215
  intent.putExtra("holdHandColor", environmentalConditions.HoldHandColor)
221
- intent.putExtra("processingColor", environmentalConditions.CustomColor)
222
- intent.putExtra("kycDocumentDetails", jsonStringKycDocumentDetails)
216
+ intent.putExtra("processingColor", "#ffffff")
217
+ intent.putExtra("templatesByCountryObject", templatesByCountryObject)
223
218
  intent.putExtra("language", language)
224
219
  intent.putExtra("stepID", stepID)
225
220
  intent.putExtra("manualClickColor", this.manualClickColor)
@@ -228,7 +223,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
228
223
 
229
224
  @ReactMethod
230
225
  fun startScanIDPage(
231
- jsonStringKycDocumentDetails: String,
226
+ templatesByCountryObject: String,
232
227
  language: String,
233
228
  flippingCard: Boolean,
234
229
  stepID :Int
@@ -239,11 +234,11 @@ class AssentifySdkModule(context: ReactApplicationContext) :
239
234
  val intent = Intent(reactApplicationContext.currentActivity, ScanIDActivity::class.java)
240
235
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
241
236
  intent.putExtra("holdHandColor", environmentalConditions.HoldHandColor)
242
- intent.putExtra("processingColor", environmentalConditions.CustomColor)
243
- intent.putExtra("kycDocumentDetails", jsonStringKycDocumentDetails)
237
+ intent.putExtra("processingColor", "#ffffff")
238
+ intent.putExtra("templatesByCountryObject", templatesByCountryObject)
244
239
  intent.putExtra("language", language)
245
240
  intent.putExtra("flippingCard", flippingCard)
246
- intent.putExtra("title", getIdTitle(jsonStringKycDocumentDetails!!))
241
+ intent.putExtra("title", "ID Scan")
247
242
  intent.putExtra("showCountDown", true)
248
243
  intent.putExtra("apiKey", this.apiKey)
249
244
  intent.putExtra("stepID", stepID)
@@ -268,7 +263,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
268
263
  val intent = Intent(reactApplicationContext, FaceMatchActivity::class.java)
269
264
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
270
265
  intent.putExtra("holdHandColor", environmentalConditions.HoldHandColor)
271
- intent.putExtra("processingColor", environmentalConditions.CustomColor)
266
+ intent.putExtra("processingColor", "#ffffff")
272
267
  intent.putExtra("showCountDown", showCountDown)
273
268
  intent.putExtra("stepID", stepID)
274
269
  intent.putExtra("manualClickColor", this.manualClickColor)
@@ -316,8 +311,8 @@ class AssentifySdkModule(context: ReactApplicationContext) :
316
311
  // }
317
312
  // sendEvent("AppResult", eventResultMap)
318
313
  this.configModel = configModel;
319
- templatesByCountry = assentifySdk.getTemplates();
320
-
314
+ templatesByCountry = assentifySdk.getTemplates( configModel.stepMap.filter { it.stepDefinition == StepsNames.IdentificationDocumentCapture }.first().id
315
+ );
321
316
  val eventResultMap =
322
317
  Arguments.createMap().apply {
323
318
  val jsonTemplates = encodeTemplatesByCountryToJson(templatesByCountry)
@@ -346,7 +341,6 @@ class AssentifySdkModule(context: ReactApplicationContext) :
346
341
 
347
342
  var wrapUp: SubmitRequestModel? = null
348
343
  var blockLoader: SubmitRequestModel? = null
349
- var contextAwareSigningModel: SubmitRequestModel? = null
350
344
  var submitRequestList: MutableList<SubmitRequestModel> = mutableListOf()
351
345
  val sharedStepDefinitions =
352
346
  reactApplicationContext.getSharedPreferences("StepDefinitions", Context.MODE_PRIVATE)
@@ -358,21 +352,10 @@ class AssentifySdkModule(context: ReactApplicationContext) :
358
352
 
359
353
  steps!!.forEach { item ->
360
354
  // ** Context Aware Signing *//
361
- if (item.stepDefinition == StepsName.ContextAwareSigning) {
362
- if (this.documentURL != "") {
363
- val values: MutableMap<String, String> = mutableMapOf()
364
- item.outputProperties.forEach { property ->
365
- if (property.key.contains(ContextAwareSigningKeys.DocumentURL)) {
366
- values.put(property.key, this.documentURL)
367
- }
368
- }
369
- contextAwareSigningModel =
370
- SubmitRequestModel(item.stepId, StepsName.ContextAwareSigning, values)
371
- }
372
- }
355
+
373
356
 
374
357
  // ** WrapUp *//
375
- else if (item.stepDefinition == StepsName.WrapUp) {
358
+ if (item.stepDefinition == StepsName.WrapUp) {
376
359
  val values: MutableMap<String, String> = mutableMapOf()
377
360
  item.outputProperties.forEach { property ->
378
361
  if (property.key.contains(WrapUpKeys.TimeEnded)) {
@@ -444,9 +427,7 @@ class AssentifySdkModule(context: ReactApplicationContext) :
444
427
 
445
428
  submitRequestList.add(wrapUp!!)
446
429
  submitRequestList.add(blockLoader!!)
447
- if (contextAwareSigningModel != null) {
448
- submitRequestList.add(contextAwareSigningModel!!)
449
- }
430
+
450
431
 
451
432
 
452
433
  assentifySdk.startSubmitData(this@AssentifySdkModule, submitRequestList)
@@ -471,65 +452,8 @@ class AssentifySdkModule(context: ReactApplicationContext) :
471
452
  }
472
453
 
473
454
 
474
- /** Context Aware Signing */
475
- @ReactMethod
476
- fun startContextAwareSigning() {
477
- contextAwareSigning = assentifySdk.startContextAwareSigning(this);
478
- }
479
-
480
- @ReactMethod
481
- fun createUserDocumentInstance(data: ReadableMap? = null) {
482
- val map: Map<String, String> =
483
- data?.toHashMap()?.mapValues { it.value.toString() } ?: emptyMap()
484
- contextAwareSigning.createUserDocumentInstance(map)
485
- }
486
-
487
- @ReactMethod
488
- fun signature(signature: String) {
489
- contextAwareSigning.signature(
490
- this.userDocumentResponseModel.templateInstanceId,
491
- this.userDocumentResponseModel.documentId,
492
- signature
493
- );
494
- }
495
-
496
-
497
- override fun onHasTokens(documentTokens: List<DocumentTokensModel>) {
498
- val gson = Gson()
499
- val jsonString = gson.toJson(documentTokens)
500
-
501
- val eventResultMap =
502
- Arguments.createMap().apply {
503
- putString("documentTokens", jsonString)
504
- }
505
- sendEvent("onHasTokens", eventResultMap)
506
- }
507
-
508
- override fun onCreateUserDocumentInstance(userDocumentResponseModel: CreateUserDocumentResponseModel) {
509
- this.userDocumentResponseModel = userDocumentResponseModel;
510
- val gson = Gson()
511
- val jsonString = gson.toJson(userDocumentResponseModel)
512
-
513
- val eventResultMap =
514
- Arguments.createMap().apply {
515
- putString("userDocumentResponseModel", jsonString)
516
- }
517
- sendEvent("onCreateUserDocumentInstance", eventResultMap)
518
- }
519
-
520
- override fun onSignature(signatureResponseModel: SignatureResponseModel) {
521
- this.documentURL = signatureResponseModel.signedDocumentUri;
522
- val gson = Gson()
523
- val jsonString = gson.toJson(signatureResponseModel)
524
455
 
525
- val eventResultMap =
526
- Arguments.createMap().apply {
527
- putString("signatureResponseModel", jsonString)
528
- }
529
- sendEvent("onSignature", eventResultMap)
530
- }
531
456
 
532
- override fun onError(message: String) {}
533
457
 
534
458
 
535
459
  fun getCurrentDateTimeUTC(): String {
@@ -567,25 +491,64 @@ class AssentifySdkModule(context: ReactApplicationContext) :
567
491
  return resultMap
568
492
  }
569
493
 
570
- private fun getIdTitle(jsonStringKycDocumentDetails: String): String {
571
- var title = "";
572
- val gson = Gson()
573
- val listType = object : TypeToken<List<KycDocumentDetails>>() {}.type
574
- val kycDocumentDetails: List<KycDocumentDetails> =
575
- gson.fromJson(jsonStringKycDocumentDetails, listType)
576
-
577
- val key0 = kycDocumentDetails.firstOrNull()
578
- ?.templateProcessingKeyInformation
579
-
580
- title = if (key0 == null) title else
581
- templatesByCountry
582
- .asSequence()
583
- .flatMap { it.templates.asSequence() }
584
- .firstOrNull { t ->
585
- t.kycDocumentDetails.any { kd -> kd.templateProcessingKeyInformation == key0 }
586
- }
587
- ?.kycDocumentType ?: title
494
+ @ReactMethod
495
+ fun startFlow(
496
+ logoUrl: String,
497
+ svgBackgroundImageUrl: String,
498
+ textColor: String,
499
+ secondaryTextColor: String? = null,
500
+ backgroundCardColor: String? = null,
501
+ accentColor: String? = null,
502
+ backgroundColors: ReadableArray? = null,
503
+ clickColors: ReadableArray? = null,
504
+ angleDegreesBackgroundColors: Double? = null,
505
+ holdUntilBackgroundColors: Double? = null,
506
+ angleDegreesClickColors: Double? = null,
507
+ holdUntilClickColors: Double? = null,
508
+ backgroundType: String? = null,
509
+ clear: Boolean? = null,
510
+ language: String,
511
+ enableNfc: Boolean? = null,
512
+ enableQr: Boolean? = null,
513
+ jsonBlockLoaderCustomProperties: String? = null
514
+ ) {
515
+ val intent = Intent(reactApplicationContext, FlowActivity::class.java)
516
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
517
+ intent.putExtra("logoUrl", logoUrl)
518
+ intent.putExtra("svgBackgroundImageUrl", svgBackgroundImageUrl)
519
+ intent.putExtra("textColor", textColor)
520
+ intent.putExtra("secondaryTextColor", secondaryTextColor)
521
+ intent.putExtra("backgroundCardColor", backgroundCardColor)
522
+ intent.putExtra("accentColor", accentColor)
523
+ intent.putExtra("backgroundType", backgroundType)
524
+ intent.putExtra("clear", clear)
525
+ intent.putStringArrayListExtra(
526
+ "backgroundColors",
527
+ readableArrayToArrayList(backgroundColors)
528
+ )
529
+ intent.putExtra("angleDegreesBackgroundColors", angleDegreesBackgroundColors)
530
+ intent.putExtra("holdUntilBackgroundColors", holdUntilBackgroundColors)
531
+ intent.putStringArrayListExtra(
532
+ "clickColors",
533
+ readableArrayToArrayList(clickColors)
534
+ )
535
+ intent.putExtra("angleDegreesClickColors", angleDegreesClickColors)
536
+ intent.putExtra("holdUntilClickColors", holdUntilClickColors)
537
+ intent.putExtra("language", language)
538
+ intent.putExtra("enableNfc", enableNfc)
539
+ intent.putExtra("enableQr", enableQr)
540
+ intent.putExtra("jsonBlockLoaderCustomProperties", jsonBlockLoaderCustomProperties)
541
+ reactApplicationContext.currentActivity?.startActivity(intent)
542
+ }
543
+
544
+ private fun readableArrayToArrayList(array: ReadableArray?): ArrayList<String> {
545
+ val list = arrayListOf<String>()
546
+ if (array == null) return list
547
+
548
+ for (i in 0 until array.size()) {
549
+ array.getString(i)?.let { list.add(it) }
550
+ }
588
551
 
589
- return title;
552
+ return list
590
553
  }
591
554
  }
@@ -37,7 +37,6 @@ import com.facebook.react.bridge.ReactApplicationContext
37
37
  import com.assentify.sdk.Core.Constants.BrightnessEvents
38
38
  import com.assentify.sdk.Core.Constants.FaceEvents
39
39
  import com.assentify.sdk.Core.Constants.ActiveLiveEvents
40
- import com.assentify.sdk.Core.Constants.DoneFlags
41
40
  import com.assentify.sdk.FaceMatch.FaceMatchManual
42
41
  import com.assentify.sdk.FaceMatch.FaceMatchResult
43
42
 
@@ -276,8 +275,8 @@ private lateinit var assentifySdk: AssentifySdk
276
275
  }
277
276
  }
278
277
 
279
- override fun onComplete(dataModel: FaceResponseModel,doneFlag: DoneFlags) {
280
- triggerCompleteEvent("onComplete",dataModel,doneFlag)
278
+ override fun onComplete(dataModel: FaceResponseModel) {
279
+ triggerCompleteEvent("onComplete",dataModel)
281
280
  /** Data To Submit **/
282
281
  val documentCaptureSharedPreferences =
283
282
  reactApplicationContext.getSharedPreferences("SubmitStepModel", Context.MODE_PRIVATE)
@@ -316,10 +315,11 @@ private lateinit var assentifySdk: AssentifySdk
316
315
  motion: MotionType,
317
316
  faceEvents: FaceEvents,
318
317
  zoomType: ZoomType,
319
- detectedFaces:Int
318
+ detectedFaces:Int,
319
+ isCentered: Boolean,
320
320
  ) {
321
321
  runOnUiThread {
322
- if(start == false && currentActiveLiveEvents == ActiveLiveEvents.Good){
322
+ if (start == false && currentActiveLiveEvents == ActiveLiveEvents.Good) {
323
323
  infoLayout.visibility = View.VISIBLE
324
324
  if(detectedFaces > 1){
325
325
  infoText.setText("We detected more than one face.Please keep just your face in view.")
@@ -333,57 +333,58 @@ private lateinit var assentifySdk: AssentifySdk
333
333
  infoText.setText("Please Move Further")
334
334
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.zoom_out))
335
335
  }
336
- }
337
- else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
336
+ } else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
338
337
  infoText.setText("Please Hold Your Hand")
339
338
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
340
339
 
341
- } else if(brightnessEvents != BrightnessEvents.Good){
342
- if(brightnessEvents == BrightnessEvents.TooDark){
340
+ } else if (brightnessEvents != BrightnessEvents.Good) {
341
+ if (brightnessEvents == BrightnessEvents.TooDark) {
343
342
  infoText.setText("Please increase the lighting")
344
343
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
345
344
  }
346
- if(brightnessEvents == BrightnessEvents.TooBright){
345
+ if (brightnessEvents == BrightnessEvents.TooBright) {
347
346
  infoText.setText("Please reduce the lighting")
348
347
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
349
348
  }
350
- } else if(faceEvents != FaceEvents.Good && faceEvents != FaceEvents.NO_DETECT) {
351
- if(faceEvents == FaceEvents.RollLeft){
349
+ } else if (faceEvents != FaceEvents.Good && faceEvents != FaceEvents.NO_DETECT) {
350
+ if (faceEvents == FaceEvents.RollLeft) {
352
351
  infoText.setText("Please tilt your head to the right")
353
352
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
354
353
  }
355
- if(faceEvents == FaceEvents.RollRight){
354
+ if (faceEvents == FaceEvents.RollRight) {
356
355
  infoText.setText("Please tilt your head to the left")
357
356
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
358
357
  }
359
- if(faceEvents == FaceEvents.YawLeft){
358
+ if (faceEvents == FaceEvents.YawLeft) {
360
359
  infoText.setText("Please turn your head to the right")
361
360
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
362
361
  }
363
- if(faceEvents == FaceEvents.YawRight){
362
+ if (faceEvents == FaceEvents.YawRight) {
364
363
  infoText.setText("Please turn your head to the left")
365
364
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
366
365
  }
367
- if(faceEvents == FaceEvents.PitchUp){
366
+ if (faceEvents == FaceEvents.PitchUp) {
368
367
  infoText.setText("Please lower your head")
369
368
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
370
369
  }
371
- if(faceEvents == FaceEvents.PitchDown){
370
+ if (faceEvents == FaceEvents.PitchDown) {
372
371
  infoText.setText("Please raise your head")
373
372
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
374
373
  }
375
- }
376
- else {
377
- if (motion == MotionType.SENDING && zoomType == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good && faceEvents == FaceEvents.Good){
374
+ } else {
375
+ if (motion == MotionType.SENDING && zoomType == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good && faceEvents == FaceEvents.Good) {
378
376
  infoText.setText("Hold Steady")
379
377
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
380
378
  }
381
- if (motion == MotionType.NO_DETECT && zoomType == ZoomType.NO_DETECT && faceEvents == FaceEvents.NO_DETECT){
379
+ if (motion == MotionType.NO_DETECT && zoomType == ZoomType.NO_DETECT && faceEvents == FaceEvents.NO_DETECT) {
382
380
  infoText.setText("Please face within circle")
383
381
  infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
382
+ }else if(!isCentered){
383
+ infoText.setText("Please center your face")
384
+ infoIcon.setImageDrawable(getResources().getDrawable(R.drawable.info_icon))
384
385
  }
385
386
  }
386
- }else {
387
+ } else {
387
388
  if(currentActiveLiveEvents == ActiveLiveEvents.Good){
388
389
  infoLayout.visibility = View.GONE
389
390
  }
@@ -410,14 +411,16 @@ private lateinit var assentifySdk: AssentifySdk
410
411
 
411
412
  }
412
413
 
414
+ override fun onCollectingManualImages(){
415
+ }
416
+
413
417
 
414
- private fun triggerCompleteEvent(eventName:String, dataModel: FaceResponseModel?,doneFlag: DoneFlags){
418
+ private fun triggerCompleteEvent(eventName:String, dataModel: FaceResponseModel?){
415
419
  val eventResultMap = Arguments.createMap().apply {
416
420
  if(dataModel!=null){
417
421
  val gson = Gson()
418
422
  val jsonString = gson.toJson(dataModel.faceExtractedModel!!)
419
423
  putString("FaceMatchDataModel", jsonString)
420
- putString("DoneFlag", doneFlag.toString())
421
424
  }
422
425
  }
423
426
  reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)