diff --git a/native/navigation/navigation-handler.react.js b/native/navigation/navigation-handler.react.js --- a/native/navigation/navigation-handler.react.js +++ b/native/navigation/navigation-handler.react.js @@ -11,7 +11,6 @@ import { useIsAppLoggedIn } from './nav-selectors.js'; import { NavContext, type NavAction } from './navigation-context.js'; import PolicyAcknowledgmentHandler from './policy-acknowledgment-handler.react.js'; -import QRCodeLinkHandler from './qr-code-link-handler.react.js'; import ThreadScreenTracker from './thread-screen-tracker.react.js'; import DevTools from '../redux/dev-tools.react.js'; import { useSelector } from '../redux/redux-utils.js'; @@ -44,7 +43,6 @@ - {devTools} ); diff --git a/native/navigation/qr-code-link-handler.react.js b/native/navigation/qr-code-link-handler.react.js deleted file mode 100644 --- a/native/navigation/qr-code-link-handler.react.js +++ /dev/null @@ -1,51 +0,0 @@ -// @flow - -import { useNavigation } from '@react-navigation/native'; -import * as React from 'react'; -import { Linking } from 'react-native'; - -import { parseKeysFromQRCodeURL } from 'lib/facts/links.js'; -import { isLoggedIn } from 'lib/selectors/user-selectors.js'; - -import { SecondaryDeviceQRCodeScannerRouteName } from './route-names.js'; -import { useSelector } from '../redux/redux-utils.js'; - -function QRCodeLinkHandler(): null { - const [currentLink, setCurrentLink] = React.useState(null); - - React.useEffect(() => { - const subscription = Linking.addEventListener('url', ({ url }) => - setCurrentLink(url), - ); - (async () => { - const initialURL = await Linking.getInitialURL(); - if (initialURL) { - setCurrentLink(initialURL); - } - })(); - - return () => subscription.remove(); - }, []); - - const loggedIn = useSelector(isLoggedIn); - const { navigate } = useNavigation(); - - React.useEffect(() => { - if (!loggedIn || !currentLink) { - return; - } - - setCurrentLink(null); - - const keys = parseKeysFromQRCodeURL(currentLink); - if (!keys) { - return; - } - - navigate(SecondaryDeviceQRCodeScannerRouteName); - }, [currentLink, loggedIn, navigate]); - - return null; -} - -export default QRCodeLinkHandler;