-
Notifications
You must be signed in to change notification settings - Fork 25
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
enhancement: show an error message if openLink fails #74
Conversation
@KKA11010 where should i put toast? should i put it everywhere openurl is called? |
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.
Hello @tarunsamanta2k20
Thanks for the PR! 💪
Yes the Toaster component should be in each screen where this openUrl is called. But I think it will not work if you write the {prompt} hook in the openUrl function.
I just use the prompt hook in the same component where openUrl is needed.
// component where openUrl is called
Component xyz () {
const {prompt, openPromptAutoClose} ...
testFunction(){
Try {
OpenUrl...
} catch (e) {
OpenPrompt({...})
}
}
Return <>
... component content ...
<Button onPress={testFunction}>
...Btn Text...
</>
<Toaster />
</>
Maybe like this? But you can just play around and see if your way works
👍
@KKA11010 i think it should be like that. export function OpenUrl(url: string) |
Yes, it is already. https://github.com/cashubtc/eNuts/blob/main/src/util/index.ts#L174 Just play around and see if it works the way you are doing it. |
See 'O' is in lower case. That why it was giving error. |
@tarunsamanta2k20 the code example that I provided was just pseudo code. Wrote it on my phone and it got autocorrected 😆 You dont have to change how the function name is written. Just use it in the right place |
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.
Looks great, thank you! Just a few minor changes needed i guess 😍
@tarunsamanta2k20 also please have a look at pnpm if you do not use it yet 👍 Yesterday I merged a PR from @BilligsterUser and now we are using pnpm instead of npm |
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.
LGTM
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #74 +/- ##
==========================================
- Coverage 24.54% 24.52% -0.02%
==========================================
Files 85 85
Lines 3019 3029 +10
Branches 815 822 +7
==========================================
+ Hits 741 743 +2
- Misses 2214 2222 +8
Partials 64 64
☔ View full report in Codecov by Sentry. |
Use catch block to show a message that opening the link does not work
https://github.com/cashubtc/eNuts/blob/main/src/util/index.ts#L178
closes: #58