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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +48 -50
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-biometric-verifier",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "description": "A React Native module for biometric verification with face recognition and QR code scanning",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -231,68 +231,66 @@ const BiometricModal = React.memo(
231
231
  animationState: Global.AnimationStates.processing,
232
232
  });
233
233
 
234
- InteractionManager.runAfterInteractions(async () => {
235
- if (!base64) {
236
- handleProcessError("Failed to process image.");
237
- return;
238
- }
234
+ if (!base64) {
235
+ handleProcessError("Failed to process image.");
236
+ return;
237
+ }
239
238
 
240
- try {
241
- const body = { image: base64 };
242
- const header = { faceid: currentData };
243
- const buttonapi = `${apiurl}python/recognize`;
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
- loadingType: Global.LoadingTypes.networkRequest,
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
- updateState({
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
- if (resetTimeoutRef.current) {
275
- clearTimeout(resetTimeoutRef.current);
276
- }
268
+ if (qrscan) {
269
+ setTimeout(() => startQRCodeScan(), 1200);
270
+ } else {
271
+ safeCallback(responseRef.current);
277
272
 
278
- resetTimeoutRef.current = setTimeout(() => {
279
- resetState();
280
- }, 1200);
273
+ if (resetTimeoutRef.current) {
274
+ clearTimeout(resetTimeoutRef.current);
281
275
  }
282
- } else {
283
- handleProcessError(
284
- response?.data?.message ||
285
- "Face not recognized. Please try again."
286
- );
276
+
277
+ resetTimeoutRef.current = setTimeout(() => {
278
+ resetState();
279
+ }, 1200);
287
280
  }
288
- } catch (error) {
289
- console.error("Network request failed:", error);
281
+ } else {
290
282
  handleProcessError(
291
- "Connection error. Please check your network.",
292
- error
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,