File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
android/src/main/java/com/sourcetoad/idscanreactnative Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -120,17 +120,20 @@ class IdscanSdkModule(reactContext: ReactApplicationContext) :
120120 fun scan (type : String? , apiKeys : ReadableMap , callback : Callback ) {
121121 Log .d(NAME , " React Native IDScanner starting" )
122122
123- if ((apiKeys.isNull(KEY_MRZ_KEY ) && apiKeys.isNull(KEY_PDF_KEY )) || apiKeys.isNull(KEY_PARSER_KEY )) {
123+ val hasMRZKey = apiKeys.hasKey(KEY_MRZ_KEY ) && ! apiKeys.isNull(KEY_MRZ_KEY )
124+ val hasPDFKey = apiKeys.hasKey(KEY_PDF_KEY ) && ! apiKeys.isNull(KEY_PDF_KEY )
125+ val hasParserKey = apiKeys.hasKey(KEY_PARSER_KEY ) && ! apiKeys.isNull(KEY_PARSER_KEY )
126+
127+ if ((! hasMRZKey && ! hasPDFKey) || ! hasParserKey) {
124128 val scanResult = Arguments .createMap()
125129 scanResult.putString(" success" , " false" )
126-
127130 callback.invoke(" Must provide activation keys for IDScan.net's Camera Scanner and ID Parser SDKs" )
128131 return
129132 }
130133
131134 scannerType = type
132- scannerMRZKey = apiKeys.getString(KEY_MRZ_KEY )
133- scannerPDFKey = apiKeys.getString(KEY_PDF_KEY )
135+ scannerMRZKey = if (hasMRZKey) apiKeys.getString(KEY_MRZ_KEY ) else " "
136+ scannerPDFKey = if (hasPDFKey) apiKeys.getString(KEY_PDF_KEY ) else " "
134137 parserKey = apiKeys.getString(KEY_PARSER_KEY )
135138
136139 this .callback = callback
You can’t perform that action at this time.
0 commit comments