This commit is contained in:
Marcos Rodriguez Velez 2024-10-22 18:26:36 -04:00
parent 4cf82c6a7e
commit 53532260ef
4 changed files with 15 additions and 24 deletions

View File

@ -70,23 +70,14 @@ const AddressInput = ({
}); });
const onBlurEditing = () => { const onBlurEditing = () => {
const validateAddressWithFeedback = (address: string) => { const validateAddressWithFeedback = (value: string) => {
const isValid = DeeplinkSchemaMatch.isBitcoinAddress(address) || const isValid = DeeplinkSchemaMatch.isBitcoinAddress(value) || DeeplinkSchemaMatch.isLightningInvoice(value);
DeeplinkSchemaMatch.isLightningInvoice(address);
triggerHapticFeedback( triggerHapticFeedback(isValid ? HapticFeedbackTypes.NotificationSuccess : HapticFeedbackTypes.NotificationError);
isValid
? HapticFeedbackTypes.NotificationSuccess
: HapticFeedbackTypes.NotificationError
);
return isValid; return isValid;
}; };
if (DeeplinkSchemaMatch.isBitcoinAddress(address) || DeeplinkSchemaMatch.isLightningInvoice(address)) { validateAddressWithFeedback(address);
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
} else {
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
}
onBlur(); onBlur();
Keyboard.dismiss(); Keyboard.dismiss();
}; };

View File

@ -61,7 +61,7 @@ const TotalWalletsBalance: React.FC = () => {
}, [preferredFiatCurrency.endPointKey, totalBalancePreferredUnit]); }, [preferredFiatCurrency.endPointKey, totalBalancePreferredUnit]);
const onPressMenuItem = useMemo( const onPressMenuItem = useMemo(
() => async (id: string) => { () => async (id: string | number) => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
switch (id) { switch (id) {
case CommonToolTipActions.ViewInFiat.id: case CommonToolTipActions.ViewInFiat.id:
@ -99,7 +99,7 @@ const TotalWalletsBalance: React.FC = () => {
<ToolTipMenu actions={toolTipActions} onPressMenuItem={onPressMenuItem}> <ToolTipMenu actions={toolTipActions} onPressMenuItem={onPressMenuItem}>
<View style={styles.container}> <View style={styles.container}>
<Text style={styles.label}>{loc.wallets.total_balance}</Text> <Text style={styles.label}>{loc.wallets.total_balance}</Text>
<TouchableOpacity onPress={() => onPressMenuItem(CommonToolTipActions.ViewInBitcoin.id.toString())}> <TouchableOpacity onPress={() => onPressMenuItem(CommonToolTipActions.ViewInBitcoin.id)}>
<Text style={[styles.balance, styleHooks.balance]}> <Text style={[styles.balance, styleHooks.balance]}>
{formattedBalance}{' '} {formattedBalance}{' '}
{totalBalancePreferredUnit !== BitcoinUnit.LOCAL_CURRENCY && ( {totalBalancePreferredUnit !== BitcoinUnit.LOCAL_CURRENCY && (

View File

@ -994,19 +994,19 @@ const SendDetails = () => {
const importActions = [ const importActions = [
{ {
...CommonToolTipActions.ImportTransaction, ...CommonToolTipActions.ImportTransaction,
hidden: !(wallet?.type === WatchOnlyWallet.type && wallet.isHd()), hidden: !(wallet?.type === WatchOnlyWallet.type && wallet?.isHd()),
}, },
{ {
...CommonToolTipActions.ImportTransactionQR, ...CommonToolTipActions.ImportTransactionQR,
hidden: !(wallet?.type === WatchOnlyWallet.type && wallet.isHd()), hidden: !(wallet?.type === WatchOnlyWallet.type && wallet?.isHd()),
}, },
{ {
...CommonToolTipActions.ImportTransactionMultsig, ...CommonToolTipActions.ImportTransactionMultsig,
hidden: !(wallet?.type === MultisigHDWallet.type && wallet.howManySignaturesCanWeMake() > 0), hidden: !(wallet?.type === MultisigHDWallet.type && wallet?.howManySignaturesCanWeMake() > 0),
}, },
{ {
...CommonToolTipActions.CoSignTransaction, ...CommonToolTipActions.CoSignTransaction,
hidden: !(wallet?.type === MultisigHDWallet.type && wallet.howManySignaturesCanWeMake() > 0), hidden: !(wallet?.type === MultisigHDWallet.type && wallet?.howManySignaturesCanWeMake() > 0),
}, },
]; ];

View File

@ -20,7 +20,7 @@ const keys = {
Passphrase: 'passphrase', Passphrase: 'passphrase',
MoreInfo: 'moreInfo', MoreInfo: 'moreInfo',
SaveChanges: 'saveChanges', SaveChanges: 'saveChanges',
PaymentsCode: 'paymentsCode', PaymentCode: 'paymentCode',
RemoveAllRecipients: 'RemoveAllRecipients', RemoveAllRecipients: 'RemoveAllRecipients',
AddRecipient: 'AddRecipient', AddRecipient: 'AddRecipient',
RemoveRecipient: 'RemoveRecipient', RemoveRecipient: 'RemoveRecipient',
@ -62,7 +62,7 @@ const icons: { [key: string]: { iconValue: string } } = {
ImportTransactionQR: { iconValue: 'qrcode.viewfinder' }, ImportTransactionQR: { iconValue: 'qrcode.viewfinder' },
CoinControl: { iconValue: 'switch.2' }, CoinControl: { iconValue: 'switch.2' },
CoSignTransaction: { iconValue: 'signature' }, CoSignTransaction: { iconValue: 'signature' },
PaymentsCode: { iconValue: 'qrcode' }, PaymentCode: { iconValue: 'qrcode' },
RemoveAllRecipients: { iconValue: 'person.2.slash' }, RemoveAllRecipients: { iconValue: 'person.2.slash' },
AddRecipient: { iconValue: 'person.badge.plus' }, AddRecipient: { iconValue: 'person.badge.plus' },
RemoveRecipient: { iconValue: 'person.badge.minus' }, RemoveRecipient: { iconValue: 'person.badge.minus' },
@ -177,9 +177,9 @@ export const CommonToolTipActions: { [key: string]: Action } = {
icon: icons.SaveChanges, icon: icons.SaveChanges,
}, },
PaymentCode: { PaymentCode: {
id: keys.PaymentsCode, id: keys.PaymentCode,
text: loc.bip47.purpose, text: loc.bip47.purpose,
icon: icons.PaymentsCode, icon: icons.PaymentCode,
menuState: false, menuState: false,
}, },
ScanQR: { ScanQR: {