-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix playing Shutter Sound in Scan Receipt #39400
Changes from 2 commits
8948d41
9f50769
d7a50d4
d552ea0
9a5814b
8cc9a9c
6c7fadc
e126fbf
042a637
1c8614c
c368e4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||
import {useFocusEffect} from '@react-navigation/core'; | ||||
import lodashGet from 'lodash/get'; | ||||
import React, {useCallback, useRef, useState} from 'react'; | ||||
import React, {useCallback, useEffect, useRef, useState} from 'react'; | ||||
import {ActivityIndicator, Alert, AppState, InteractionManager, View} from 'react-native'; | ||||
import {Gesture, GestureDetector} from 'react-native-gesture-handler'; | ||||
import {RESULTS} from 'react-native-permissions'; | ||||
|
@@ -31,6 +31,8 @@ import reportPropTypes from '@pages/reportPropTypes'; | |||
import * as IOU from '@userActions/IOU'; | ||||
import CONST from '@src/CONST'; | ||||
import ROUTES from '@src/ROUTES'; | ||||
import Onyx, {useOnyx} from 'react-native-onyx'; | ||||
import ONYXKEYS from '@src/ONYXKEYS'; | ||||
import * as CameraPermission from './CameraPermission'; | ||||
import NavigationAwareCamera from './NavigationAwareCamera'; | ||||
|
||||
|
@@ -63,6 +65,7 @@ function IOURequestStepScan({ | |||
const device = useCameraDevice('back', { | ||||
physicalDevices: ['wide-angle-camera'], | ||||
}); | ||||
const [user] = useOnyx(ONYXKEYS.USER) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should I use a selector for only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dont think we can use useOnyx yet, please use selector There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would that look like then? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mountiny what is the reason we shouldn't use `useOnyx yet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
|
||||
const hasFlash = device != null && device.hasFlash; | ||||
const camera = useRef(null); | ||||
|
@@ -239,6 +242,7 @@ function IOURequestStepScan({ | |||
return camera.current | ||||
.takePhoto({ | ||||
flash: flash && hasFlash ? 'on' : 'off', | ||||
enableShutterSound: !user.isMutedAllSounds | ||||
}) | ||||
.then((photo) => { | ||||
// Store the receipt on the transaction object in Onyx | ||||
|
@@ -258,7 +262,7 @@ function IOURequestStepScan({ | |||
showCameraAlert(); | ||||
Log.warn('Error taking photo', error); | ||||
}); | ||||
}, [flash, hasFlash, action, translate, transactionID, updateScanAndNavigate, navigateToConfirmationStep, cameraPermissionStatus]); | ||||
}, [cameraPermissionStatus, flash, hasFlash, user.isMutedAllSounds, translate, transactionID, action, navigateToConfirmationStep, updateScanAndNavigate]); | ||||
|
||||
// Wait for camera permission status to render | ||||
if (cameraPermissionStatus == null) { | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.