feat: redirect /address links to the wallet download landing page or app store (#7210)
This commit is contained in:
parent
16cefb9cdb
commit
fdb9d8a8c9
@ -6,7 +6,7 @@ import TopLevelModals from 'components/TopLevelModals'
|
||||
import { useFeatureFlagsIsLoaded } from 'featureFlags'
|
||||
import { useAtom } from 'jotai'
|
||||
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 { shouldDisableNFTRoutesAtom } from 'state/application/atoms'
|
||||
import { useRouterPreference } from 'state/user/hooks'
|
||||
@ -23,11 +23,11 @@ import { getCLS, getFCP, getFID, getLCP, Metric } from 'web-vitals'
|
||||
|
||||
import { useAnalyticsReporter } from '../components/analytics'
|
||||
import ErrorBoundary from '../components/ErrorBoundary'
|
||||
import { PageTabs } from '../components/NavBar'
|
||||
import NavBar from '../components/NavBar'
|
||||
import NavBar, { PageTabs } from '../components/NavBar'
|
||||
import Polling from '../components/Polling'
|
||||
import Popups from '../components/Popups'
|
||||
import DarkModeQueryParamReader from '../theme/components/DarkModeQueryParamReader'
|
||||
import { getDownloadAppLink } from '../utils/openDownloadApp'
|
||||
import AddLiquidity from './AddLiquidity'
|
||||
import { RedirectDuplicateTokenIds } from './AddLiquidity/redirects'
|
||||
import { RedirectDuplicateTokenIdsV2 } from './AddLiquidityV2/redirects'
|
||||
@ -188,6 +188,18 @@ export default function App() {
|
||||
[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 (
|
||||
<ErrorBoundary>
|
||||
<DarkModeQueryParamReader />
|
||||
|
@ -36,7 +36,7 @@ export function openDownloadApp(options: OpenDownloadAppOptions = defaultDownloa
|
||||
}
|
||||
|
||||
// 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
|
||||
? linkWithParams(APP_STORE_LINK, options?.appStoreParams)
|
||||
: linkWithParams(MICROSITE_LINK, options?.microSiteParams)
|
||||
|
Loading…
Reference in New Issue
Block a user