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

enhancement: show an error message if openLink fails #74

Merged
merged 6 commits into from
Jun 25, 2023
Merged

enhancement: show an error message if openLink fails #74

merged 6 commits into from
Jun 25, 2023

Conversation

SamantaTarun
Copy link
Contributor

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

@SamantaTarun
Copy link
Contributor Author

SamantaTarun commented Jun 20, 2023

@KKA11010 where should i put toast?

should i put it everywhere openurl is called?

Copy link
Collaborator

@KKA11010 KKA11010 left a 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

👍

@SamantaTarun
Copy link
Contributor Author

@KKA11010 i think it should be like that.

export function OpenUrl(url: string)

@KKA11010
Copy link
Collaborator

@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.

@SamantaTarun
Copy link
Contributor Author

@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.

@KKA11010
Copy link
Collaborator

KKA11010 commented Jun 21, 2023

@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

@KKA11010 KKA11010 added the enhancement New feature or request label Jun 23, 2023
@KKA11010 KKA11010 added this to the First Beta Release milestone Jun 23, 2023
@SamantaTarun SamantaTarun changed the title enhancement: Show an error message if openLink fails enhancement: show an error message if openLink fails Jun 24, 2023
Copy link
Collaborator

@KKA11010 KKA11010 left a 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 😍

src/components/Balance.tsx Outdated Show resolved Hide resolved
src/components/ErrorScreen/ErrorDetails.tsx Outdated Show resolved Hide resolved
src/components/screens/Lightning/modal.tsx Outdated Show resolved Hide resolved
src/components/screens/Lightning/payInvoice.tsx Outdated Show resolved Hide resolved
@KKA11010
Copy link
Collaborator

@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

Copy link
Collaborator

@KKA11010 KKA11010 left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Jun 25, 2023

Codecov Report

Patch coverage: 13.33% and project coverage change: -0.02 ⚠️

Comparison is base (33bb40f) 24.54% compared to head (db08027) 24.52%.

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              
Impacted Files Coverage Δ
src/components/ErrorScreen/ErrorDetails.tsx 0.00% <0.00%> (ø)
src/components/screens/Lightning/modal.tsx 24.74% <0.00%> (-0.79%) ⬇️
src/components/screens/Lightning/payInvoice.tsx 0.00% <0.00%> (ø)
src/util/index.ts 44.33% <0.00%> (ø)
src/components/Balance.tsx 86.66% <50.00%> (-5.00%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@KKA11010 KKA11010 merged commit 9d5a659 into cashubtc:main Jun 25, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show an error message if openLink fails
3 participants