From 3f2095dea19aae36991bf9abd743ead7c77e7268 Mon Sep 17 00:00:00 2001 From: myxmaster Date: Wed, 18 Sep 2024 16:34:24 +0200 Subject: [PATCH] skip navigating from SendScreen to ContactDetails in case contact has only 1 address --- views/Settings/Contacts.tsx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/views/Settings/Contacts.tsx b/views/Settings/Contacts.tsx index 4f0ef3c31..a64e4c95e 100644 --- a/views/Settings/Contacts.tsx +++ b/views/Settings/Contacts.tsx @@ -118,43 +118,43 @@ export default class Contacts extends React.Component< renderContactItem = ({ item }: { item: Contact }) => { const contact = new Contact(item); + const { hasMultiplePayableAddresses } = contact; return ( { - (contact.isSingleLnAddress && - this.state.SendScreen && - this.props.navigation.navigate('Send', { - destination: item.lnAddress[0], - contactName: item.name - })) || - (contact.isSingleBolt12Address && - this.state.SendScreen && + if (this.state.SendScreen && !hasMultiplePayableAddresses) { + if (contact.isSingleLnAddress) { + this.props.navigation.navigate('Send', { + destination: item.lnAddress[0], + contactName: item.name + }); + } else if (contact.isSingleBolt12Address) { this.props.navigation.navigate('Send', { destination: item.bolt12Address[0], contactName: item.name - })) || - (contact.isSingleBolt12Offer && - this.state.SendScreen && + }); + } else if (contact.isSingleBolt12Offer) { this.props.navigation.navigate('Send', { destination: item.bolt12Offer[0], contactName: item.name - })) || - (contact.isSingleOnchainAddress && - this.state.SendScreen && + }); + } else if (contact.isSingleOnchainAddress) { this.props.navigation.navigate('Send', { destination: item.onchainAddress[0], contactName: item.name - })) || - (contact.isSinglePubkey && - this.state.SendScreen && + }); + } else if (contact.isSinglePubkey) { this.props.navigation.navigate('Send', { destination: item.pubkey[0], contactName: item.name - })) || + }); + } + } else { this.props.navigation.navigate('ContactDetails', { contactId: item.contactId || item.id, isNostrContact: false }); + } }} >