-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddNotes: Add notes after payment #1447
Conversation
b5c31c8
to
3cb9562
Compare
views/AddNotes.tsx
Outdated
<Button | ||
onPress={async () => { | ||
navigation.navigate('Wallet'); | ||
const key: any = payment_hash || txid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make the key prefixed with note-
views/AddNotes.tsx
Outdated
}} | ||
containerStyle={{ position: 'absolute', bottom: 40 }} | ||
buttonStyle={{ padding: 15 }} | ||
title="add note" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a locale for this string too
views/Payment.tsx
Outdated
@@ -35,10 +39,18 @@ export default class PaymentView extends React.Component<PaymentProps> { | |||
if (lnurlpaytx) { | |||
this.setState({ lnurlpaytx }); | |||
} | |||
EncryptedStorage.getItem(payment.payment_hash) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure you update the key format here too
Looking solid overall. Please add some screenshots to the PR. |
Thanks! Did the changes. |
I think we should also add this functionality to Invoices (LN payments you've requested) as well. Yes you have some information from the memo but it would be nice to add notes you didn't expose to the payer. |
Also, please add a screenshot of the Add Note view |
Okay. I'll do it |
locales/en.json
Outdated
@@ -556,6 +559,7 @@ | |||
"views.Transaction.numConf": "Number of Confirmations", | |||
"views.Transaction.status": "Status", | |||
"views.Transaction.timestamp": "Timestamp", | |||
"views.Transaction.notes": "Notes", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wee just just use a singular definition here instead of requiring translators to translate it multiple times.
Also think it might be better as Note
singular
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I thought there are different views
in which we are using them so I did that, like we would have to use {localeString('views.Payment.notes')}
in Transaction
view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its okay, I'll use only one definition
views/AddNotes.tsx
Outdated
}} | ||
multiline | ||
numberOfLines={0} | ||
style={{ fontSize: 20 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should also have color: themeColor('text')
views/AddNotes.tsx
Outdated
<Button | ||
title={localeString('views.AddNotes.AddNote')} | ||
onPress={async () => { | ||
navigation.navigate('Wallet'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of navigating back to the wallet it should navigate back to the previous screen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh I was also thinking to do it, will do it
views/AddNotes.tsx
Outdated
<Header | ||
leftComponent="Back" | ||
centerComponent={{ | ||
text: localeString('views.AddNotes.AddNote'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this says 'Update Note' if the note already exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it
Lastly, I think you should also be able to go to a AddNote view if you click on the note in the Payment/Invoice/TX view |
Like when I tap on the Note itself? |
exactly |
views/AddNotes.tsx
Outdated
const key: any = | ||
'note-' + (payment_hash || txid || RPreimage); | ||
await EncryptedStorage.setItem(key, notes); | ||
if (!noteKeys.includes(key)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be populated when you load the note, or perhaps in a a separate note store.
You also need to add logic to remove it from the index if the user deletes the note
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the logic to remove keys from noteKeys array, in onChangeText
prop
0d57306
to
bfc9f10
Compare
stores/NotesStore.ts
Outdated
@observable public noteKeys: string[] = []; | ||
|
||
@action | ||
public storingNoteKeys = async (key: string, notes: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's call it storeNoteKeys
or saveNoteKeys
views/AddNotes.tsx
Outdated
onChangeText={(text: string) => { | ||
this.setState({ notes: text }); | ||
if (!text) { | ||
const key: any = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type is string
here
bfc9f10
to
9f5c2f5
Compare
views/AddNotes.tsx
Outdated
<Header | ||
leftComponent="Back" | ||
centerComponent={{ | ||
text: notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this text shouldn't be dependent on whether the note in the state is set, rather if a previous note has been saved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with the button at the bottom of this view
043cb80
to
da0b5e3
Compare
Are these notes stored on LND or on the phone? |
This PR adds functionality to add notes with lightning payments, Onchain Transactions and Invoice, and later, users can see the notes inside the Activity view and edit them from there.