Skip to content
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

improved UX and error handling for wallet configuration #2594

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

Conversation

myxmaster
Copy link
Contributor

Description

This fixes #2172 (all of it, so issue=PR description).

Additionally fixed onFocus and added onBlur for TextInput component.

This pull request is categorized as a:

  • New feature
  • Bug fix
  • Code refactor
  • Configuration change
  • Locales update
  • Quality assurance
  • Other

Checklist

  • I’ve run yarn run tsc and made sure my code compiles correctly
  • I’ve run yarn run lint and made sure my code didn’t contain any problematic patterns
  • I’ve run yarn run prettier and made sure my code is formatted correctly
  • I’ve run yarn run test and made sure all of the tests pass

Testing

If you modified or added a utility file, did you add new unit tests?

  • No, I’m a fool
  • Yes
  • N/A

I have tested this PR on the following platforms (please specify OS version and phone model/VM):

  • Android
  • iOS

I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):

  • Embedded LND
  • LND (REST)
  • LND (Lightning Node Connect)
  • Core Lightning (CLNRest)
  • LndHub
  • [DEPRECATED] Core Lightning (c-lightning-REST)
  • [DEPRECATED] Core Lightning (Spark)
  • [DEPRECATED] Eclair

Locales

  • I’ve added new locale text that requires translations
  • I’m aware that new translations should be made on the ZEUS Transfix page and not directly to this repo

Third Party Dependencies and Packages

  • Contributors will need to run yarn after this PR is merged in
  • 3rd party dependencies have been modified:
    • verify that package.json and yarn.lock have been properly updated
    • verify that dependencies are installed for both iOS and Android platforms

Other:

  • Changes were made that require an update to the README
  • Changes were made that require an update to onboarding

@kaloudis kaloudis added this to the v0.9.4 milestone Dec 3, 2024
@myxmaster myxmaster force-pushed the improved_error_handling_in_wallet_config branch from 597f80e to e0bf598 Compare December 19, 2024 14:41
views/Settings/WalletConfiguration.tsx Outdated Show resolved Hide resolved
@kaloudis kaloudis removed this from the v0.9.4 milestone Dec 19, 2024
@myxmaster myxmaster marked this pull request as draft December 19, 2024 20:38
@ZeusLN ZeusLN deleted a comment from vpati85 Jan 3, 2025
@ZeusLN ZeusLN deleted a comment from vpati85 Jan 3, 2025
@ZeusLN ZeusLN deleted a comment from vpati85 Jan 3, 2025
@myxmaster myxmaster force-pushed the improved_error_handling_in_wallet_config branch from e0bf598 to ca9fcc2 Compare January 22, 2025 13:27
@myxmaster myxmaster marked this pull request as ready for review January 22, 2025 13:27
@myxmaster
Copy link
Contributor Author

Now "/" is allowed for host inputs, we use textColor instead of infoModal for invalid input handling (way better UX), outsourced/improved validation logic and added tests.

@myxmaster myxmaster force-pushed the improved_error_handling_in_wallet_config branch 2 times, most recently from 4bde5f7 to 6612282 Compare January 22, 2025 13:37
@myxmaster myxmaster requested a review from kaloudis January 22, 2025 13:59
@myxmaster
Copy link
Contributor Author

Latest commit fixes this edge case issue:
LND case as example:

  • enter valid macaroon
  • paste invalid host "host not ok", then start editing it to "host not o" -> button was enabled

@kaloudis kaloudis requested a review from shubhamkmr04 January 22, 2025 15:13
@myxmaster myxmaster force-pushed the improved_error_handling_in_wallet_config branch from 35d6a5c to cf02081 Compare January 26, 2025 12:20
@myxmaster
Copy link
Contributor Author

(rebased)

Copy link
Contributor

@shubhamkmr04 shubhamkmr04 left a comment

Choose a reason for hiding this comment

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

LNDHub

  1. Something weird I noticed, It gives us the error when we type in the host name correctly, and not in case of a random string
    lndhub sc1
    lnhub sc2

  2. We can add some margin here between the ErrorMessage and other content
    Simulator Screenshot - iPhone 16 Pro Max - 2025-01-28 at 16 01 34

CLNRest / LND Rest
Here as well, Not able to paste correct hostname, I can save wallet config after writing anything in host input
lndrest1
lndrest2

Also, do we get any error message somewhere on typing in incorrect values in macroon/host/rune as mentioned in the issue at some places #2172 , or it will just trigger the red text to show the error?

@myxmaster
Copy link
Contributor Author

Uhm yeah, when URLs end with "/" we should probably allow it. I'll look into it.

Random strings are allowed because I wanted to allow stuff like "localhost".

Also, do we get any error message somewhere on typing in incorrect values in macroon/host/rune as mentioned in the issue at some places #2172 , or it will just trigger the red text to show the error?

I dropped the error message idea, because I think it is better UX without modals (it is annoying to click those away). I think 99.9% of the time user just copied wrong stuff (or pasted in wrong input), so it is obvious right away what is wrong.

We can add some margin here between the ErrorMessage and other content

I agree, although not really part of this PR.

@kaloudis kaloudis added this to the v0.10.0 milestone Jan 28, 2025
@myxmaster
Copy link
Contributor Author

Actually, I think we should change the GUI label from Host into Server address.
-> Technically, what we allow users to enter here, is not always a valid host, domain or URL.

  • A hostname never contains protocol (http/https) or path (exampe.com/any/path/).
  • A domain never contains subdomains (subdomain.domain.com) and an IP address is not a domain either.
  • A Web-URL always contains protocol, but we allow your-server.com as well

@kaloudis If you agree, I will change all labels and rename the ValidationUtils methods accordingly (e.g. isValidHostname -> isValidServerAddress).

@myxmaster
Copy link
Contributor Author

Uhm yeah, when URLs end with "/" we should probably allow it. I'll look into it.

So, after some thoughts and reading, it makes sense to allow paths in the server address input (to allow stuff like anysubdomain.btcpayserver.org/some/path/).

For paths there are more chars allowed (compared to [sub]domains). So we need to allow these chars for the path segment:
of course: a-zA-Z0-9
also: -._~
and even: !$&'()*+,;=

Since we do not need query and fragment, we should not allow ?and #.

Source: https://datatracker.ietf.org/doc/html/rfc3986

@kaloudis
Copy link
Contributor

Actually, I think we should change the GUI label from Host into Server address. -> Technically, what we allow users to enter here, is not always a valid host, domain or URL.

* A hostname never contains protocol (http/https) or path (exampe.com/any/path/).

* A domain never contains subdomains (subdomain.domain.com) and an IP address is not a domain either.

* A Web-URL always contains protocol, but we allow `your-server.com` as well

@kaloudis If you agree, I will change all labels and rename the ValidationUtils methods accordingly (e.g. isValidHostname -> isValidServerAddress).

I can get behind this.

I also want to potentially but the Port line right below it, instead of the macaroon. We ended up swapping them because of an issue where the keyboard would be covering it. Not sure if we've remedied that yet. LMK what you find.

@myxmaster
Copy link
Contributor Author

The issue with the keyboard covering content is long gone as far as i know. (If you see it anywhere on iOS, let me know...)

So yes, good idea to put Port below Server address.

@myxmaster
Copy link
Contributor Author

The HOST_REGEX is kind of crazy, but oh well, tests all pass, so looks good :)

I think all issues we talked about are now fixed. Just that error message layout problem is still there, I'll care about that in another PR.

@shubhamkmr04
Copy link
Contributor

I think all issues we talked about are now fixed. Just that error message layout problem is still there, I'll care about that in another PR.

Sounds good. Looking much better now

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

Successfully merging this pull request may close these issues.

Better error handling and general UX in Node Configuration
3 participants