react-native-biometric-verifier 0.0.37 → 0.0.38
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/package.json +1 -1
- package/src/index.js +48 -50
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -231,68 +231,66 @@ const BiometricModal = React.memo(
|
|
|
231
231
|
animationState: Global.AnimationStates.processing,
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
234
|
+
if (!base64) {
|
|
235
|
+
handleProcessError("Failed to process image.");
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
239
238
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
try {
|
|
240
|
+
const body = { image: base64 };
|
|
241
|
+
const header = { faceid: currentData };
|
|
242
|
+
const buttonapi = `${apiurl}python/recognize`;
|
|
243
|
+
|
|
244
|
+
updateState({
|
|
245
|
+
loadingType: Global.LoadingTypes.networkRequest,
|
|
246
|
+
});
|
|
247
|
+
console.log("API URL:", buttonapi);
|
|
248
|
+
console.log("Sending request to API...", JSON.stringify(body));
|
|
249
|
+
const response = await networkServiceCall(
|
|
250
|
+
"POST",
|
|
251
|
+
buttonapi,
|
|
252
|
+
header,
|
|
253
|
+
body
|
|
254
|
+
);
|
|
255
|
+
console.log("API Response:", JSON.stringify(response));
|
|
256
|
+
if (response?.httpstatus === 200 && response?.data?.data) {
|
|
257
|
+
responseRef.current = response;
|
|
244
258
|
|
|
245
259
|
updateState({
|
|
246
|
-
|
|
260
|
+
employeeData: response.data?.data || null,
|
|
261
|
+
animationState: Global.AnimationStates.success,
|
|
262
|
+
isLoading: false,
|
|
263
|
+
loadingType: Global.LoadingTypes.none,
|
|
247
264
|
});
|
|
248
|
-
console.log("API URL:", buttonapi);
|
|
249
|
-
console.log("Sending request to API...", JSON.stringify(body));
|
|
250
|
-
const response = await networkServiceCall(
|
|
251
|
-
"POST",
|
|
252
|
-
buttonapi,
|
|
253
|
-
header,
|
|
254
|
-
body
|
|
255
|
-
);
|
|
256
|
-
console.log("API Response:", JSON.stringify(response));
|
|
257
|
-
if (response?.httpstatus === 200 && response?.data?.data) {
|
|
258
|
-
responseRef.current = response;
|
|
259
265
|
|
|
260
|
-
|
|
261
|
-
employeeData: response.data?.data || null,
|
|
262
|
-
animationState: Global.AnimationStates.success,
|
|
263
|
-
isLoading: false,
|
|
264
|
-
loadingType: Global.LoadingTypes.none,
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
notifyMessage("Identity verified successfully!", "success");
|
|
268
|
-
|
|
269
|
-
if (qrscan) {
|
|
270
|
-
setTimeout(() => startQRCodeScan(), 1200);
|
|
271
|
-
} else {
|
|
272
|
-
safeCallback(responseRef.current);
|
|
266
|
+
notifyMessage("Identity verified successfully!", "success");
|
|
273
267
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
268
|
+
if (qrscan) {
|
|
269
|
+
setTimeout(() => startQRCodeScan(), 1200);
|
|
270
|
+
} else {
|
|
271
|
+
safeCallback(responseRef.current);
|
|
277
272
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}, 1200);
|
|
273
|
+
if (resetTimeoutRef.current) {
|
|
274
|
+
clearTimeout(resetTimeoutRef.current);
|
|
281
275
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
);
|
|
276
|
+
|
|
277
|
+
resetTimeoutRef.current = setTimeout(() => {
|
|
278
|
+
resetState();
|
|
279
|
+
}, 1200);
|
|
287
280
|
}
|
|
288
|
-
}
|
|
289
|
-
console.error("Network request failed:", error);
|
|
281
|
+
} else {
|
|
290
282
|
handleProcessError(
|
|
291
|
-
|
|
292
|
-
|
|
283
|
+
response?.data?.message ||
|
|
284
|
+
"Face not recognized. Please try again."
|
|
293
285
|
);
|
|
294
286
|
}
|
|
295
|
-
})
|
|
287
|
+
} catch (error) {
|
|
288
|
+
console.error("Network request failed:", error);
|
|
289
|
+
handleProcessError(
|
|
290
|
+
"Connection error. Please check your network.",
|
|
291
|
+
error
|
|
292
|
+
);
|
|
293
|
+
}
|
|
296
294
|
},
|
|
297
295
|
[
|
|
298
296
|
convertImageToBase64,
|