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

[LLM] When deleting a token from the list of hidden tokens, it should be shown in the application #1617

Closed
wants to merge 12 commits into from

Conversation

lvndry
Copy link
Contributor

@lvndry lvndry commented Oct 19, 2022

πŸ“ Description

  • Added a SHOW_ACCOUNT redux action that unhide tokens when dispatched
  • Improved typing of storageWrapper
  • Fixed redirection bug when mocking accounts

❓ Context

βœ… Checklist

  • Test coverage
  • Atomic delivery
  • No breaking changes

πŸš€ Expectations to reach

Please make sure you follow these Important Steps.

Pull Requests must pass the CI and be internally validated in order to be merged.

@changeset-bot
Copy link

changeset-bot bot commented Oct 19, 2022

πŸ¦‹ Changeset detected

Latest commit: bd67a06

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
live-mobile Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added common Has changes in live-common ledgerjs Has changes in the ledgerjs open source libs mobile Has changes in LLM labels Oct 19, 2022
@github-actions
Copy link

github-actions bot commented Oct 19, 2022

@lvndry

Screenshots: ❌

It seems this PR contains screenshots that are different from the base branch.
If you are sure all those changes are correct, you can comment on this PR with /generate-screenshots to update those screenshots.

Make sure all the changes are correct before running the command, as it will commit and push the new result to the PR.

linux

Actual Diff Expected
v3-onboarding-complete-actual v3-onboarding-complete-diff v3-onboarding-complete-expected
v3-onboarding-complete-actual v3-onboarding-complete-diff v3-onboarding-complete-expected

@vercel
Copy link

vercel bot commented Oct 19, 2022

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated
live-common-tools βœ… Ready (Inspect) Visit Preview Oct 21, 2022 at 11:36AM (UTC)
3 Ignored Deployments
Name Status Preview Updated
ledger-live-github-bot ⬜️ Ignored (Inspect) Oct 21, 2022 at 11:36AM (UTC)
native-ui-storybook ⬜️ Ignored (Inspect) Oct 21, 2022 at 11:36AM (UTC)
react-ui-storybook ⬜️ Ignored (Inspect) Oct 21, 2022 at 11:36AM (UTC)

@lvndry lvndry marked this pull request as ready for review October 19, 2022 14:03
@ghost ghost self-requested a review October 19, 2022 14:07
@lvndry lvndry changed the title When deleting a token from the list of hidden tokens, it should be shown in the application [LLM] When deleting a token from the list of hidden tokens, it should be shown in the application Oct 19, 2022
@github-actions github-actions bot added the desktop Has changes in LLD label Oct 19, 2022
@desirendr
Copy link
Contributor

/generate-screenshots

@github-actions
Copy link

github-actions bot commented Oct 20, 2022

@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Base: 47.77% // Head: 44.13% // Decreases project coverage by -3.64% ⚠️

Coverage data is based on head (b757865) compared to base (08ee841).
Patch coverage: 40.00% of modified lines in pull request are covered.

❗ Current head b757865 differs from pull request most recent head bd67a06. Consider uploading reports for the commit bd67a06 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1617      +/-   ##
===========================================
- Coverage    47.77%   44.13%   -3.65%     
===========================================
  Files          689      627      -62     
  Lines        30325    26682    -3643     
  Branches      7949     7209     -740     
===========================================
- Hits         14489    11775    -2714     
+ Misses       14622    13769     -853     
+ Partials      1214     1138      -76     
Flag Coverage Ξ”
test 44.13% <40.00%> (-3.65%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Ξ”
...bs/ledger-live-common/src/account/serialization.ts 52.20% <ΓΈ> (ΓΈ)
libs/ledger-live-common/src/portfolio/v2/index.ts 86.06% <25.00%> (-1.06%) ⬇️
libs/ledger-live-common/src/account/helpers.ts 70.50% <42.85%> (-4.37%) ⬇️
libs/ledgerjs/packages/hw-app-str/src/Str.ts 68.75% <0.00%> (ΓΈ)
libs/ledgerjs/packages/hw-app-tezos/src/Tezos.ts 11.34% <0.00%> (ΓΈ)
libs/ledgerjs/packages/hw-app-cosmos/src/Cosmos.ts 20.73% <0.00%> (ΓΈ)
libs/ledgerjs/packages/hw-app-helium/src/Helium.ts 89.28% <0.00%> (ΓΈ)
.../ledgerjs/packages/hw-app-polkadot/src/Polkadot.ts 20.77% <0.00%> (ΓΈ)
...dgerjs/packages/hw-app-helium/src/serialization.ts 86.58% <0.00%> (ΓΈ)
... and 64 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

β˜” View full report at Codecov.
πŸ“’ Do you have feedback about the report comment? Let us know in this issue.

@lvndry lvndry force-pushed the feat/live-3300-hiden-token-redisplay branch from b757865 to bd67a06 Compare October 21, 2022 11:34
@github-actions github-actions bot added the screenshots Screenshots have been updated label Oct 21, 2022
@ghost
Copy link

ghost commented Oct 21, 2022

Ready to move to QA ! πŸš€

@@ -230,6 +233,7 @@ export type ChildAccountRaw = {
id: string;
name: string;
starred?: boolean;
hidden?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

are we sure we want to go that way? isn't it duplicating the current approach of "hidding" token of the system called "blacklist token ids"? We already have a way to hide token and it's via this env and via retriggering a synchronisation: that way, we were just REMOVING the accounts out of tokenAccounts instead of having a boolean to check everywhere (which is costly, it can be annoying to always have to filter these out, all the code that do subAccounts.length would also be badly impacted (eg to condition presence of sub accounts))

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@lvndry lvndry Oct 24, 2022

Choose a reason for hiding this comment

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

Nice tips @gre I wasn't aware of the blacklistedTokenIds yet.
The issue I noticed here is that there are 2 reducers triggered for 1 redux action (settings and account).
The action in the settings reducer is correct but not in the account reducer (there are no SHOW_TOKEN action): https://github.com/LedgerHQ/ledger-live/blob/develop/apps/ledger-live-mobile/src/reducers/accounts.ts#L111.
An other issue is that when the withoutToken function is called we remove the token from from the list of subAccounts so how do we show the subAccount again to the user ?
If it's possible I could try to refactor the withoutToken and enableToken functions to actually add/remove the tokens from this list and then rebuild the subAccount only from the id.
However I don't think the current solution is that costing if we use the correct selectors on the redux side (something like enabledCurrencies or enableAccounts) as redux would cache the value

Copy link
Contributor

@gre gre left a comment

Choose a reason for hiding this comment

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

simplification to consider by just using "blacklist token ids"

@@ -230,6 +233,7 @@ export type ChildAccountRaw = {
id: string;
name: string;
starred?: boolean;
hidden?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

@lvndry
Copy link
Contributor Author

lvndry commented Oct 24, 2022

Creating an other PR using blacklistedTokenIds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common desktop Has changes in LLD ledgerjs Has changes in the ledgerjs open source libs mobile Has changes in LLM screenshots Screenshots have been updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants