Skip to content

Commit

Permalink
Payment: note fetch fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Jul 19, 2024
1 parent e7cb5e6 commit 3e6cf77
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions views/Payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,25 @@ export default class PaymentView extends React.Component<PaymentProps> {
if (lnurlpaytx) {
this.setState({ lnurlpaytx });
}
this.getNote();
navigation.addListener('focus', () => {
const noteKey = payment.noteKey;

EncryptedStorage.getItem('note-' + noteKey)
.then((storedNotes) => {
this.setState({ storedNotes });
})
.catch((error) => {
console.error('Error retrieving notes:', error);
});
this.getNote();
});
}

getNote = () => {
const { route } = this.props;
const payment = route.params?.payment;
const noteKey = payment.noteKey;
EncryptedStorage.getItem('note-' + noteKey)
.then((storedNotes) => {
this.setState({ storedNotes });
})
.catch((error) => {
console.error('Error retrieving notes:', error);
});
};

render() {
const { navigation, SettingsStore, NodeInfoStore, route } = this.props;
const { storedNotes, lnurlpaytx } = this.state;
Expand Down

0 comments on commit 3e6cf77

Please sign in to comment.