diff --git a/src/features/keystone/ConnectKeystoneStartScreen.tsx b/src/features/keystone/ConnectKeystoneStartScreen.tsx index c1eb8777..a60781fd 100644 --- a/src/features/keystone/ConnectKeystoneStartScreen.tsx +++ b/src/features/keystone/ConnectKeystoneStartScreen.tsx @@ -1,140 +1,18 @@ -/* eslint-disable react/jsx-props-no-spreading */ import Box from '@components/Box' import ButtonPressable from '@components/ButtonPressable' import SafeAreaBox from '@components/SafeAreaBox' import Text from '@components/Text' import { useNavigation } from '@react-navigation/native' -import WarningKeystone from '@assets/images/warningKeystone.svg' -import React, { - forwardRef, - ReactNode, - Ref, - useCallback, - useImperativeHandle, - useMemo, - useRef, -} from 'react' -import useCamera from '@hooks/useCamera' -import { BottomSheetBackdrop, BottomSheetModal } from '@gorhom/bottom-sheet' -import { useOpacity, useSpacing } from '@theme/themeHooks' -import useBackHandler from '@hooks/useBackHandler' -import { useTheme } from '@shopify/restyle' +import React, { useCallback } from 'react' import { t } from 'i18next' -import { Image, Linking, Platform } from 'react-native' +import { Image } from 'react-native' import { AddNewAccountNavigationProp } from '../home/addNewAccount/addNewAccountTypes' -type CameraPermissionBottomSheetAlertRef = { - show: () => void - dismiss: () => void -} - -const CameraPermissionBottomSheetAlert = forwardRef( - ( - { children }: { children: ReactNode }, - ref: Ref, - ) => { - useImperativeHandle(ref, () => ({ - show: () => { - bottomSheetModalRef.current?.present() - }, - dismiss: () => { - bottomSheetModalRef.current?.dismiss() - }, - })) - - const bottomSheetModalRef = useRef(null) - const { backgroundStyle } = useOpacity('surfaceSecondary', 1) - const { m } = useSpacing() - const { colors } = useTheme() - const snapPoints = useMemo(() => ['40%'], []) - const sheetHandleStyle = useMemo(() => ({ padding: m }), [m]) - const { handleDismiss } = useBackHandler(bottomSheetModalRef) - const handleIndicatorStyle = useMemo(() => { - return { - backgroundColor: colors.secondaryText, - } - }, [colors.secondaryText]) - const renderBackdrop = useCallback( - (props) => ( - - ), - [], - ) - - return ( - - {children} - - ) - }, -) - -const WarningContent = () => { - const handleOpenSettings = () => { - if (Platform.OS === 'ios') { - Linking.openURL('app-settings:') - } else { - Linking.openSettings() - } - } - return ( - - - - - - {t('keystone.connectKeystoneStart.warning') as string} - - - - - - ) -} - const ConnectKeystoneStart = () => { - const { hasPermission } = useCamera() - const cameraPermissionBottomSheetAlertRef = - useRef(null) const navigation = useNavigation() const handleStart = useCallback(() => { - if (!hasPermission) { - cameraPermissionBottomSheetAlertRef.current?.show() - } else { - navigation.navigate('KeystoneNavigator') - } - }, [navigation, hasPermission]) + navigation.navigate('KeystoneNavigator') + }, [navigation]) return ( { - - - { - const [hasPermission, setHasPermission] = useState(false) - - useEffect(() => { - ;(async () => { - const { status } = await Camera.requestCameraPermissionsAsync() - setHasPermission(status === 'granted') - })() - }, []) - - return { hasPermission } -} - -export default useCamera