Skip to content

Commit

Permalink
add fix rdu redirect for the case callback url contains hash fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsmith-gooddollar committed Jan 31, 2023
1 parent ab8bbd9 commit 4dcae7c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/lib/utils/linking.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
import { Linking, Platform } from 'react-native'

import { mapValues } from 'lodash'
import { forIn } from 'lodash'
import { DESTINATION_PATH, INVITE_CODE } from '../constants/localStorage'
import { fireEvent, SIGNIN_FAILED } from '../analytics/analytics'

Expand Down Expand Up @@ -86,9 +86,14 @@ export const handleLinks = async (logger = log) => {

export const redirectTo = async (url, type: 'rdu' | 'cbu', params = {}) => {
if (type === 'rdu') {
const urlParams = new URLSearchParams(mapValues(params, encodeBase64Params))
const uri = new URL(url)
const { searchParams } = uri

return openLink(`${url}?${urlParams.toString()}`, '_self')
forIn(params, (value, param) => {
searchParams.append(param, encodeBase64Params(value))
})

return openLink(uri.toString(), '_self')
}

try {
Expand Down

1 comment on commit 4dcae7c

@vercel
Copy link

@vercel vercel bot commented on 4dcae7c Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.