Skip to content

Commit

Permalink
feature(ui-ux): updated receive token screen to support evm address (#…
Browse files Browse the repository at this point in the history
…4025)

Co-authored-by: Lyka Labrada <[email protected]>
  • Loading branch information
fullstackninja864 and lykalabrada authored Oct 6, 2023
1 parent d5e2c08 commit 1250ce8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
useLogger,
} from "@shared-contexts/NativeLoggingProvider";
import { debounce } from "lodash";
import { DomainType, useDomainContext } from "@contexts/DomainContext";

export async function onShare(
address: string,
Expand All @@ -33,10 +34,12 @@ export async function onShare(

export function ReceiveScreen(): JSX.Element {
const logger = useLogger();
const { address } = useWalletContext();
const { address, evmAddress } = useWalletContext();
const [showToast, setShowToast] = useState(false);
const toast = useToast();
const { domain } = useDomainContext();
const TOAST_DURATION = 2000;
const receiveAddress = domain === DomainType.EVM ? evmAddress : address;

const copyToClipboard = useCallback(
debounce(() => {
Expand All @@ -59,7 +62,7 @@ export function ReceiveScreen(): JSX.Element {
} else {
toast.hideAll();
}
}, [showToast, address]);
}, [showToast, receiveAddress]);

return (
<ThemedScrollViewV2
Expand All @@ -71,13 +74,13 @@ export function ReceiveScreen(): JSX.Element {
>
{translate(
"screens/ReceiveScreen",
"Use QR or Wallet address to receive any tokens (DST) or DFI"
"Scan QR code to receive any dTokens (eg. DUSD,dBTC..) or DFI"
)}
</ThemedTextV2>

<View style={tailwind("m-2 items-center")} testID="qr_code_container">
<View style={tailwind("bg-white p-4 rounded-md")}>
<QRCode size={196} value={address} />
<QRCode size={196} value={receiveAddress} />
</View>
</View>

Expand All @@ -99,14 +102,14 @@ export function ReceiveScreen(): JSX.Element {
style={tailwind("font-normal-v2 text-sm text-center pb-12 px-5")}
testID="address_text"
>
{address}
{receiveAddress}
</ThemedTextV2>
</View>

<TouchableOpacity
onPress={async () => {
copyToClipboard();
await Clipboard.setStringAsync(address);
await Clipboard.setStringAsync(receiveAddress);
}}
testID="copy_button"
>
Expand Down Expand Up @@ -141,7 +144,7 @@ export function ReceiveScreen(): JSX.Element {
</TouchableOpacity>
<TouchableOpacity
onPress={async () => {
await onShare(address, logger);
await onShare(receiveAddress, logger);
}}
testID="share_button"
>
Expand Down
2 changes: 1 addition & 1 deletion shared/translations/languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"Copy": "Kopieren",
"Share": "Teilen",
"WALLET ADDRESS": "WALLETADRESSE",
"Use QR or Wallet address to receive any tokens (DST) or DFI": "Verwende den QR-Code oder die Wallet-Adresse, um Token (DST) oder DFI zu erhalten",
"Scan QR code to receive any dTokens (eg. DUSD,dBTC..) or DFI": "Scanne den QR-Code, um dToken (z.B. DUSD, dBTC...) oder DFI zu erhalten",
"Get DFI": "DFI erwerben"
},
"components/toaster": {
Expand Down
2 changes: 1 addition & 1 deletion shared/translations/languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"Copy": "Copiar",
"Share": "Compartir",
"WALLET ADDRESS": "DIRECCIÓN DE LA BILLETERA",
"Use QR or Wallet address to receive any tokens (DST) or DFI": "Usar QR or direccion de billetera para recibir cualquier token (DST) o DFI",
"Scan QR code to receive any dTokens (eg. DUSD,dBTC..) or DFI": "Scan QR code to receive any dTokens (eg. DUSD,dBTC..) or DFI",
"Get DFI": "Get DFI"
},
"components/toaster": {
Expand Down
2 changes: 1 addition & 1 deletion shared/translations/languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
"Copy": "Copier",
"Share": "Partager",
"WALLET ADDRESS": "ADRESSE DU PORTEFEUILLE",
"Use QR or Wallet address to receive any tokens (DST) or DFI": "Utiliser l'adresse QR ou Wallet pour recevoir des tokens (DST) ou des DFI",
"Scan QR code to receive any dTokens (eg. DUSD,dBTC..) or DFI": "Scanner le code QR pour recevoir des dTokens (par exemple DUSD, dBTC..) ou des DFI",
"Get DFI": "Obtenir DFI"
},
"components/toaster": {
Expand Down
2 changes: 1 addition & 1 deletion shared/translations/languages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
"Copy": "Copia",
"Share": "Condividi",
"WALLET ADDRESS": "INDIRIZZO WALLET",
"Use QR or Wallet address to receive any tokens (DST) or DFI": "Use QR or Wallet address to receive any tokens (DST) or DFI",
"Scan QR code to receive any dTokens (eg. DUSD,dBTC..) or DFI": "扫描二维码以接收任何 dToken(例如 DUSD、dBTC..)或 DFI",
"Get DFI": "Get DFI"
},
"components/toaster": {
Expand Down
2 changes: 1 addition & 1 deletion shared/translations/languages/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"Copy": "复制地址",
"Share": "转发地址",
"WALLET ADDRESS": "钱包地址",
"Use QR or Wallet address to receive any tokens (DST) or DFI": "Use QR or Wallet address to receive any tokens (DST) or DFI",
"Scan QR code to receive any dTokens (eg. DUSD,dBTC..) or DFI": "扫描二维码以接收任何 dToken(例如 DUSD、dBTC..)或 DFI",
"Get DFI": "获得 DFI"
},
"components/toaster": {
Expand Down
2 changes: 1 addition & 1 deletion shared/translations/languages/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"Copy": "複製地址",
"Share": "轉發地址",
"WALLET ADDRESS": "錢包地址",
"Use QR or Wallet address to receive any tokens (DST) or DFI": "Use QR or Wallet address to receive any tokens (DST) or DFI",
"Scan QR code to receive any dTokens (eg. DUSD,dBTC..) or DFI": "掃描二維碼以接收任何 dToken(例如 DUSD、dBTC..)或 DFI",
"Get DFI": "獲得 DFI"
},
"components/toaster": {
Expand Down

0 comments on commit 1250ce8

Please sign in to comment.