From 53532260ef4ddf0c03b72b60d04184ba8f1c0498 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Tue, 22 Oct 2024 18:26:36 -0400 Subject: [PATCH] wip --- components/AddressInput.tsx | 19 +++++-------------- components/TotalWalletsBalance.tsx | 4 ++-- screen/send/SendDetails.tsx | 8 ++++---- typings/CommonToolTipActions.ts | 8 ++++---- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/components/AddressInput.tsx b/components/AddressInput.tsx index 52fe6d673..c6b4d2454 100644 --- a/components/AddressInput.tsx +++ b/components/AddressInput.tsx @@ -70,23 +70,14 @@ const AddressInput = ({ }); const onBlurEditing = () => { - const validateAddressWithFeedback = (address: string) => { - const isValid = DeeplinkSchemaMatch.isBitcoinAddress(address) || - DeeplinkSchemaMatch.isLightningInvoice(address); - - triggerHapticFeedback( - isValid - ? HapticFeedbackTypes.NotificationSuccess - : HapticFeedbackTypes.NotificationError - ); + const validateAddressWithFeedback = (value: string) => { + const isValid = DeeplinkSchemaMatch.isBitcoinAddress(value) || DeeplinkSchemaMatch.isLightningInvoice(value); + + triggerHapticFeedback(isValid ? HapticFeedbackTypes.NotificationSuccess : HapticFeedbackTypes.NotificationError); return isValid; }; - if (DeeplinkSchemaMatch.isBitcoinAddress(address) || DeeplinkSchemaMatch.isLightningInvoice(address)) { - triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess); - } else { - triggerHapticFeedback(HapticFeedbackTypes.NotificationError); - } + validateAddressWithFeedback(address); onBlur(); Keyboard.dismiss(); }; diff --git a/components/TotalWalletsBalance.tsx b/components/TotalWalletsBalance.tsx index 177314ae0..f80d4ed55 100644 --- a/components/TotalWalletsBalance.tsx +++ b/components/TotalWalletsBalance.tsx @@ -61,7 +61,7 @@ const TotalWalletsBalance: React.FC = () => { }, [preferredFiatCurrency.endPointKey, totalBalancePreferredUnit]); const onPressMenuItem = useMemo( - () => async (id: string) => { + () => async (id: string | number) => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); switch (id) { case CommonToolTipActions.ViewInFiat.id: @@ -99,7 +99,7 @@ const TotalWalletsBalance: React.FC = () => { {loc.wallets.total_balance} - onPressMenuItem(CommonToolTipActions.ViewInBitcoin.id.toString())}> + onPressMenuItem(CommonToolTipActions.ViewInBitcoin.id)}> {formattedBalance}{' '} {totalBalancePreferredUnit !== BitcoinUnit.LOCAL_CURRENCY && ( diff --git a/screen/send/SendDetails.tsx b/screen/send/SendDetails.tsx index b2d419420..b079feb52 100644 --- a/screen/send/SendDetails.tsx +++ b/screen/send/SendDetails.tsx @@ -994,19 +994,19 @@ const SendDetails = () => { const importActions = [ { ...CommonToolTipActions.ImportTransaction, - hidden: !(wallet?.type === WatchOnlyWallet.type && wallet.isHd()), + hidden: !(wallet?.type === WatchOnlyWallet.type && wallet?.isHd()), }, { ...CommonToolTipActions.ImportTransactionQR, - hidden: !(wallet?.type === WatchOnlyWallet.type && wallet.isHd()), + hidden: !(wallet?.type === WatchOnlyWallet.type && wallet?.isHd()), }, { ...CommonToolTipActions.ImportTransactionMultsig, - hidden: !(wallet?.type === MultisigHDWallet.type && wallet.howManySignaturesCanWeMake() > 0), + hidden: !(wallet?.type === MultisigHDWallet.type && wallet?.howManySignaturesCanWeMake() > 0), }, { ...CommonToolTipActions.CoSignTransaction, - hidden: !(wallet?.type === MultisigHDWallet.type && wallet.howManySignaturesCanWeMake() > 0), + hidden: !(wallet?.type === MultisigHDWallet.type && wallet?.howManySignaturesCanWeMake() > 0), }, ]; diff --git a/typings/CommonToolTipActions.ts b/typings/CommonToolTipActions.ts index 62e2d3135..2cfcd2517 100644 --- a/typings/CommonToolTipActions.ts +++ b/typings/CommonToolTipActions.ts @@ -20,7 +20,7 @@ const keys = { Passphrase: 'passphrase', MoreInfo: 'moreInfo', SaveChanges: 'saveChanges', - PaymentsCode: 'paymentsCode', + PaymentCode: 'paymentCode', RemoveAllRecipients: 'RemoveAllRecipients', AddRecipient: 'AddRecipient', RemoveRecipient: 'RemoveRecipient', @@ -62,7 +62,7 @@ const icons: { [key: string]: { iconValue: string } } = { ImportTransactionQR: { iconValue: 'qrcode.viewfinder' }, CoinControl: { iconValue: 'switch.2' }, CoSignTransaction: { iconValue: 'signature' }, - PaymentsCode: { iconValue: 'qrcode' }, + PaymentCode: { iconValue: 'qrcode' }, RemoveAllRecipients: { iconValue: 'person.2.slash' }, AddRecipient: { iconValue: 'person.badge.plus' }, RemoveRecipient: { iconValue: 'person.badge.minus' }, @@ -177,9 +177,9 @@ export const CommonToolTipActions: { [key: string]: Action } = { icon: icons.SaveChanges, }, PaymentCode: { - id: keys.PaymentsCode, + id: keys.PaymentCode, text: loc.bip47.purpose, - icon: icons.PaymentsCode, + icon: icons.PaymentCode, menuState: false, }, ScanQR: {