Skip to content

Commit 6f047be

Browse files
committed
Fix deeplinks
Signed-off-by: Mantas Domaševičius <mantas@mysterium.network>
1 parent 24b7522 commit 6f047be

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

src/Pages/Authenticated/Components/Claim/ClaimButton.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import errors from '../../../../commons/errors'
1111
import { useAppSelector } from '../../../../commons/hooks'
1212
import { selectors } from '../../../../redux/selectors'
1313
import { urls } from '../../../../commons/urls'
14+
import ROUTES from '../../../../constants/routes'
15+
import { ANDROID_DEEPLINK_CLAIM } from '../../../../constants/urls'
1416

1517
const { initClaim } = tequila
1618

@@ -25,7 +27,7 @@ export const ClaimButton = ({ label = 'Claim' }: Props) => {
2527
const handleClaim = async () => {
2628
setLoading(true)
2729
try {
28-
const { link } = await initClaim(urls.featureAwareCurrentOrigin(config))
30+
const { link } = await initClaim(urls.featureAwareCurrentOrigin(config, ROUTES.CLAIM, ANDROID_DEEPLINK_CLAIM))
2931
window.location.href = link
3032
} catch (e) {
3133
errors.parseToastError(e)

src/Pages/Authenticated/Onboarding/PasswordChangePage.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import { media } from '../../../commons/media'
3030
import { useMediaQuery } from 'react-responsive'
3131
import { useAppSelector } from '../../../commons/hooks'
3232
import { selectors } from '../../../redux/selectors'
33+
import routes from '../../../constants/routes'
34+
import { ANDROID_DEEPLINK_CLICKBOARDING } from '../../../constants/urls'
3335

3436
const { isMobileQuery } = media
3537
const { api } = tequila
@@ -245,7 +247,9 @@ export const PasswordChangePage = () => {
245247
const mmnError = state.mmnError.length > 0
246248

247249
const getLinkAndRedirect = async () => {
248-
const { link } = await tequila.initClickBoarding(urls.featureAwareCurrentOrigin(config))
250+
const { link } = await tequila.initClickBoarding(
251+
urls.featureAwareCurrentOrigin(config, routes.CLICKBOARDING, ANDROID_DEEPLINK_CLICKBOARDING),
252+
)
249253
window.location.href = link
250254
}
251255

src/Pages/Login/MystnodesSSO.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { useAppSelector } from '../../commons/hooks'
1515
import { selectors } from '../../redux/selectors'
1616
import { configs } from '../../commons/config'
1717
import FEATURES from '../../commons/features'
18+
import ROUTES from '../../constants/routes'
19+
import { ANDROID_DEEPLINK_SSO } from '../../constants/urls'
1820

1921
const { initSSOAuth } = tequila
2022

@@ -28,7 +30,7 @@ export const MystnodesSSO = () => {
2830
const ssoDisabled = configs.isFeatureEnabled(config, FEATURES.SSO_HIDE.name)
2931
const isDesktop = useMediaQuery(media.isDesktopQuery)
3032
const onClick = async () => {
31-
const { link } = await initSSOAuth(urls.featureAwareCurrentOrigin(config))
33+
const { link } = await initSSOAuth(urls.featureAwareCurrentOrigin(config, ROUTES.AUTH_SSO, ANDROID_DEEPLINK_SSO))
3234
window.location.href = link
3335
}
3436
return (

src/commons/urls.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
import { Config } from 'mysterium-vpn-js'
88
import { configs } from './config'
99
import FEATURES from './features'
10-
import { ANDROID_DEEPLINK } from '../constants/urls'
11-
import routes from '../constants/routes'
1210

1311
const current = (path?: string): string => `${new URL(window.location.href).origin}${path ? `/#${path}` : ''}`
1412

15-
const featureAwareCurrentOrigin = (config: Config): string => {
13+
const featureAwareCurrentOrigin = (config: Config, route: string, deeplink: string): string => {
1614
const deeplinkEnabled = configs.isFeatureEnabled(config, FEATURES.SSO_DEEPLINK.name)
17-
return deeplinkEnabled ? ANDROID_DEEPLINK : current(routes.AUTH_SSO)
15+
return deeplinkEnabled ? deeplink : current(route)
1816
}
1917

2018
export const urls = {

src/constants/urls.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ export const DOCS_FORGOT_PASSWORD = `${DOCS}/en/articles/8005248-forgot-password
1111
export const DOCS_METAMASK = `${DOCS}/en/articles/8004186-adding-myst-token-to-metamask-on-the-polygon-mainnet`
1212
export const PAYOUT_GUIDE = `${DOCS}/en/articles/8004190-where-to-buy-polygon-myst`
1313
export const DOCS_UPDATE_NODE = `${DOCS}/en/articles/8005521-updating-your-node`
14-
export const ANDROID_DEEPLINK = 'mystnodes://sso'
14+
export const NAT_TRAVERSAL = `${DOCS}/en/articles/8005265-nat-traversal-and-types-of-nat`
15+
16+
export const ANDROID_DEEPLINK_SSO = 'mystnodes://sso'
17+
export const ANDROID_DEEPLINK_CLICKBOARDING = 'mystnodes://clickboarding'
18+
export const ANDROID_DEEPLINK_CLAIM = 'mystnodes://claim'

0 commit comments

Comments
 (0)