Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Redirect navigation flow for 0 value invocies. Fixes #991 #1327

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

emiljoha
Copy link

@emiljoha emiljoha commented Jan 12, 2020

  • Functionality in desktop. (Tested on Linux)
  • Functionality in mobile (Tested on android)
  • Fix: Background on new view does not properly match views before and after.
  • Make sure text content and placement is consitent with rest of the app.
  • Fix: Input field on Desktop becomes 0500 when trying to write 500.
  • Error handling. Make sure all error scenarios are considered and handled properly. (Note: My experience in UI coding is limited but I am currently convinced this new feature will handle errors gracefully)

more-or-less-polished

this._nav.goPayLightningConfirm();
if (
this._store.payment.amount === '0' ||
this._store.payment.amount === 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a need for checking for both 0 and '0'? I feel like it should always just be a value of one type. If that's not the case then it should be cast to one type first before checking.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, I should ™️ be '0' its just me being defensive. Will fix.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d1c9dfe

jsconfig.json Outdated
@@ -0,0 +1,10 @@
{
"compilerOptions": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this file really needs to be in this PR. It's useful but has nothing to do with this particular feature. I think this should be added in a follow-up PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is there or what it does... Probably got created when I was trying to set up the project/IDE. Will remove from this PR. Not really sure what it does but I can add it in a follow up PR if It would be useful.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 86f0fa3
Follow up PR: #1331

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emiljoha it's used by VSCode to configure the built-in JS language service. See here for details: https://code.visualstudio.com/docs/languages/jsconfig

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! That makes a lot of sense. Thanks!

* @return {Promise<undefined>}
*/
async reEstimateLightningFee() {
try {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the error from this try/catch block should be propagated further from this method so that the UI can display some useful info to the use and try to recover rather than just having a log message.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, that exception will only be thrown if we do not have a valid lightning invoice in the address field. That is dependent on other functions being called before this one. That kind of subtle and implicit dependencies are dangerous, IMHO. I have tried to make the expectations of the method more clear both in code and documentation.

PS: I am used to writing functional Typescript code in my day job, so all this state and no typing is making me a bit uncomfortable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9322725 and 51413f2

@@ -321,7 +363,8 @@ class PaymentAction {
}

/**
* Send the amount specified in the invoice as a lightning transaction and
* Send the amount specified in the payment.amount. If zero use the amount

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonky description here: If zero use the amount specified in the invoice as a lightning transaction and display the wait screen while the payment confirms. doesn't really make sense.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will try to make it more clear.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 55985e7

@emiljoha
Copy link
Author

emiljoha commented Feb 1, 2020

@bolatovumar Thank you for you comments! Have tried to address the issues.

@emiljoha emiljoha changed the title Redirect navigation flow for 0 value invocies. Issue #991 Redirect navigation flow for 0 value invocies. fixes #991 Feb 8, 2020
@emiljoha emiljoha changed the title Redirect navigation flow for 0 value invocies. fixes #991 Redirect navigation flow for 0 value invocies. Fixes #991 Feb 8, 2020
@emiljoha
Copy link
Author

emiljoha commented Feb 8, 2020

@Roasbeef (Pinging you as you where the originator of the issue and the only one that have merged commits into to this repository for the last couple of months.)

The change is IMHO ready and has been reviewed by @bolatovumar. Please advice if there are any further steps needed to be taken in order to move forward in solving this issue.

@bolatovumar
Copy link

I have reviewed the PR and it looks good to me. I have not tested it, however.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants