Skip to content

Commit

Permalink
chore(wallet-mobile): sharing yoroi link and no longer cardano link
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed Oct 4, 2024
1 parent 5c1d9d1 commit 9680f81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const ShareQRCodeCard = ({

if (isSharing)
return (
<ViewShot ref={ref}>
<ViewShot style={styles.shot} ref={ref}>
<CaptureShareQRCodeCard content={qrContent} />
</ViewShot>
)
Expand Down Expand Up @@ -128,6 +128,9 @@ const useStyles = () => {
addressContainer: {
alignItems: 'center',
},
shot: {
height: 308,
},
card: {
...atoms.gap_lg,
minHeight: 432,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {useFocusEffect} from '@react-navigation/native'
import {configCardanoLegacyTransfer, linksCardanoModuleMaker} from '@yoroi/links'
import {configCardanoLegacyTransfer, linksCardanoModuleMaker, linksYoroiModuleMaker} from '@yoroi/links'
import {useTheme} from '@yoroi/theme'
import * as React from 'react'
import {ScrollView as RNScrollView, StyleSheet, Text, useWindowDimensions, View} from 'react-native'
Expand Down Expand Up @@ -99,20 +99,24 @@ const Modal = ({amount, address}: {amount: string; address: string}) => {
const {track} = useMetrics()

const cardanoLinks = linksCardanoModuleMaker()
const requestData = cardanoLinks.create({
const cardanoRequestLink = cardanoLinks.create({
config: configCardanoLegacyTransfer,
params: {
address: address,
amount: Number(amount),
},
})
const yoroiLinks = linksYoroiModuleMaker('yoroi')
const yoroiPaymentRequestLink = yoroiLinks.transfer.request.adaWithLink({
link: cardanoRequestLink.link,
})

const {
wallet: {portfolioPrimaryTokenInfo},
} = useSelectedWallet()
const hasAmount = !isEmptyString(amount)
const hasAddress = !isEmptyString(address)
const content = hasAmount ? requestData.link : address
const content = hasAmount ? yoroiPaymentRequestLink : address
const title = hasAmount ? `${amount} ${portfolioPrimaryTokenInfo.ticker.toLocaleUpperCase()}` : ''

const [isCopying, copy] = useCopy()
Expand All @@ -124,7 +128,7 @@ const Modal = ({amount, address}: {amount: string; address: string}) => {
{hasAddress ? (
<ShareQRCodeCard
title={title}
shareContent={`${strings.address} ${content}`}
shareContent={content}
qrContent={content}
onLongPress={handOnCopy}
testId="receive:specific-amount"
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-mobile/src/kernel/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
"components.receive.receivescreen.usedAddresses": "Used",
"components.receive.receivescreen.verifyAddress": "Verify address",
"components.receive.addresscard.title": "Wallet address",
"components.receive.addresscard.shareLabel": "Share address",
"components.receive.addresscard.shareLabel": "Share",
"components.receive.addresscard.walletAddress": "Wallet address details",
"components.receive.addresscard.spendingKeyHash": "Spending key hash",
"components.receive.addresscard.stakingKeyHash": "Staking key hash",
Expand Down

0 comments on commit 9680f81

Please sign in to comment.