Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(wallet-mobile): sharing yoroi link and no longer cardano link #3677

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading