Skip to content
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

US-2096 Unable to scan profile QR code #906

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ newArchEnabled=false
# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true

VisionCamera_enableCodeScanner=true
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"react-native-ssl-public-key-pinning": "^1.1.3",
"react-native-svg": "^14.1.0",
"react-native-vector-icons": "^10.0.3",
"react-native-vision-camera": "^3.9.0",
"react-native-vision-camera": "^3.9.1",
"react-redux": "^8.0.5",
"readable-stream": "1.0.33",
"redux-persist": "^6.0.0",
Expand Down
14 changes: 8 additions & 6 deletions src/components/QRCodeScanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface QRCodeScannerProps {
}

export const QRCodeScanner = ({ onClose, onCodeRead }: QRCodeScannerProps) => {
const [barcode, setBarcode] = useState<Code | null>(null)
const codeScanner = useCodeScanner({
codeTypes: ['qr', 'ean-13'],
onCodeScanned: codes => {
Expand All @@ -34,10 +35,9 @@ export const QRCodeScanner = ({ onClose, onCodeRead }: QRCodeScannerProps) => {
},
})
const { t } = useTranslation()
const device = useCameraDevice('back')
const [barcode, setBarcode] = useState<Code | null>(null)
const dispatch = useAppDispatch()
const isFocused = useIsFocused()
const dispatch = useAppDispatch()
const device = useCameraDevice('back')

useCheckCameraPermissions({ t, isFocused })

Expand All @@ -63,10 +63,12 @@ export const QRCodeScanner = ({ onClose, onCodeRead }: QRCodeScannerProps) => {
</View>
) : (
<Camera
isActive={isFocused}
device={device}
style={StyleSheet.absoluteFill}
torch="off"
device={device}
isActive={true}
photo={false}
video={false}
audio={false}
codeScanner={codeScanner}
/>
)}
Expand Down
93 changes: 0 additions & 93 deletions src/screens/walletConnect/AndroidQRScanner.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions src/screens/walletConnect/ScanQRScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { isBitcoinAddressValid } from '@rsksmart/rif-wallet-bitcoin'
import { decodeString } from '@rsksmart/rif-wallet-eip681'
import { Platform } from 'react-native'
import { useIsFocused } from '@react-navigation/native'

import { QRCodeScanner } from 'components/QRCodeScanner'
import { getWalletSetting } from 'core/config'
Expand All @@ -13,13 +11,11 @@ import {
} from 'navigation/rootNavigator'
import { selectChainId } from 'store/slices/settingsSlice'
import { useAppSelector } from 'store/storeUtils'
import { AndroidQRScanner } from 'screens/walletConnect/AndroidQRScanner'

export const ScanQRScreen = ({
navigation,
}: RootTabsScreenProps<rootTabsRouteNames.ScanQR>) => {
const chainId = useAppSelector(selectChainId)
const isFocused = useIsFocused()
const onCodeRead = (data: string) => {
// Metamask QR
const decodedString = decodeString(data)
Expand Down Expand Up @@ -63,8 +59,5 @@ export const ScanQRScreen = ({
}
}

if (Platform.OS === 'android' && isFocused) {
return <AndroidQRScanner onCodeRead={onCodeRead} onClose={onClose} />
}
return <QRCodeScanner onCodeRead={onCodeRead} onClose={onClose} />
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10269,10 +10269,10 @@ react-native-vector-icons@^10.0.3:
prop-types "^15.7.2"
yargs "^16.1.1"

react-native-vision-camera@^3.9.0:
version "3.9.0"
resolved "https://registry.yarnpkg.com/react-native-vision-camera/-/react-native-vision-camera-3.9.0.tgz#6a96a6cbad53c2db84d671c388b250327681a553"
integrity sha512-q0HejFTS56s5DXWHZhlWLLZMKn/8OXALrqET+FySPIKskwYEdJ5rOV2aDlD6hlo67qCNFGUIMZWGFFc9L2os1g==
react-native-vision-camera@^3.9.1:
version "3.9.1"
resolved "https://registry.yarnpkg.com/react-native-vision-camera/-/react-native-vision-camera-3.9.1.tgz#78eb9da9fcd1cf2ee2562ec18ab8966e0215ab1b"
integrity sha512-Pi9ikguJlN1ydVZOyRaMfUij1raUY93rVuPM92BsGnXEfxSLbvRYXW4ll1DRtVtjS0kZq4IW7Oavg8syRPc/xQ==

[email protected]:
version "0.73.4"
Expand Down
Loading