@trustchex/react-native-sdk 1.464.0 → 1.472.0

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 (46) hide show
  1. package/android/src/main/java/com/trustchex/reactnativesdk/camera/TrustchexCameraView.kt +43 -3
  2. package/ios/Camera/TrustchexCameraView.swift +152 -27
  3. package/ios/Permission/PermissionModule.m +22 -0
  4. package/ios/Permission/PermissionModule.swift +67 -0
  5. package/lib/module/Screens/Dynamic/LivenessDetectionScreen.js +24 -3
  6. package/lib/module/Screens/Dynamic/VerbalConsentScreen.js +1 -1
  7. package/lib/module/Screens/Dynamic/VideoCallScreen.js +7 -12
  8. package/lib/module/Screens/Static/ResultScreen.js +4 -1
  9. package/lib/module/Shared/Components/EIDScanner.js +166 -163
  10. package/lib/module/Shared/Components/FaceCamera.js +14 -8
  11. package/lib/module/Shared/Components/IdentityDocumentCamera.js +7 -6
  12. package/lib/module/Shared/Libs/PERMISSIONS_MANAGER.md +268 -0
  13. package/lib/module/Shared/Libs/index.js +20 -0
  14. package/lib/module/Shared/Libs/permissions.utils.js +199 -0
  15. package/lib/module/Translation/Resources/en.js +1 -0
  16. package/lib/module/Translation/Resources/tr.js +1 -0
  17. package/lib/module/version.js +1 -1
  18. package/lib/typescript/src/Screens/Dynamic/LivenessDetectionScreen.d.ts.map +1 -1
  19. package/lib/typescript/src/Screens/Dynamic/VideoCallScreen.d.ts.map +1 -1
  20. package/lib/typescript/src/Screens/Static/ResultScreen.d.ts.map +1 -1
  21. package/lib/typescript/src/Shared/Components/EIDScanner.d.ts.map +1 -1
  22. package/lib/typescript/src/Shared/Components/FaceCamera.d.ts.map +1 -1
  23. package/lib/typescript/src/Shared/Components/IdentityDocumentCamera.d.ts.map +1 -1
  24. package/lib/typescript/src/Shared/Libs/index.d.ts +20 -0
  25. package/lib/typescript/src/Shared/Libs/index.d.ts.map +1 -0
  26. package/lib/typescript/src/Shared/Libs/permissions.utils.d.ts +58 -0
  27. package/lib/typescript/src/Shared/Libs/permissions.utils.d.ts.map +1 -0
  28. package/lib/typescript/src/Translation/Resources/en.d.ts +1 -0
  29. package/lib/typescript/src/Translation/Resources/en.d.ts.map +1 -1
  30. package/lib/typescript/src/Translation/Resources/tr.d.ts +1 -0
  31. package/lib/typescript/src/Translation/Resources/tr.d.ts.map +1 -1
  32. package/lib/typescript/src/version.d.ts +1 -1
  33. package/package.json +1 -1
  34. package/src/Screens/Dynamic/LivenessDetectionScreen.tsx +45 -5
  35. package/src/Screens/Dynamic/VerbalConsentScreen.tsx +1 -1
  36. package/src/Screens/Dynamic/VideoCallScreen.tsx +8 -19
  37. package/src/Screens/Static/ResultScreen.tsx +13 -9
  38. package/src/Shared/Components/EIDScanner.tsx +210 -160
  39. package/src/Shared/Components/FaceCamera.tsx +19 -16
  40. package/src/Shared/Components/IdentityDocumentCamera.tsx +7 -7
  41. package/src/Shared/Libs/PERMISSIONS_MANAGER.md +268 -0
  42. package/src/Shared/Libs/index.ts +63 -0
  43. package/src/Shared/Libs/permissions.utils.ts +251 -0
  44. package/src/Translation/Resources/en.ts +1 -0
  45. package/src/Translation/Resources/tr.ts +1 -0
  46. package/src/version.ts +1 -1
@@ -5,6 +5,8 @@ import { Alert, View, Text, Image, StyleSheet, Animated } from 'react-native';
5
5
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
6
  import NFCManager from 'react-native-nfc-manager';
7
7
  import DeviceInfo from 'react-native-device-info';
8
+ import PermissionManager from "../Libs/permissions.utils.js";
9
+ import { debugError } from "../Libs/debug.utils.js";
8
10
  import { eidReader } from "../EIDReader/eidReader.js";
9
11
  import NativeProgressBar from "./NativeProgressBar.js";
10
12
  import { useTranslation } from 'react-i18next';
@@ -107,6 +109,15 @@ const EIDScanner = ({
107
109
  setProgressStage('');
108
110
  resetLastMessage();
109
111
 
112
+ // Check NFC permissions before attempting to scan
113
+ const hasNFCPermission = await PermissionManager.requestPermission('nfc');
114
+ if (!hasNFCPermission) {
115
+ debugError('EIDScanner', 'NFC permission denied');
116
+ setIsScanning(false);
117
+ Alert.alert(t('eidScannerScreen.error'), t('eidScannerScreen.nfcPermissionDenied', 'NFC permission is required to scan your document'));
118
+ return;
119
+ }
120
+
110
121
  // Track EID scan start using analytics helper
111
122
  const docType = documentType || 'UNKNOWN';
112
123
 
@@ -320,120 +331,82 @@ const EIDScanner = ({
320
331
  children: t('eidScannerScreen.startScanning')
321
332
  })]
322
333
  }) : /*#__PURE__*/_jsxs(_Fragment, {
323
- children: [isScanned && /*#__PURE__*/_jsxs(View, {
324
- style: styles.resultCard,
334
+ children: [isScanned && documentMRZInfo && /*#__PURE__*/_jsxs(View, {
335
+ style: styles.idCardWrapper,
325
336
  children: [/*#__PURE__*/_jsxs(View, {
326
- style: styles.resultHeader,
327
- children: [documentFaceImage && (documentFaceImageMimeType === 'image/jpeg' || documentFaceImageMimeType === 'image/png') ? /*#__PURE__*/_jsx(Image, {
328
- source: {
329
- uri: `data:${documentFaceImageMimeType};base64,${documentFaceImage}`
330
- },
331
- style: styles.faceImage,
332
- resizeMode: "cover"
333
- }) : /*#__PURE__*/_jsx(View, {
334
- style: styles.faceImagePlaceholder,
337
+ style: styles.idCard,
338
+ children: [/*#__PURE__*/_jsx(View, {
339
+ style: [styles.idCardStrip, {
340
+ backgroundColor: appContext.branding.primaryColor
341
+ }],
335
342
  children: /*#__PURE__*/_jsx(Text, {
336
- style: styles.faceImagePlaceholderText,
337
- children: "?"
338
- })
339
- }), documentMRZInfo && /*#__PURE__*/_jsxs(View, {
340
- style: styles.resultHeaderInfo,
341
- children: [/*#__PURE__*/_jsxs(Text, {
342
- style: styles.fullName,
343
- numberOfLines: 2,
344
- children: [documentMRZInfo.getSecondaryIdentifier(), ' ', documentMRZInfo.getPrimaryIdentifier()]
345
- }), /*#__PURE__*/_jsxs(Text, {
346
- style: styles.subInfo,
347
- children: [formatNationality(documentMRZInfo.getNationality()), " \xB7", ' ', formatDocumentType(documentMRZInfo.getDocumentCode())]
348
- }), /*#__PURE__*/_jsxs(Text, {
349
- style: styles.subInfo,
350
- children: [formatGender(documentMRZInfo.getGender().getStrCode()), " \xB7", ' ', formatDate(documentMRZInfo.getDateOfBirth())]
351
- })]
352
- })]
353
- }), documentMRZInfo && /*#__PURE__*/_jsxs(View, {
354
- style: styles.mrzInfo,
355
- children: [/*#__PURE__*/_jsxs(View, {
356
- style: styles.mrzInfoItem,
357
- children: [/*#__PURE__*/_jsx(Text, {
358
- style: styles.mrzInfoLabel,
359
- children: t('eidScannerScreen.name')
360
- }), /*#__PURE__*/_jsx(Text, {
361
- style: styles.mrzInfoText,
362
- children: documentMRZInfo.getSecondaryIdentifier()
363
- })]
364
- }), /*#__PURE__*/_jsxs(View, {
365
- style: styles.mrzInfoItem,
366
- children: [/*#__PURE__*/_jsx(Text, {
367
- style: styles.mrzInfoLabel,
368
- children: t('eidScannerScreen.surname')
369
- }), /*#__PURE__*/_jsx(Text, {
370
- style: styles.mrzInfoText,
371
- children: documentMRZInfo.getPrimaryIdentifier()
372
- })]
373
- }), /*#__PURE__*/_jsxs(View, {
374
- style: styles.mrzInfoItem,
375
- children: [/*#__PURE__*/_jsx(Text, {
376
- style: styles.mrzInfoLabel,
377
- children: t('eidScannerScreen.documentCode')
378
- }), /*#__PURE__*/_jsx(Text, {
379
- style: styles.mrzInfoText,
343
+ style: styles.idCardStripDocType,
380
344
  children: formatDocumentType(documentMRZInfo.getDocumentCode())
381
- })]
382
- }), /*#__PURE__*/_jsxs(View, {
383
- style: styles.mrzInfoItem,
384
- children: [/*#__PURE__*/_jsx(Text, {
385
- style: styles.mrzInfoLabel,
386
- children: t('eidScannerScreen.documentNumber')
387
- }), /*#__PURE__*/_jsx(Text, {
388
- style: styles.mrzInfoText,
389
- children: documentMRZInfo.getDocumentNumber()
390
- })]
391
- }), /*#__PURE__*/_jsxs(View, {
392
- style: styles.mrzInfoItem,
393
- children: [/*#__PURE__*/_jsx(Text, {
394
- style: styles.mrzInfoLabel,
395
- children: t('eidScannerScreen.personalNumber')
396
- }), /*#__PURE__*/_jsx(Text, {
397
- style: styles.mrzInfoText,
398
- children: documentMRZInfo.getOptionalData1()
399
- })]
400
- }), /*#__PURE__*/_jsxs(View, {
401
- style: styles.mrzInfoItem,
402
- children: [/*#__PURE__*/_jsx(Text, {
403
- style: styles.mrzInfoLabel,
404
- children: t('eidScannerScreen.nationality')
405
- }), /*#__PURE__*/_jsx(Text, {
406
- style: styles.mrzInfoText,
407
- children: formatNationality(documentMRZInfo.getNationality())
408
- })]
409
- }), /*#__PURE__*/_jsxs(View, {
410
- style: styles.mrzInfoItem,
411
- children: [/*#__PURE__*/_jsx(Text, {
412
- style: styles.mrzInfoLabel,
413
- children: t('eidScannerScreen.gender')
414
- }), /*#__PURE__*/_jsx(Text, {
415
- style: styles.mrzInfoText,
416
- children: formatGender(documentMRZInfo.getGender().getStrCode())
417
- })]
418
- }), /*#__PURE__*/_jsxs(View, {
419
- style: styles.mrzInfoItem,
420
- children: [/*#__PURE__*/_jsx(Text, {
421
- style: styles.mrzInfoLabel,
422
- children: t('eidScannerScreen.birthDate')
423
- }), /*#__PURE__*/_jsx(Text, {
424
- style: styles.mrzInfoText,
425
- children: formatDate(documentMRZInfo.getDateOfBirth())
426
- })]
345
+ })
427
346
  }), /*#__PURE__*/_jsxs(View, {
428
- style: styles.mrzInfoItem,
429
- children: [/*#__PURE__*/_jsx(Text, {
430
- style: styles.mrzInfoLabel,
431
- children: t('eidScannerScreen.expirationDate')
432
- }), /*#__PURE__*/_jsx(Text, {
433
- style: styles.mrzInfoText,
434
- children: formatDate(documentMRZInfo.getDateOfExpiry())
347
+ style: styles.idCardBody,
348
+ children: [/*#__PURE__*/_jsx(View, {
349
+ style: styles.idCardPhotoContainer,
350
+ children: /*#__PURE__*/_jsx(View, {
351
+ style: styles.idCardPhotoFrame,
352
+ children: documentFaceImage && (documentFaceImageMimeType === 'image/jpeg' || documentFaceImageMimeType === 'image/png') ? /*#__PURE__*/_jsx(Image, {
353
+ source: {
354
+ uri: `data:${documentFaceImageMimeType};base64,${documentFaceImage}`
355
+ },
356
+ style: styles.idCardPhoto,
357
+ resizeMode: "cover"
358
+ }) : /*#__PURE__*/_jsx(View, {
359
+ style: styles.idCardPhotoPlaceholder,
360
+ children: /*#__PURE__*/_jsx(Text, {
361
+ style: styles.idCardPhotoPlaceholderText,
362
+ children: "?"
363
+ })
364
+ })
365
+ })
366
+ }), /*#__PURE__*/_jsxs(View, {
367
+ style: styles.idCardFields,
368
+ children: [/*#__PURE__*/_jsx(IDCardField, {
369
+ label: t('eidScannerScreen.surname'),
370
+ value: documentMRZInfo.getPrimaryIdentifier()
371
+ }), /*#__PURE__*/_jsx(IDCardField, {
372
+ label: t('eidScannerScreen.name'),
373
+ value: documentMRZInfo.getSecondaryIdentifier()
374
+ }), /*#__PURE__*/_jsx(IDCardField, {
375
+ label: t('eidScannerScreen.documentNumber'),
376
+ value: documentMRZInfo.getDocumentNumber()
377
+ }), /*#__PURE__*/_jsx(IDCardField, {
378
+ label: t('eidScannerScreen.birthDate'),
379
+ value: formatDate(documentMRZInfo.getDateOfBirth())
380
+ }), /*#__PURE__*/_jsx(IDCardField, {
381
+ label: t('eidScannerScreen.expirationDate'),
382
+ value: formatDate(documentMRZInfo.getDateOfExpiry())
383
+ }), /*#__PURE__*/_jsx(IDCardField, {
384
+ label: t('eidScannerScreen.gender'),
385
+ value: formatGender(documentMRZInfo.getGender().getStrCode())
386
+ }), /*#__PURE__*/_jsx(IDCardField, {
387
+ label: t('eidScannerScreen.nationality'),
388
+ value: formatNationality(documentMRZInfo.getNationality())
389
+ }), /*#__PURE__*/_jsx(IDCardField, {
390
+ label: t('eidScannerScreen.issuingState'),
391
+ value: formatNationality(documentMRZInfo.getIssuingState())
392
+ }), !!(documentMRZInfo.getPersonalNumber() || documentMRZInfo.getOptionalData1()) && /*#__PURE__*/_jsx(IDCardField, {
393
+ label: t('eidScannerScreen.personalNumber'),
394
+ value: documentMRZInfo.getPersonalNumber() || documentMRZInfo.getOptionalData1() || ''
395
+ })]
435
396
  })]
436
397
  })]
398
+ }), hasNfc && isEnabled && isScanned && /*#__PURE__*/_jsx(View, {
399
+ style: styles.buttonsContainer,
400
+ children: /*#__PURE__*/_jsx(StyledButton, {
401
+ mode: "contained",
402
+ disabled: !documentFaceImage || !documentMRZInfo,
403
+ onPress: () => {
404
+ if (onScanSuccess && documentMRZInfo && documentFaceImage && documentFaceImageMimeType) {
405
+ onScanSuccess(getFieldsFromMRZ(documentMRZInfo), documentFaceImage, documentFaceImageMimeType);
406
+ }
407
+ },
408
+ children: t('eidScannerScreen.approveAndContinue')
409
+ })
437
410
  })]
438
411
  }), !hasNfc && /*#__PURE__*/_jsx(Text, {
439
412
  style: styles.mainText,
@@ -472,7 +445,7 @@ const EIDScanner = ({
472
445
  onPress: readNFC,
473
446
  children: t('eidScannerScreen.startScanning')
474
447
  })
475
- }), hasNfc && isEnabled && isScanned && /*#__PURE__*/_jsx(View, {
448
+ }), hasNfc && isEnabled && isScanned && !documentMRZInfo && /*#__PURE__*/_jsx(View, {
476
449
  style: styles.buttonsContainer,
477
450
  children: /*#__PURE__*/_jsx(StyledButton, {
478
451
  mode: "contained",
@@ -557,86 +530,102 @@ const styles = StyleSheet.create({
557
530
  color: 'black',
558
531
  textAlign: 'center'
559
532
  },
560
- resultCard: {
533
+ // ── ID Card result layout ──────────────────────────────────────────────
534
+ idCardWrapper: {
535
+ gap: 10
536
+ },
537
+ idCard: {
561
538
  backgroundColor: '#fff',
562
- borderRadius: 16,
563
- padding: 16,
564
- gap: 16,
539
+ borderRadius: 14,
540
+ overflow: 'hidden',
565
541
  shadowColor: '#000',
566
542
  shadowOffset: {
567
543
  width: 0,
568
- height: 2
544
+ height: 3
569
545
  },
570
- shadowOpacity: 0.08,
571
- shadowRadius: 8,
572
- elevation: 3,
546
+ shadowOpacity: 0.12,
547
+ shadowRadius: 10,
548
+ elevation: 4,
573
549
  borderWidth: 1,
574
- borderColor: '#f0f0f0'
550
+ borderColor: '#e8e8e8'
575
551
  },
576
- resultHeader: {
552
+ idCardStrip: {
577
553
  flexDirection: 'row',
578
- gap: 14,
579
- alignItems: 'flex-start'
580
- },
581
- resultHeaderInfo: {
582
- flex: 1,
583
- gap: 4,
584
- justifyContent: 'center'
554
+ justifyContent: 'space-between',
555
+ alignItems: 'center',
556
+ paddingHorizontal: 12,
557
+ paddingVertical: 6
585
558
  },
586
- fullName: {
587
- fontSize: 17,
559
+ idCardStripDocType: {
560
+ color: '#fff',
561
+ fontSize: 12,
588
562
  fontWeight: '700',
589
- color: '#111',
590
- letterSpacing: 0.2
563
+ letterSpacing: 0.5,
564
+ textTransform: 'uppercase'
591
565
  },
592
- subInfo: {
593
- fontSize: 13,
594
- color: '#666',
595
- fontWeight: '500'
566
+ idCardStripIssuer: {
567
+ color: 'rgba(255,255,255,0.85)',
568
+ fontSize: 12,
569
+ fontWeight: '600',
570
+ letterSpacing: 0.3
596
571
  },
597
- faceImage: {
598
- width: 90,
599
- height: 115,
572
+ idCardBody: {
573
+ flexDirection: 'row',
574
+ alignItems: 'stretch'
575
+ },
576
+ idCardPhotoContainer: {
577
+ width: 110,
578
+ padding: 8,
579
+ alignSelf: 'stretch'
580
+ },
581
+ idCardPhotoFrame: {
582
+ flex: 1,
600
583
  borderRadius: 10,
601
- overflow: 'hidden'
584
+ overflow: 'hidden',
585
+ borderWidth: 1,
586
+ borderColor: 'rgba(0,0,0,0.12)'
587
+ },
588
+ idCardPhoto: {
589
+ flex: 1
602
590
  },
603
- faceImagePlaceholder: {
604
- width: 90,
605
- height: 115,
591
+ idCardPhotoPlaceholder: {
592
+ flex: 1,
606
593
  borderRadius: 10,
607
594
  backgroundColor: '#f5f5f5',
608
595
  alignItems: 'center',
609
596
  justifyContent: 'center'
610
597
  },
611
- faceImagePlaceholderText: {
612
- fontSize: 32,
598
+ idCardPhotoPlaceholderText: {
599
+ fontSize: 30,
613
600
  color: '#ccc'
614
601
  },
615
- mrzInfo: {
616
- flexDirection: 'column',
617
- width: '100%',
618
- gap: 2
619
- },
620
- mrzInfoItem: {
602
+ idCardFields: {
603
+ flex: 1,
621
604
  flexDirection: 'row',
622
- justifyContent: 'space-between',
623
- alignItems: 'center',
624
- paddingVertical: 8,
625
- borderBottomColor: '#f0f0f0',
626
- borderBottomWidth: 1
605
+ flexWrap: 'wrap',
606
+ gap: 6,
607
+ alignContent: 'flex-start',
608
+ padding: 10
627
609
  },
628
- mrzInfoLabel: {
629
- color: '#888',
630
- fontSize: 13,
631
- fontWeight: '500'
610
+ idCardFieldItem: {
611
+ flexGrow: 1,
612
+ flexShrink: 1,
613
+ flexBasis: '45%',
614
+ minWidth: 0
632
615
  },
633
- mrzInfoText: {
634
- color: '#111',
635
- fontSize: 13,
616
+ idCardFieldLabel: {
617
+ fontSize: 8,
636
618
  fontWeight: '600',
637
- textAlign: 'right',
619
+ color: '#999',
620
+ letterSpacing: 0.3,
621
+ marginBottom: 1
622
+ },
623
+ idCardFieldValue: {
624
+ fontSize: 11,
625
+ fontWeight: '600',
626
+ color: '#111',
638
627
  flexShrink: 1,
639
- marginLeft: 8
628
+ flexWrap: 'wrap'
640
629
  },
641
630
  guide: {
642
631
  flex: 1,
@@ -667,4 +656,18 @@ const styles = StyleSheet.create({
667
656
  fontSize: 14
668
657
  }
669
658
  });
659
+ const IDCardField = ({
660
+ label,
661
+ value
662
+ }) => /*#__PURE__*/_jsxs(View, {
663
+ style: styles.idCardFieldItem,
664
+ children: [/*#__PURE__*/_jsx(Text, {
665
+ style: styles.idCardFieldLabel,
666
+ numberOfLines: 1,
667
+ children: label
668
+ }), /*#__PURE__*/_jsx(Text, {
669
+ style: styles.idCardFieldValue,
670
+ children: value || '—'
671
+ })]
672
+ });
670
673
  export default EIDScanner;
@@ -3,8 +3,9 @@
3
3
  import { useIsFocused } from '@react-navigation/native';
4
4
  import { useKeepAwake } from "../Libs/native-keep-awake.utils.js";
5
5
  import { debugLog, debugWarn, debugError, logError } from "../Libs/debug.utils.js";
6
+ import PermissionManager from "../Libs/permissions.utils.js";
6
7
  import React, { useEffect, useState, useRef, useCallback } from 'react';
7
- import { StyleSheet, Text, View, Platform, Linking, ActivityIndicator, NativeModules, PermissionsAndroid } from 'react-native';
8
+ import { StyleSheet, Text, View, Linking, ActivityIndicator, NativeModules } from 'react-native';
8
9
  import { TrustchexCamera } from "./TrustchexCamera.js";
9
10
  import { useTranslation } from 'react-i18next';
10
11
  import StyledButton from "./StyledButton.js";
@@ -41,13 +42,18 @@ const FaceCamera = ({
41
42
  } = useTranslation();
42
43
  useEffect(() => {
43
44
  const requestPermissions = async () => {
44
- if (Platform.OS === 'android') {
45
- const cameraGranted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.CAMERA);
46
- const audioGranted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO);
47
- setHasPermission(cameraGranted === PermissionsAndroid.RESULTS.GRANTED && audioGranted === PermissionsAndroid.RESULTS.GRANTED);
48
- } else {
49
- // iOS permissions handled by native camera
50
- setHasPermission(true);
45
+ try {
46
+ const permissions = await PermissionManager.requestPermissions(['camera', 'microphone']);
47
+ const hasCamera = permissions.get('camera') ?? false;
48
+ const hasMicrophone = permissions.get('microphone') ?? false;
49
+ debugLog('FaceCamera', 'Permissions requested:', {
50
+ camera: hasCamera,
51
+ microphone: hasMicrophone
52
+ });
53
+ setHasPermission(hasCamera && hasMicrophone);
54
+ } catch (error) {
55
+ debugError('FaceCamera', 'Permission request failed:', error);
56
+ setHasPermission(false);
51
57
  }
52
58
  setPermissionsRequested(true);
53
59
  };
@@ -2,10 +2,11 @@
2
2
 
3
3
  /* eslint-disable react-native/no-inline-styles */
4
4
  import React, { useEffect, useState, useRef, useCallback } from 'react';
5
- import { View, StyleSheet, Text as TextView, Platform, StatusBar, Vibration, Linking, ActivityIndicator, PermissionsAndroid, Animated } from 'react-native';
5
+ import { View, StyleSheet, Text as TextView, Platform, StatusBar, Vibration, Linking, ActivityIndicator, Animated } from 'react-native';
6
6
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
7
7
  import { TrustchexCamera } from "./TrustchexCamera.js";
8
8
  import { NativeModules } from 'react-native';
9
+ import PermissionManager from "../Libs/permissions.utils.js";
9
10
  import mrzUtils from "../Libs/mrz.utils.js";
10
11
  import { useKeepAwake } from "../Libs/native-keep-awake.utils.js";
11
12
  import { useIsFocused } from '@react-navigation/native';
@@ -120,11 +121,11 @@ const IdentityDocumentCamera = ({
120
121
  } = useTranslation();
121
122
  useEffect(() => {
122
123
  const requestPermissions = async () => {
123
- if (Platform.OS === 'android') {
124
- const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.CAMERA);
125
- setHasPermission(granted === PermissionsAndroid.RESULTS.GRANTED);
126
- } else {
127
- setHasPermission(true);
124
+ try {
125
+ const hasCameraPermission = await PermissionManager.requestPermission('camera');
126
+ setHasPermission(hasCameraPermission);
127
+ } catch (error) {
128
+ setHasPermission(false);
128
129
  }
129
130
  setPermissionsRequested(true);
130
131
  };