From 5e0212db2d4228f863fc019fa495809089a36189 Mon Sep 17 00:00:00 2001 From: BrodyHughes <41711440+BrodyHughes@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:20:08 -0600 Subject: [PATCH] remove old package --- package.json | 1 - .../qrcode-scanner/useCameraPermissions.tsx | 68 ------------------- yarn.lock | 7 -- 3 files changed, 76 deletions(-) delete mode 100644 src/components/qrcode-scanner/useCameraPermissions.tsx diff --git a/package.json b/package.json index e7f6735b0ed..069535ee73c 100644 --- a/package.json +++ b/package.json @@ -214,7 +214,6 @@ "react-native-ble-plx": "2.0.3", "react-native-bootsplash": "4.3.2", "react-native-branch": "5.3.1", - "react-native-camera": "4.2.1", "react-native-change-icon": "4.0.0", "react-native-circular-progress": "1.3.8", "react-native-cloud-fs": "rainbow-me/react-native-cloud-fs#c4ed2d78a7c401f628248a4e45eaf5bf9319a31a", diff --git a/src/components/qrcode-scanner/useCameraPermissions.tsx b/src/components/qrcode-scanner/useCameraPermissions.tsx deleted file mode 100644 index 66f44085a75..00000000000 --- a/src/components/qrcode-scanner/useCameraPermissions.tsx +++ /dev/null @@ -1,68 +0,0 @@ -// UNUSED AT THE MOMENT. -// USING REACT-NATIVE-VISION-CAMERA PERMISSIONS HOOK INSTEAD. -// WILL DELETE THIS LATER. -// KEEPING FOR REFERENCE ATM. - -import { useState, useCallback, useEffect } from 'react'; -import { Platform } from 'react-native'; -import { - check as checkForPermissions, - PERMISSIONS, - request as requestPermission, - RESULTS, -} from 'react-native-permissions'; - -export enum CameraState { - // unexpected mount error - Error = 'error', - // properly working camera, ready to scan - Scanning = 'scanning', - // we should ask user for permission - Unauthorized = 'unauthorized', - // ready to go - Waiting = 'waiting', -} - -export function useCameraPermission() { - const [cameraState, setCameraState] = useState( - CameraState.Scanning - ); - - const askForPermissions = useCallback(async () => { - try { - const permission = - Platform.OS === 'ios' - ? PERMISSIONS.IOS.CAMERA - : PERMISSIONS.ANDROID.CAMERA; - - const res = await checkForPermissions(permission); - - if (res === RESULTS.DENIED || res === RESULTS.BLOCKED) { - const askResult = await requestPermission(permission); - - if (askResult !== RESULTS.GRANTED) { - setCameraState(CameraState.Unauthorized); - } else { - setCameraState(CameraState.Scanning); - } - } else if (res === RESULTS.UNAVAILABLE) { - setCameraState(CameraState.Unauthorized); - } else if (res === RESULTS.GRANTED) { - setCameraState(CameraState.Scanning); - } - } catch (err) { - setCameraState(CameraState.Error); - throw err; - } - }, []); - - useEffect(() => { - askForPermissions(); - }, [askForPermissions]); - - return { - cameraState, - setCameraState, - askForPermissions, - }; -} diff --git a/yarn.lock b/yarn.lock index 1a199315f64..16df473774f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15127,13 +15127,6 @@ react-native-branch@5.3.1: resolved "https://registry.yarnpkg.com/react-native-branch/-/react-native-branch-5.3.1.tgz#872bb3500a6756e9e59883bd03fd8f9aab4857c6" integrity sha512-d7gaQQg43bS57O4j8V07s7lqD5gu3G4Vrf23bS/RnxTmQMKcifVFpUCSyUYuiUyL4H58D7pL2GgsujP2TRuhkw== -react-native-camera@4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/react-native-camera/-/react-native-camera-4.2.1.tgz#caf74081f055e89d7e9b0cd5108965d808c60e90" - integrity sha512-+Vkql24PFYQfsPRznJCvPwJQfyzCnjlcww/iZ4Ej80bgivKjL9eU0IMQIXp4yi6XCrKi4voWXxIDPMupQZKeIQ== - dependencies: - prop-types "^15.6.2" - react-native-change-icon@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/react-native-change-icon/-/react-native-change-icon-4.0.0.tgz#7d398dcf17f67f7301cc408d06cb075473605416"