assentify-sdk-react-native 0.0.31 → 0.0.33
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/README.md +8 -0
- package/android/build.gradle +3 -1
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +26 -3
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +78 -20
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +150 -36
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +80 -19
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +79 -23
- package/android/src/main/res/drawable/button_rounded_background.xml +4 -4
- package/android/src/main/res/layout/activity_face_scan.xml +234 -219
- package/android/src/main/res/layout/activity_scan.xml +116 -0
- package/assentify-sdk.podspec +1 -1
- package/ios/NativeAssentifySdk.mm +6 -0
- package/ios/NativeAssentifySdk.swift +24 -7
- package/ios/UIComponents/RNPassportScanner.swift +4 -0
- package/ios/View/FaceMatchController.swift +49 -8
- package/ios/View/IDCardController.swift +81 -18
- package/ios/View/OtherController.swift +49 -11
- package/ios/View/PassportController.swift +57 -13
- package/ios/View/UI.swift +192 -36
- package/lib/commonjs/AssentifyProvider.js +12 -4
- package/lib/commonjs/AssentifyProvider.js.map +1 -1
- package/lib/commonjs/AssentifyWrapper.js +2 -2
- package/lib/commonjs/AssentifyWrapper.js.map +1 -1
- package/lib/commonjs/DoneFlags.js +14 -0
- package/lib/commonjs/DoneFlags.js.map +1 -0
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/AssentifyProvider.js +12 -4
- package/lib/module/AssentifyProvider.js.map +1 -1
- package/lib/module/AssentifyWrapper.js +2 -2
- package/lib/module/AssentifyWrapper.js.map +1 -1
- package/lib/module/DoneFlags.js +8 -0
- package/lib/module/DoneFlags.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/example/src/Home.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts +9 -0
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/module/DoneFlags.d.ts +8 -0
- package/lib/typescript/lib/module/DoneFlags.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +2 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/src/DoneFlags.d.ts +9 -0
- package/lib/typescript/src/DoneFlags.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AssentifyProvider.tsx +11 -4
- package/src/AssentifyWrapper.ts +13 -1
- package/src/DoneFlags.ts +11 -0
- package/src/index.ts +1 -0
|
@@ -12,6 +12,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
12
12
|
import com.assentify.sdk.Core.Constants.MotionType
|
|
13
13
|
import com.assentify.sdk.Core.Constants.ZoomType
|
|
14
14
|
import ImageToBase64Converter
|
|
15
|
+
import android.content.res.ColorStateList
|
|
15
16
|
import android.widget.TextView
|
|
16
17
|
import androidx.appcompat.widget.Toolbar
|
|
17
18
|
import com.google.gson.Gson
|
|
@@ -33,6 +34,9 @@ import android.graphics.PorterDuff
|
|
|
33
34
|
import android.widget.LinearLayout
|
|
34
35
|
import android.widget.RelativeLayout
|
|
35
36
|
import com.assentify.sdk.Core.Constants.BrightnessEvents
|
|
37
|
+
import com.assentify.sdk.Core.Constants.DoneFlags
|
|
38
|
+
import com.assentify.sdk.ScanOther.ScanOtherManual
|
|
39
|
+
import com.assentify.sdk.ScanOther.ScanOtherResult
|
|
36
40
|
import java.text.SimpleDateFormat
|
|
37
41
|
|
|
38
42
|
|
|
@@ -42,6 +46,8 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
42
46
|
private lateinit var reactApplicationContext: ReactApplicationContext
|
|
43
47
|
private lateinit var assentifySdk: AssentifySdk
|
|
44
48
|
private lateinit var scanOther: ScanOther
|
|
49
|
+
private lateinit var scanOtherManual: ScanOtherManual
|
|
50
|
+
private var isManual: Boolean = false;
|
|
45
51
|
private lateinit var infoText: TextView
|
|
46
52
|
private lateinit var infoIcon: ImageView
|
|
47
53
|
private lateinit var infoLayout: LinearLayout
|
|
@@ -59,6 +65,8 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
59
65
|
private var showCountDown: Boolean = true;
|
|
60
66
|
private var apiKey: String = "";
|
|
61
67
|
private var stepID: Int = -1;
|
|
68
|
+
private lateinit var takePhotoButton: Button;
|
|
69
|
+
private lateinit var manualClickColor: String;
|
|
62
70
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
63
71
|
super.onCreate(savedInstanceState)
|
|
64
72
|
setContentView(R.layout.activity_scan)
|
|
@@ -67,8 +75,25 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
67
75
|
processingColor = intent.getStringExtra("processingColor")!!
|
|
68
76
|
language = intent.getStringExtra("language")!!
|
|
69
77
|
apiKey = intent.getStringExtra("apiKey")!!
|
|
78
|
+
manualClickColor = intent.getStringExtra("manualClickColor")!!
|
|
70
79
|
showCountDown = intent.getBooleanExtra("showCountDown",true)
|
|
71
80
|
stepID = intent.getIntExtra("stepID",-1)!!
|
|
81
|
+
|
|
82
|
+
takePhotoButton = findViewById<Button>(R.id.takePhoto)
|
|
83
|
+
takePhotoButton.visibility = View.GONE
|
|
84
|
+
takePhotoButton.setTextColor(Color.parseColor(processingColor))
|
|
85
|
+
takePhotoButton.backgroundTintList = ColorStateList.valueOf(
|
|
86
|
+
Color.parseColor(manualClickColor)
|
|
87
|
+
)
|
|
88
|
+
takePhotoButton.setOnClickListener {
|
|
89
|
+
scanOtherManual.takePicture()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
infoLayout = findViewById<LinearLayout>(R.id.infoLayout)
|
|
93
|
+
val drawableInfo = getResources().getDrawable(R.drawable.info_rounded_background)
|
|
94
|
+
drawableInfo?.setColorFilter(Color.parseColor(holdHandColor), PorterDuff.Mode.SRC_ATOP)
|
|
95
|
+
infoLayout.setBackground(drawableInfo)
|
|
96
|
+
|
|
72
97
|
startAssentifySdk()
|
|
73
98
|
|
|
74
99
|
|
|
@@ -81,16 +106,18 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
81
106
|
backButton.setOnClickListener {
|
|
82
107
|
runOnUiThread {
|
|
83
108
|
triggerEvent("onBackClick", null)
|
|
84
|
-
|
|
109
|
+
if(isManual){
|
|
110
|
+
scanOtherManual.stopScanning();
|
|
111
|
+
|
|
112
|
+
}else{
|
|
113
|
+
scanOther.stopScanning();
|
|
114
|
+
}
|
|
85
115
|
finish()
|
|
86
116
|
}
|
|
87
117
|
}
|
|
88
118
|
|
|
89
119
|
|
|
90
|
-
|
|
91
|
-
val drawableInfo = getResources().getDrawable(R.drawable.info_rounded_background)
|
|
92
|
-
drawableInfo?.setColorFilter(Color.parseColor(holdHandColor), PorterDuff.Mode.SRC_ATOP)
|
|
93
|
-
infoLayout.setBackground(drawableInfo)
|
|
120
|
+
|
|
94
121
|
|
|
95
122
|
|
|
96
123
|
val toolbarTitle = findViewById<TextView>(R.id.toolbar_title)
|
|
@@ -120,11 +147,18 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
120
147
|
popUpContainer.visibility = View.GONE
|
|
121
148
|
}
|
|
122
149
|
}
|
|
150
|
+
|
|
151
|
+
|
|
123
152
|
}
|
|
124
153
|
|
|
125
154
|
override fun onBackPressed() {
|
|
126
155
|
triggerEvent("onBackClick", null)
|
|
127
|
-
|
|
156
|
+
if(isManual){
|
|
157
|
+
scanOtherManual.stopScanning();
|
|
158
|
+
|
|
159
|
+
}else{
|
|
160
|
+
scanOther.stopScanning();
|
|
161
|
+
}
|
|
128
162
|
finish()
|
|
129
163
|
super.onBackPressed()
|
|
130
164
|
}
|
|
@@ -179,15 +213,36 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
179
213
|
|
|
180
214
|
fun startAssentifySdk() {
|
|
181
215
|
assentifySdk = AssentifySdkObject.getAssentifySdkObject();
|
|
182
|
-
|
|
216
|
+
|
|
217
|
+
when (val result = assentifySdk!!.startScanOther(
|
|
183
218
|
this@ScanOtherActivity,
|
|
184
219
|
language,stepID!!
|
|
185
|
-
)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
220
|
+
)) {
|
|
221
|
+
is ScanOtherResult.Manual -> {
|
|
222
|
+
isManual =true
|
|
223
|
+
runOnUiThread{
|
|
224
|
+
infoLayout.visibility = View.GONE
|
|
225
|
+
val drawableInfo = getResources().getDrawable(R.drawable.info_rounded_background)
|
|
226
|
+
drawableInfo?.setColorFilter(Color.parseColor(manualClickColor), PorterDuff.Mode.SRC_ATOP)
|
|
227
|
+
takePhotoButton.setBackground(drawableInfo)
|
|
228
|
+
takePhotoButton.visibility = View.VISIBLE
|
|
229
|
+
}
|
|
230
|
+
scanOtherManual = result.data
|
|
231
|
+
Thread.sleep(500);
|
|
232
|
+
var fragmentManager = supportFragmentManager
|
|
233
|
+
var transaction = fragmentManager.beginTransaction()
|
|
234
|
+
transaction.replace(R.id.fragmentContainer, result.data)
|
|
235
|
+
transaction.commit()
|
|
236
|
+
}
|
|
237
|
+
is ScanOtherResult.Auto -> {
|
|
238
|
+
scanOther = result.data
|
|
239
|
+
Thread.sleep(500);
|
|
240
|
+
var fragmentManager = supportFragmentManager
|
|
241
|
+
var transaction = fragmentManager.beginTransaction()
|
|
242
|
+
transaction.replace(R.id.fragmentContainer, result.data)
|
|
243
|
+
transaction.commit()
|
|
244
|
+
}
|
|
245
|
+
}
|
|
191
246
|
|
|
192
247
|
}
|
|
193
248
|
|
|
@@ -195,7 +250,7 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
195
250
|
triggerEvent("onError", dataModel)
|
|
196
251
|
runOnUiThread {
|
|
197
252
|
start = false;
|
|
198
|
-
showPopUpMessage(R.drawable.warning, "
|
|
253
|
+
showPopUpMessage(R.drawable.warning, "Your internet connection seems unstable. Please check your connection and try again.\n", "Let's try again", false)
|
|
199
254
|
}
|
|
200
255
|
}
|
|
201
256
|
|
|
@@ -213,14 +268,14 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
213
268
|
triggerEvent("onRetry", dataModel)
|
|
214
269
|
runOnUiThread {
|
|
215
270
|
start = false;
|
|
216
|
-
showPopUpMessage(R.drawable.warning, "
|
|
271
|
+
showPopUpMessage(R.drawable.warning, "We couldn’t read your card. Try again in better lighting and make sure the card is clear and visible.", "Let's try again", false)
|
|
217
272
|
}
|
|
218
273
|
}
|
|
219
274
|
|
|
220
275
|
|
|
221
276
|
|
|
222
|
-
override fun onComplete(dataModel: OtherResponseModel) {
|
|
223
|
-
triggerCompleteEvent("onComplete",dataModel)
|
|
277
|
+
override fun onComplete(dataModel: OtherResponseModel,doneFlag: DoneFlags) {
|
|
278
|
+
triggerCompleteEvent("onComplete",dataModel,doneFlag)
|
|
224
279
|
/** Steps **/
|
|
225
280
|
|
|
226
281
|
/** Data To Submit **/
|
|
@@ -248,7 +303,12 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
248
303
|
|
|
249
304
|
/** End **/
|
|
250
305
|
runOnUiThread {
|
|
251
|
-
|
|
306
|
+
if(isManual){
|
|
307
|
+
scanOtherManual.stopScanning();
|
|
308
|
+
|
|
309
|
+
}else{
|
|
310
|
+
scanOther.stopScanning();
|
|
311
|
+
}
|
|
252
312
|
finish()
|
|
253
313
|
}
|
|
254
314
|
|
|
@@ -319,12 +379,13 @@ class ScanOtherActivity: AppCompatActivity(),
|
|
|
319
379
|
} ?: emptyMap()
|
|
320
380
|
}
|
|
321
381
|
|
|
322
|
-
private fun triggerCompleteEvent(eventName:String, dataModel: OtherResponseModel
|
|
382
|
+
private fun triggerCompleteEvent(eventName:String, dataModel: OtherResponseModel?,doneFlag: DoneFlags){
|
|
323
383
|
val eventResultMap = Arguments.createMap().apply {
|
|
324
384
|
if(dataModel!=null){
|
|
325
385
|
val gson = Gson()
|
|
326
386
|
val jsonString = gson.toJson(dataModel.otherExtractedModel!!)
|
|
327
387
|
putString("OtherDataModel", jsonString)
|
|
388
|
+
putString("DoneFlag", doneFlag.toString())
|
|
328
389
|
}
|
|
329
390
|
}
|
|
330
391
|
reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
@@ -12,6 +12,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
|
12
12
|
import com.assentify.sdk.Core.Constants.MotionType
|
|
13
13
|
import com.assentify.sdk.Core.Constants.ZoomType
|
|
14
14
|
import ImageToBase64Converter
|
|
15
|
+
import android.content.res.ColorStateList
|
|
15
16
|
import android.widget.TextView
|
|
16
17
|
import androidx.appcompat.widget.Toolbar
|
|
17
18
|
import com.google.gson.Gson
|
|
@@ -35,12 +36,17 @@ import android.widget.LinearLayout
|
|
|
35
36
|
import android.widget.RelativeLayout
|
|
36
37
|
import java.text.SimpleDateFormat
|
|
37
38
|
import com.assentify.sdk.Core.Constants.BrightnessEvents
|
|
39
|
+
import com.assentify.sdk.Core.Constants.DoneFlags
|
|
40
|
+
import com.assentify.sdk.ScanPassport.ScanPassportManual
|
|
41
|
+
import com.assentify.sdk.ScanPassport.ScanPassportResult
|
|
38
42
|
|
|
39
43
|
class ScanPassportActivity : AppCompatActivity(),
|
|
40
44
|
ScanPassportCallback {
|
|
41
45
|
private lateinit var assentifySdk: AssentifySdk
|
|
42
46
|
private lateinit var reactApplicationContext: ReactApplicationContext
|
|
43
47
|
private lateinit var scanPassport: ScanPassport
|
|
48
|
+
private lateinit var scanPassportManual: ScanPassportManual
|
|
49
|
+
private var isManual: Boolean = false;
|
|
44
50
|
private lateinit var infoText: TextView
|
|
45
51
|
private lateinit var infoIcon: ImageView
|
|
46
52
|
private lateinit var infoLayout: LinearLayout
|
|
@@ -59,7 +65,8 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
59
65
|
private var isDone: Boolean = false;
|
|
60
66
|
private var apiKey: String = "";
|
|
61
67
|
private var stepID: Int = -1;
|
|
62
|
-
|
|
68
|
+
private lateinit var takePhotoButton: Button;
|
|
69
|
+
private lateinit var manualClickColor: String;
|
|
63
70
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
64
71
|
super.onCreate(savedInstanceState)
|
|
65
72
|
setContentView(R.layout.activity_scan)
|
|
@@ -68,9 +75,25 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
68
75
|
processingColor = intent.getStringExtra("processingColor")!!
|
|
69
76
|
language = intent.getStringExtra("language")!!
|
|
70
77
|
apiKey = intent.getStringExtra("apiKey")!!
|
|
78
|
+
manualClickColor = intent.getStringExtra("manualClickColor")!!
|
|
71
79
|
showCountDown = intent.getBooleanExtra("showCountDown",true)
|
|
72
80
|
stepID = intent.getIntExtra("stepID",-1)!!
|
|
73
81
|
|
|
82
|
+
takePhotoButton = findViewById<Button>(R.id.takePhoto)
|
|
83
|
+
takePhotoButton.visibility = View.GONE
|
|
84
|
+
takePhotoButton.setTextColor(Color.parseColor(processingColor))
|
|
85
|
+
takePhotoButton.backgroundTintList = ColorStateList.valueOf(
|
|
86
|
+
Color.parseColor(manualClickColor)
|
|
87
|
+
)
|
|
88
|
+
takePhotoButton.setOnClickListener {
|
|
89
|
+
scanPassportManual.takePicture()
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
infoLayout = findViewById<LinearLayout>(R.id.infoLayout)
|
|
93
|
+
val drawableInfo = getResources().getDrawable(R.drawable.info_rounded_background)
|
|
94
|
+
drawableInfo?.setColorFilter(Color.parseColor(holdHandColor), PorterDuff.Mode.SRC_ATOP)
|
|
95
|
+
infoLayout.setBackground(drawableInfo)
|
|
96
|
+
|
|
74
97
|
startAssentifySdk()
|
|
75
98
|
|
|
76
99
|
val backButton = findViewById<RelativeLayout>(R.id.backButton)
|
|
@@ -81,16 +104,18 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
81
104
|
backButton.setOnClickListener {
|
|
82
105
|
runOnUiThread {
|
|
83
106
|
triggerEvent("onBackClick", null)
|
|
84
|
-
|
|
107
|
+
if(isManual){
|
|
108
|
+
scanPassportManual.stopScanning();
|
|
109
|
+
}else{
|
|
110
|
+
scanPassport.stopScanning();
|
|
111
|
+
}
|
|
112
|
+
|
|
85
113
|
finish()
|
|
86
114
|
}
|
|
87
115
|
}
|
|
88
116
|
|
|
89
117
|
|
|
90
|
-
|
|
91
|
-
val drawableInfo = getResources().getDrawable(R.drawable.info_rounded_background)
|
|
92
|
-
drawableInfo?.setColorFilter(Color.parseColor(holdHandColor), PorterDuff.Mode.SRC_ATOP)
|
|
93
|
-
infoLayout.setBackground(drawableInfo)
|
|
118
|
+
|
|
94
119
|
|
|
95
120
|
|
|
96
121
|
val toolbarTitle = findViewById<TextView>(R.id.toolbar_title)
|
|
@@ -121,11 +146,16 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
121
146
|
}
|
|
122
147
|
}
|
|
123
148
|
|
|
149
|
+
|
|
124
150
|
}
|
|
125
151
|
|
|
126
152
|
override fun onBackPressed() {
|
|
127
153
|
triggerEvent("onBackClick", null)
|
|
128
|
-
|
|
154
|
+
if(isManual){
|
|
155
|
+
scanPassportManual.stopScanning();
|
|
156
|
+
}else{
|
|
157
|
+
scanPassport.stopScanning();
|
|
158
|
+
}
|
|
129
159
|
finish()
|
|
130
160
|
super.onBackPressed()
|
|
131
161
|
}
|
|
@@ -181,15 +211,35 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
181
211
|
|
|
182
212
|
fun startAssentifySdk() {
|
|
183
213
|
assentifySdk = AssentifySdkObject.getAssentifySdkObject();
|
|
184
|
-
|
|
214
|
+
when (val result = assentifySdk.startScanPassport(
|
|
185
215
|
this@ScanPassportActivity,
|
|
186
|
-
language,stepID
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
216
|
+
language,stepID
|
|
217
|
+
)) {
|
|
218
|
+
is ScanPassportResult.Manual -> {
|
|
219
|
+
isManual = true
|
|
220
|
+
runOnUiThread{
|
|
221
|
+
infoLayout.visibility = View.GONE
|
|
222
|
+
val drawableInfo = getResources().getDrawable(R.drawable.info_rounded_background)
|
|
223
|
+
drawableInfo?.setColorFilter(Color.parseColor(manualClickColor), PorterDuff.Mode.SRC_ATOP)
|
|
224
|
+
takePhotoButton.setBackground(drawableInfo)
|
|
225
|
+
takePhotoButton.visibility = View.VISIBLE
|
|
226
|
+
}
|
|
227
|
+
scanPassportManual = result.data
|
|
228
|
+
Thread.sleep(500);
|
|
229
|
+
var fragmentManager = supportFragmentManager
|
|
230
|
+
var transaction = fragmentManager.beginTransaction()
|
|
231
|
+
transaction.replace(R.id.fragmentContainer, result.data)
|
|
232
|
+
transaction.commit()
|
|
233
|
+
}
|
|
234
|
+
is ScanPassportResult.Auto -> {
|
|
235
|
+
scanPassport = result.data
|
|
236
|
+
Thread.sleep(500);
|
|
237
|
+
var fragmentManager = supportFragmentManager
|
|
238
|
+
var transaction = fragmentManager.beginTransaction()
|
|
239
|
+
transaction.replace(R.id.fragmentContainer, result.data)
|
|
240
|
+
transaction.commit()
|
|
241
|
+
}
|
|
242
|
+
}
|
|
193
243
|
|
|
194
244
|
}
|
|
195
245
|
|
|
@@ -197,7 +247,7 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
197
247
|
triggerEvent("onError", dataModel)
|
|
198
248
|
runOnUiThread {
|
|
199
249
|
start = false;
|
|
200
|
-
showPopUpMessage(R.drawable.warning, "
|
|
250
|
+
showPopUpMessage(R.drawable.warning, "Your internet connection seems unstable. Please check your connection and try again.\n", "Let's try again", false)
|
|
201
251
|
}
|
|
202
252
|
}
|
|
203
253
|
|
|
@@ -215,7 +265,7 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
215
265
|
triggerEvent("onRetry", dataModel)
|
|
216
266
|
runOnUiThread {
|
|
217
267
|
start = false;
|
|
218
|
-
showPopUpMessage(R.drawable.warning, "
|
|
268
|
+
showPopUpMessage(R.drawable.warning, "We couldn’t read your card. Try again in better lighting and make sure the card is clear and visible.", "Let's try again", false)
|
|
219
269
|
}
|
|
220
270
|
}
|
|
221
271
|
|
|
@@ -223,19 +273,19 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
223
273
|
triggerEvent("onLivenessUpdate", dataModel)
|
|
224
274
|
runOnUiThread {
|
|
225
275
|
start = false;
|
|
226
|
-
showPopUpMessage(R.drawable.warning,"
|
|
276
|
+
showPopUpMessage(R.drawable.warning,"Please use your original physical ID card, not a photo or copy.","Let's try again",false)
|
|
227
277
|
}
|
|
228
278
|
}
|
|
229
279
|
|
|
230
|
-
override fun onComplete(dataModel: PassportResponseModel) {
|
|
280
|
+
override fun onComplete(dataModel: PassportResponseModel,doneFlag: DoneFlags) {
|
|
231
281
|
|
|
232
|
-
if (isExpired(dataModel.passportExtractedModel!!.identificationDocumentCapture!!.expiryDate.toString())) {
|
|
282
|
+
if (doneFlag == DoneFlags.Success && isExpired(dataModel.passportExtractedModel!!.identificationDocumentCapture!!.expiryDate.toString())) {
|
|
233
283
|
runOnUiThread {
|
|
234
284
|
start = false;
|
|
235
285
|
showPopUpMessage(R.drawable.expire, "Expired", "Please provide valid ID", false)
|
|
236
286
|
}
|
|
237
287
|
} else {
|
|
238
|
-
triggerCompleteEvent("onComplete", dataModel)
|
|
288
|
+
triggerCompleteEvent("onComplete", dataModel,doneFlag)
|
|
239
289
|
/** Steps **/
|
|
240
290
|
|
|
241
291
|
/** Data To Submit **/
|
|
@@ -264,7 +314,11 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
264
314
|
/** **/
|
|
265
315
|
|
|
266
316
|
runOnUiThread {
|
|
267
|
-
|
|
317
|
+
if(isManual){
|
|
318
|
+
scanPassportManual.stopScanning();
|
|
319
|
+
}else{
|
|
320
|
+
scanPassport.stopScanning();
|
|
321
|
+
}
|
|
268
322
|
/** End **/
|
|
269
323
|
if(!isDone){
|
|
270
324
|
isDone = true;
|
|
@@ -343,12 +397,14 @@ class ScanPassportActivity : AppCompatActivity(),
|
|
|
343
397
|
} ?: emptyMap()
|
|
344
398
|
}
|
|
345
399
|
|
|
346
|
-
private fun triggerCompleteEvent(eventName: String, dataModel: PassportResponseModel?) {
|
|
400
|
+
private fun triggerCompleteEvent(eventName: String, dataModel: PassportResponseModel? ,doneFlag: DoneFlags) {
|
|
401
|
+
|
|
347
402
|
val eventResultMap = Arguments.createMap().apply {
|
|
348
403
|
if (dataModel != null) {
|
|
349
404
|
val gson = Gson()
|
|
350
405
|
val jsonString = gson.toJson(dataModel.passportExtractedModel!!)
|
|
351
406
|
putString("PassportDataModel", jsonString)
|
|
407
|
+
putString("DoneFlag", doneFlag.toString())
|
|
352
408
|
}
|
|
353
409
|
}
|
|
354
410
|
reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|