Merge pull request #3931 from BlueWallet/isitmy-qr

ADD: View QRCode button on is it my address
This commit is contained in:
GLaDOS 2021-09-28 16:39:47 +01:00 committed by GitHub
commit 18c2d14b72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -607,7 +607,8 @@
"owns": "{label} owns {address}",
"enter_address": "Enter address",
"check_address": "Check address",
"no_wallet_owns_address": "None of the available wallets own the provided address."
"no_wallet_owns_address": "None of the available wallets own the provided address.",
"view_qrcode": "View QRCode"
},
"cc": {
"change": "Change",

View File

@ -19,6 +19,7 @@ const IsItMyAddress = () => {
const [address, setAddress] = useState('');
const [result, setResult] = useState('');
const [resultCleanAddress, setResultCleanAddress] = useState();
const stylesHooks = StyleSheet.create({
text: {
@ -39,12 +40,14 @@ const IsItMyAddress = () => {
const _result = [];
for (const w of wallets) {
if (w.weOwnAddress(cleanAddress)) {
setResultCleanAddress(cleanAddress);
_result.push(loc.formatString(loc.is_it_my_address.owns, { label: w.getLabel(), address: cleanAddress }));
}
}
if (_result.length === 0) {
setResult(_result.push(loc.is_it_my_address.no_wallet_owns_address));
setResultCleanAddress();
}
setResult(_result.join('\n\n'));
@ -52,6 +55,7 @@ const IsItMyAddress = () => {
const onBarScanned = value => {
setAddress(value);
setResultCleanAddress(value);
};
const importScan = () => {
@ -72,6 +76,16 @@ const IsItMyAddress = () => {
const clearAddressInput = () => {
setAddress('');
setResult();
setResultCleanAddress();
};
const viewQRCode = () => {
navigate('ReceiveDetailsRoot', {
screen: 'ReceiveDetails',
params: {
address: resultCleanAddress,
},
});
};
return (
@ -105,6 +119,12 @@ const IsItMyAddress = () => {
<BlueSpacing10 />
<BlueButton title={loc.send.input_clear} onPress={clearAddressInput} />
<BlueSpacing20 />
{resultCleanAddress && (
<>
<BlueButton title={loc.is_it_my_address.view_qrcode} onPress={viewQRCode} />
<BlueSpacing20 />
</>
)}
<BlueButton
disabled={address.trim().length === 0}
title={loc.is_it_my_address.check_address}