Skip to content

Commit 0c132b6

Browse files
committed
fix: android scanner does not show if only provided one scanner key
1 parent 8d3e480 commit 0c132b6

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

android/src/main/java/com/sourcetoad/idscanreactnative/IdscanSdkModule.kt

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,25 @@ class IdscanSdkModule(reactContext: ReactApplicationContext) :
151151

152152
private fun showDefaultScanView() {
153153
if (checkCameraPermissions()) {
154-
MultiScanActivity.build(currentActivity!!)
155-
.withComponent(
156-
PDF417Component.build()
157-
.withLicenseKey(scannerPDFKey!!)
158-
.complete()
159-
)
160-
.withComponent(
154+
val multiScanActivity = MultiScanActivity.build(currentActivity!!)
155+
156+
if (!(scannerMRZKey!!).isNullOrEmpty()){
157+
multiScanActivity.withComponent(
161158
MRZComponent.build()
162159
.withLicenseKey(scannerMRZKey!!)
163160
.complete()
164161
)
165-
.start(SCAN_ACTIVITY_CODE)
162+
}
163+
164+
if (!(scannerPDFKey!!).isNullOrEmpty()) {
165+
multiScanActivity.withComponent(
166+
PDF417Component.build()
167+
.withLicenseKey(scannerPDFKey!!)
168+
.complete()
169+
)
170+
}
171+
172+
multiScanActivity.start(SCAN_ACTIVITY_CODE)
166173
} else {
167174
requestCameraPermissions(REQUEST_CAMERA_PERMISSIONS_DEFAULT)
168175
}

0 commit comments

Comments
 (0)