Skip to content

Commit e1c70be

Browse files
authored
Merge pull request #4891 from EdgeApp/jon/share-link-hash
Update unique ID for share referral links
2 parents 4b6c464 + f59a3bd commit e1c70be

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/themed/SideMenu.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { DrawerContentComponentProps, useDrawerStatus } from '@react-navigation/drawer'
33
import { DrawerActions } from '@react-navigation/native'
44
import { EdgeAccount, EdgeUserInfo } from 'edge-core-js'
5+
import hashjs from 'hash.js'
56
import * as React from 'react'
67
import { Image, Platform, Pressable, ScrollView, View } from 'react-native'
78
import LinearGradient from 'react-native-linear-gradient'
@@ -28,7 +29,6 @@ import { config } from '../../theme/appConfig'
2829
import { useDispatch, useSelector } from '../../types/reactRedux'
2930
import { NavigationBase } from '../../types/routerTypes'
3031
import { parseDeepLink } from '../../util/DeepLinkParser'
31-
import { base58ToUuid } from '../../util/utils'
3232
import { IONIA_SUPPORTED_FIATS } from '../cards/VisaCardCard'
3333
import { EdgeTouchableOpacity } from '../common/EdgeTouchableOpacity'
3434
import { ButtonsModal } from '../modals/ButtonsModal'
@@ -144,7 +144,12 @@ export function SideMenuComponent(props: DrawerContentComponentProps) {
144144

145145
const handleShareApp = () => {
146146
const message = `${sprintf(lstrings.share_subject, config.appName)}\n\n${lstrings.share_message}\n\n`
147-
const website = `${config.website}?af=appreferred-${base58ToUuid(context.clientId)}`
147+
148+
// Generate anonymized referral ID
149+
const data = Uint8Array.from(Buffer.from(account.rootLoginId, 'hex'))
150+
const refId = hashjs.sha256().update(data).digest('hex').replace('0x', '').substring(0, 10)
151+
152+
const website = `${config.website}?af=appreferred_${refId}`
148153

149154
const shareOptions = {
150155
message: Platform.OS === 'ios' ? message : message + website,

0 commit comments

Comments
 (0)