From 9d6b12cb32c91793177db6a6de9b6539c3ec187e Mon Sep 17 00:00:00 2001 From: Jan Date: Tue, 17 Dec 2024 16:23:04 +0100 Subject: [PATCH] fix: moved qr scanner label (#257) Signed-off-by: Jan --- apps/easypid/app.config.js | 6 ++ apps/easypid/package.json | 2 +- .../FunkeCredentialDetailAttributesScreen.tsx | 5 -- apps/paradym/app.config.js | 6 ++ apps/paradym/package.json | 2 +- apps/storybook/app.json | 6 ++ apps/storybook/package.json | 2 +- packages/scanner/package.json | 5 +- packages/scanner/src/Scanner.tsx | 71 ++++++++++--------- pnpm-lock.yaml | 59 ++++++++------- 10 files changed, 89 insertions(+), 75 deletions(-) diff --git a/apps/easypid/app.config.js b/apps/easypid/app.config.js index fea3fb7d..c83eab8a 100644 --- a/apps/easypid/app.config.js +++ b/apps/easypid/app.config.js @@ -73,6 +73,12 @@ const config = { }, }, ], + [ + 'expo-camera', + { + cameraPermission: 'Allow $(PRODUCT_NAME) to access your camera.', + }, + ], [ 'expo-build-properties', { diff --git a/apps/easypid/package.json b/apps/easypid/package.json index dcda2ae6..7e08c416 100644 --- a/apps/easypid/package.json +++ b/apps/easypid/package.json @@ -34,8 +34,8 @@ "babel-plugin-module-resolver": "^4.1.0", "burnt": "^0.12.2", "expo": "~51.0.39", - "expo-barcode-scanner": "~13.0.1", "expo-blur": "^13.0.2", + "expo-camera": "~15.0.16", "expo-constants": "~16.0.2", "expo-dev-client": "~4.0.16", "expo-device": "~6.0.2", diff --git a/apps/easypid/src/features/wallet/FunkeCredentialDetailAttributesScreen.tsx b/apps/easypid/src/features/wallet/FunkeCredentialDetailAttributesScreen.tsx index 9607118a..151ca914 100644 --- a/apps/easypid/src/features/wallet/FunkeCredentialDetailAttributesScreen.tsx +++ b/apps/easypid/src/features/wallet/FunkeCredentialDetailAttributesScreen.tsx @@ -83,11 +83,6 @@ export function FunkeCredentialDetailAttributesScreen({ Card attributes - } - variant="info" - message="This overview is only for you. Only share information using a QR code." - /> () useEffect(() => { - const getBarCodeScannerPermissions = async () => { - const { status } = await ExpoBarCodeScanner.requestPermissionsAsync() + const getCameraPermissions = async () => { + const { status } = await Camera.requestCameraPermissionsAsync() setHasPermission(status === 'granted') } - void getBarCodeScannerPermissions() + void getCameraPermissions() }, []) const _openAppSetting = useCallback(() => { @@ -44,7 +44,7 @@ export const QrScanner = ({ onScan, onCancel, helpText }: BarcodeScannerProps) = Please allow camera access - This allows Paradym to scan QR codes that include credentials or data requests. + This allows the app to scan QR codes that include credentials or data requests. _openAppSetting()}>Open settings @@ -54,15 +54,44 @@ export const QrScanner = ({ onScan, onCancel, helpText }: BarcodeScannerProps) = return ( {hasPermission && ( - onScan(data)} + onBarcodeScanned={({ data }) => onScan(data)} + barcodeScannerSettings={{ + barcodeTypes: ['qr'], + }} /> )} Use the camera to scan a QR code + + + {helpText && ( + + + + {helpText} + + + )} + + )} - {/* TODO move this to the top */} - - - {helpText && ( - - - {helpText} - - )} - - diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c8439302..92d44169 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -162,12 +162,12 @@ importers: expo: specifier: ~51.0.39 version: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) - expo-barcode-scanner: - specifier: ~13.0.1 - version: 13.0.1(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) expo-blur: specifier: ^13.0.2 version: 13.0.2(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) + expo-camera: + specifier: ~15.0.16 + version: 15.0.16(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) expo-constants: specifier: ~16.0.2 version: 16.0.2(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) @@ -325,9 +325,9 @@ importers: expo: specifier: ~51.0.39 version: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) - expo-barcode-scanner: - specifier: ~13.0.1 - version: 13.0.1(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) + expo-camera: + specifier: ~15.0.16 + version: 15.0.16(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) expo-constants: specifier: ~16.0.2 version: 16.0.2(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) @@ -440,9 +440,9 @@ importers: expo: specifier: ~51.0.39 version: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) - expo-barcode-scanner: - specifier: ~13.0.1 - version: 13.0.1(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) + expo-camera: + specifier: ~15.0.16 + version: 15.0.16(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) expo-constants: specifier: ~16.0.2 version: 16.0.2(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) @@ -740,6 +740,9 @@ importers: '@package/ui': specifier: workspace:* version: link:../ui + expo: + specifier: 'catalog:' + version: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) devDependencies: '@react-native-masked-view/masked-view': specifier: 0.3.1 @@ -747,9 +750,9 @@ importers: '@types/react': specifier: ~18.2.79 version: 18.2.79 - expo-barcode-scanner: - specifier: ~13.0.1 - version: 13.0.1(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) + expo-camera: + specifier: ~15.0.16 + version: 15.0.16(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) react-native: specifier: 'catalog:' version: 0.74.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@types/react@18.2.79)(react@18.3.1) @@ -5980,11 +5983,6 @@ packages: peerDependencies: expo: '*' - expo-barcode-scanner@13.0.1: - resolution: {integrity: sha512-xBGLT1An2gpAMIQRTLU3oHydKohX8r8F9/ait1Fk9Vgd0GraFZbP4IiT7nHMlaw4H6E7Muucf7vXpGV6u7d4HQ==} - peerDependencies: - expo: '*' - expo-blur@13.0.2: resolution: {integrity: sha512-t2p7BChO3Reykued++QJRMZ/og6J3aXtSQ+bU31YcBeXhZLkHwjWEhiPKPnJka7J2/yTs4+jOCNDY0kCZmcE3w==} peerDependencies: @@ -5995,6 +5993,11 @@ packages: peerDependencies: expo: '*' + expo-camera@15.0.16: + resolution: {integrity: sha512-FLE02DMqkjwsb7IugKAqQvBe6s+TCQeb5LupO1+r//wAhBwmHncOrc6zV95ZEC2f9PTPK34nFH/s8CDGiVzIAA==} + peerDependencies: + expo: '*' + expo-constants@16.0.2: resolution: {integrity: sha512-9tNY3OVO0jfiMzl7ngb6IOyR5VFzNoN5OOazUWoeGfmMqVB5kltTemRvKraK9JRbBKIw+SOYLEmF0sEqgFZ6OQ==} peerDependencies: @@ -6043,11 +6046,6 @@ packages: peerDependencies: expo: '*' - expo-image-loader@4.7.0: - resolution: {integrity: sha512-cx+MxxsAMGl9AiWnQUzrkJMJH4eNOGlu7XkLGnAXSJrRoIiciGaKqzeaD326IyCTV+Z1fXvIliSgNW+DscvD8g==} - peerDependencies: - expo: '*' - expo-image@1.13.0: resolution: {integrity: sha512-0NLDcFmEn4Nh1sXeRvNzDHT+Fl6FXtTol6ki6kYYH0/iDeSFWyIy/Fek6kzDDYAmhipSMR7buPf7VVoHseTbAA==} peerDependencies: @@ -9119,12 +9117,15 @@ packages: sudo-prompt@8.2.5: resolution: {integrity: sha512-rlBo3HU/1zAJUrkY6jNxDOC9eVYliG6nS4JA8u8KAshITd07tafMc/Br7xQwCSseXwJ2iCcHCE8SNWX3q8Z+kw==} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. sudo-prompt@9.1.1: resolution: {integrity: sha512-es33J1g2HjMpyAhz8lOR+ICmXXAqTuKbuXuUWLhOLew20oN9oUCgCJx615U/v7aioZg7IX5lIh9x34vwneu4pA==} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. sudo-prompt@9.2.1: resolution: {integrity: sha512-Mu7R0g4ig9TUuGSxJavny5Rv0egCEtpZRNMrZaYS1vxkiIxGiGUwoezU3LazIQ+KE04hTrTfNPgxU5gzi7F5Pw==} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} @@ -17562,11 +17563,6 @@ snapshots: transitivePeerDependencies: - supports-color - expo-barcode-scanner@13.0.1(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))): - dependencies: - expo: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) - expo-image-loader: 4.7.0(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))) - expo-blur@13.0.2(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))): dependencies: expo: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) @@ -17577,6 +17573,11 @@ snapshots: expo: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) semver: 7.6.3 + expo-camera@15.0.16(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))): + dependencies: + expo: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) + invariant: 2.2.4 + expo-constants@16.0.2(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))): dependencies: '@expo/config': 9.0.4 @@ -17637,10 +17638,6 @@ snapshots: dependencies: expo: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) - expo-image-loader@4.7.0(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))): - dependencies: - expo: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0)) - expo-image@1.13.0(expo@51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))): dependencies: expo: 51.0.39(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))