Commit fdb9d8a8 authored by Nate Wienert's avatar Nate Wienert Committed by GitHub

feat: redirect /address links to the wallet download landing page or app store (#7210)

parent 16cefb9c
...@@ -6,7 +6,7 @@ import TopLevelModals from 'components/TopLevelModals' ...@@ -6,7 +6,7 @@ import TopLevelModals from 'components/TopLevelModals'
import { useFeatureFlagsIsLoaded } from 'featureFlags' import { useFeatureFlagsIsLoaded } from 'featureFlags'
import { useAtom } from 'jotai' import { useAtom } from 'jotai'
import { useBag } from 'nft/hooks/useBag' import { useBag } from 'nft/hooks/useBag'
import { lazy, Suspense, useEffect, useMemo, useState } from 'react' import { lazy, Suspense, useEffect, useLayoutEffect, useMemo, useState } from 'react'
import { Navigate, Route, Routes, useLocation, useSearchParams } from 'react-router-dom' import { Navigate, Route, Routes, useLocation, useSearchParams } from 'react-router-dom'
import { shouldDisableNFTRoutesAtom } from 'state/application/atoms' import { shouldDisableNFTRoutesAtom } from 'state/application/atoms'
import { useRouterPreference } from 'state/user/hooks' import { useRouterPreference } from 'state/user/hooks'
...@@ -23,11 +23,11 @@ import { getCLS, getFCP, getFID, getLCP, Metric } from 'web-vitals' ...@@ -23,11 +23,11 @@ import { getCLS, getFCP, getFID, getLCP, Metric } from 'web-vitals'
import { useAnalyticsReporter } from '../components/analytics' import { useAnalyticsReporter } from '../components/analytics'
import ErrorBoundary from '../components/ErrorBoundary' import ErrorBoundary from '../components/ErrorBoundary'
import { PageTabs } from '../components/NavBar' import NavBar, { PageTabs } from '../components/NavBar'
import NavBar from '../components/NavBar'
import Polling from '../components/Polling' import Polling from '../components/Polling'
import Popups from '../components/Popups' import Popups from '../components/Popups'
import DarkModeQueryParamReader from '../theme/components/DarkModeQueryParamReader' import DarkModeQueryParamReader from '../theme/components/DarkModeQueryParamReader'
import { getDownloadAppLink } from '../utils/openDownloadApp'
import AddLiquidity from './AddLiquidity' import AddLiquidity from './AddLiquidity'
import { RedirectDuplicateTokenIds } from './AddLiquidity/redirects' import { RedirectDuplicateTokenIds } from './AddLiquidity/redirects'
import { RedirectDuplicateTokenIdsV2 } from './AddLiquidityV2/redirects' import { RedirectDuplicateTokenIdsV2 } from './AddLiquidityV2/redirects'
...@@ -188,6 +188,18 @@ export default function App() { ...@@ -188,6 +188,18 @@ export default function App() {
[account] [account]
) )
// redirect address to landing pages until implemented
const shouldRedirectToAppInstall = pathname?.startsWith('/address/')
useLayoutEffect(() => {
if (shouldRedirectToAppInstall) {
window.location.href = getDownloadAppLink()
}
}, [shouldRedirectToAppInstall])
if (shouldRedirectToAppInstall) {
return null
}
return ( return (
<ErrorBoundary> <ErrorBoundary>
<DarkModeQueryParamReader /> <DarkModeQueryParamReader />
......
...@@ -36,7 +36,7 @@ export function openDownloadApp(options: OpenDownloadAppOptions = defaultDownloa ...@@ -36,7 +36,7 @@ export function openDownloadApp(options: OpenDownloadAppOptions = defaultDownloa
} }
// if you need this by itself can add export, not used externally for now // if you need this by itself can add export, not used externally for now
const getDownloadAppLink = (options: OpenDownloadAppOptions = defaultDownloadAppOptions) => export const getDownloadAppLink = (options: OpenDownloadAppOptions = defaultDownloadAppOptions) =>
isIOS isIOS
? linkWithParams(APP_STORE_LINK, options?.appStoreParams) ? linkWithParams(APP_STORE_LINK, options?.appStoreParams)
: linkWithParams(MICROSITE_LINK, options?.microSiteParams) : linkWithParams(MICROSITE_LINK, options?.microSiteParams)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment