From 91005ec15d580218bf07d6937dbb06a3197a3405 Mon Sep 17 00:00:00 2001 From: Shiva Date: Tue, 30 Apr 2024 13:33:44 +0530 Subject: [PATCH] Revert "[INJIVER-173] Added feature to select camera" This reverts commit ef81db2ceb52da7f31ace4ee820f10d6f722c2f6. Signed-off-by: Shiva --- .../Home/VerificationSection/QrScanner.tsx | 7 ++--- .../Home/VerificationSection/Verification.tsx | 30 ++----------------- .../src/hooks/useCameraSelectionHook.ts | 21 ------------- 3 files changed, 5 insertions(+), 53 deletions(-) delete mode 100644 inji-verify/src/hooks/useCameraSelectionHook.ts diff --git a/inji-verify/src/components/Home/VerificationSection/QrScanner.tsx b/inji-verify/src/components/Home/VerificationSection/QrScanner.tsx index 7253f2cc..e1f42bdd 100644 --- a/inji-verify/src/components/Home/VerificationSection/QrScanner.tsx +++ b/inji-verify/src/components/Home/VerificationSection/QrScanner.tsx @@ -6,8 +6,8 @@ import {useAlertMessages} from "../../../pages/Home"; let timer: NodeJS.Timeout; -function QrScanner({setActiveStep, setQrData, deviceId}: { - setQrData: (data: string) => void, setActiveStep: (activeStep: number) => void, deviceId?: string +function QrScanner({setActiveStep, setQrData}: { + setQrData: (data: string) => void, setActiveStep: (activeStep: number) => void }) { const [isCameraBlocked, setIsCameraBlocked] = useState(false); @@ -65,8 +65,7 @@ function QrScanner({setActiveStep, setQrData, deviceId}: { "max": 1080 } }, - delayBetweenScanSuccess: 100000, // Scan once - deviceId + delayBetweenScanSuccess: 100000 // Scan once }} styles={{ container: { diff --git a/inji-verify/src/components/Home/VerificationSection/Verification.tsx b/inji-verify/src/components/Home/VerificationSection/Verification.tsx index 0edf7be0..97fac79a 100644 --- a/inji-verify/src/components/Home/VerificationSection/Verification.tsx +++ b/inji-verify/src/components/Home/VerificationSection/Verification.tsx @@ -1,21 +1,16 @@ -import React, {useEffect, useState} from 'react'; -import {Autocomplete, Box, Grid, TextField, Typography, useMediaQuery} from "@mui/material"; +import React from 'react'; +import {Box, Grid, Typography} from "@mui/material"; import scanQr from "../../../assets/scanner-ouline.svg"; import Loader from "../../commons/Loader"; import QrScanner from "./QrScanner"; import {SetQrDataFunction} from "../../../types/function-types"; import {useActiveStepContext} from "../../../pages/Home"; import StyledButton from "./commons/StyledButton"; -import {useCameraSelectionHook} from "../../../hooks/useCameraSelectionHook"; const Verification = ({setQrData}: { setQrData: SetQrDataFunction }) => { const {getActiveStep, setActiveStep} = useActiveStepContext(); - const isTabletOrMobile = useMediaQuery("@media(max-width: 720px)"); - - const {videoInputOptions} = useCameraSelectionHook(); - const [selectedDeviceId, setSelectedDeviceId] = useState(); return ( @@ -46,7 +41,6 @@ const Verification = ({setQrData}: { : () } @@ -58,26 +52,6 @@ const Verification = ({setQrData}: { Back - - {isTabletOrMobile && ( ({ - label: option.label, - deviceId: option.deviceId - }))} - getOptionLabel={(option) => option.label} - onChange={(event, value) => { - setSelectedDeviceId(value?.deviceId); - }} - sx={{width: 350, margin: "18px auto"}} - renderInput={(params) => - - } - />)} - ); } diff --git a/inji-verify/src/hooks/useCameraSelectionHook.ts b/inji-verify/src/hooks/useCameraSelectionHook.ts deleted file mode 100644 index 39b9fb47..00000000 --- a/inji-verify/src/hooks/useCameraSelectionHook.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {useEffect, useState} from "react"; - -export const useCameraSelectionHook = () => { - const [videoInputOptions, setVideoInputOptions] = useState(undefined); - useEffect(() => { - navigator.mediaDevices.getUserMedia({video: true}).then(stream => { - navigator.mediaDevices - .enumerateDevices() - .then((devices) => { - console.log("Devices: ", devices); - setVideoInputOptions(devices.filter(device => device.kind === "videoinput")); - }) - .catch((err) => { - console.error(`${err.name}: ${err.message}`); - }); - }).catch(error => { - console.log("Error occurred while getting the media devices") - }) - }, []); - return {videoInputOptions: videoInputOptions ?? []}; -} \ No newline at end of file