Skip to content

Commit

Permalink
Merge pull request #2422 from myxmaster/improve_navigation_for_sendin…
Browse files Browse the repository at this point in the history
…g_to_contact

Skip navigating from SendScreen to ContactDetails in case contact has only 1 address
  • Loading branch information
kaloudis authored Oct 13, 2024
2 parents e55e586 + 3f2095d commit 985fce8
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions views/Settings/Contacts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,43 +124,43 @@ export default class Contacts extends React.Component<

renderContactItem = ({ item }: { item: Contact }) => {
const contact = new Contact(item);
const { hasMultiplePayableAddresses } = contact;
return (
<TouchableOpacity
onPress={() => {
(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
});
}
}}
>
<View
Expand Down

0 comments on commit 985fce8

Please sign in to comment.