From 46cecf251e4021c7adcc14a0d00868448900b733 Mon Sep 17 00:00:00 2001 From: Tom Lanser Date: Wed, 21 Jun 2023 11:22:42 +0200 Subject: [PATCH] fix: Removed the redirect from index Signed-off-by: Tom Lanser --- apps/expo/app/(home)/wallet.tsx | 22 ------------------- apps/expo/app/index.tsx | 21 ++++++++++++++++-- apps/expo/utils/DeeplinkHandler.tsx | 6 +++++ .../CredentialNotificationScreen.tsx | 2 +- .../PresentationNotificationScreen.tsx | 2 +- 5 files changed, 27 insertions(+), 26 deletions(-) delete mode 100644 apps/expo/app/(home)/wallet.tsx diff --git a/apps/expo/app/(home)/wallet.tsx b/apps/expo/app/(home)/wallet.tsx deleted file mode 100644 index dbcb79b0..00000000 --- a/apps/expo/app/(home)/wallet.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { XStack } from '@internal/ui' -import { WalletScreen } from 'app/features/wallet/WalletScreen' -import { Stack } from 'expo-router' -import { useSafeAreaInsets } from 'react-native-safe-area-context' - -export default function Screen() { - const { top } = useSafeAreaInsets() - - return ( - <> - { - return - }, - }} - /> - - - ) -} diff --git a/apps/expo/app/index.tsx b/apps/expo/app/index.tsx index c4dc7b73..dbcb79b0 100644 --- a/apps/expo/app/index.tsx +++ b/apps/expo/app/index.tsx @@ -1,5 +1,22 @@ -import { Redirect } from 'expo-router' +import { XStack } from '@internal/ui' +import { WalletScreen } from 'app/features/wallet/WalletScreen' +import { Stack } from 'expo-router' +import { useSafeAreaInsets } from 'react-native-safe-area-context' export default function Screen() { - return + const { top } = useSafeAreaInsets() + + return ( + <> + { + return + }, + }} + /> + + + ) } diff --git a/apps/expo/utils/DeeplinkHandler.tsx b/apps/expo/utils/DeeplinkHandler.tsx index affc2ff9..0fde0e51 100644 --- a/apps/expo/utils/DeeplinkHandler.tsx +++ b/apps/expo/utils/DeeplinkHandler.tsx @@ -1,5 +1,6 @@ import type { ReactNode } from 'react' +import { QrTypes } from '@internal/agent' import { useCredentialDataHandler } from 'app/hooks/useCredentialDataHandler' import * as Linking from 'expo-linking' import { useEffect, useState } from 'react' @@ -8,6 +9,8 @@ interface DeeplinkHandlerProps { children: ReactNode } +const deeplinkSchemes = Object.values(QrTypes) + export const DeeplinkHandler = ({ children }: DeeplinkHandlerProps) => { const url = Linking.useURL() const [lastDeeplink, setLastDeeplink] = useState(null) @@ -16,6 +19,9 @@ export const DeeplinkHandler = ({ children }: DeeplinkHandlerProps) => { useEffect(() => { if (!url || url === lastDeeplink) return + // Ignore deeplinks that don't start with the schemes for credentials + if (!deeplinkSchemes.some((scheme) => url.startsWith(scheme))) return + setLastDeeplink(url) void handleCredentialData(url) }, [url]) diff --git a/packages/app/features/notifications/CredentialNotificationScreen.tsx b/packages/app/features/notifications/CredentialNotificationScreen.tsx index fb641786..3ad8ad8c 100644 --- a/packages/app/features/notifications/CredentialNotificationScreen.tsx +++ b/packages/app/features/notifications/CredentialNotificationScreen.tsx @@ -39,7 +39,7 @@ export function CredentialNotificationScreen() { const pushToWallet = () => { router.back() - router.push('/wallet') + router.push('/') } useEffect(() => { diff --git a/packages/app/features/notifications/PresentationNotificationScreen.tsx b/packages/app/features/notifications/PresentationNotificationScreen.tsx index 19bb664d..0d13aee4 100644 --- a/packages/app/features/notifications/PresentationNotificationScreen.tsx +++ b/packages/app/features/notifications/PresentationNotificationScreen.tsx @@ -40,7 +40,7 @@ export function PresentationNotificationScreen() { const pushToWallet = () => { router.back() - router.push('/wallet') + router.push('/') } useEffect(() => {