-
Notifications
You must be signed in to change notification settings - Fork 81
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
fix(Wallet): Hiding assets from wallet's main view doesn't work #15811
fix(Wallet): Hiding assets from wallet's main view doesn't work #15811
Conversation
Jenkins BuildsClick to see older builds (23)
|
✔️ status-desktop/prs/linux/x86_64/tests-nim/PR-15811#1 🔹 ~7 min 11 sec 🔹 874fc4c 🔹 📦 tests/nim package |
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.
What we should do here is quite opposite - instead of altering AssetsView
which has currently quite well defined and clear API, we can remove those popups from Popups
and handle externally just the actual action, hiding asset in this case.
That handling can be done in RightTabView
, where AssetsView
is defined or propagated up in the hierarchy to be handled by some other parent.
With the popup handling via Global
the API of AssetsView
becomes less clear. Via reading API we don't know that this component is going to request some operation (as it was, there are unused signals like hideCommunityAssets
left) or even that, like now, it's going to request some helper popup, because the dependency is hidden via using singleton.
The proposed approach also delegates handling logic to Popups
which becomes a huge aggregator of logic of any kind, coming from various places in the app, taking a lot of dependencies. Handling closer to the source, e.g. in parent of AssetsView
is more localized and doesn't add additional dependencies there.
Also splitting into separate files is better than growing one big file with not only popups but also business logic triggered by them.
Let's imagine that requirements change and instead of using popup we handle actions from menu directly. In the structure we had so far it's only internal change in AssetsView
, API is not even touched. Everything else stays untouched, everything works as before (hideRequested
is emitted).
In the new approach many things needs to be changed: AssetsView
including API
, parent component, and also Popups
potentially as some things may be not needed there then.
Btw, there is one thing that could be improved in AssetsView
: model
should not be passed in one piece to the popup. When window is resized and delegate goes out of view and is removed, model
object is also gone. Then popup may be left in invalid state. Oppositely, passing values separately by value is rock solid.
Hmm I don't get this; I am not altering AssetsView API whatsover, and I can't remove those confirmation modals from the global Popups either; the very same codepath is being used from Settings/Manage tokens
That would be just duplicating the same code we already have in Popups
OK, I can move the calls up to RightTabView.qml
Yup, I can do this; but we really want to keep the shared code in Popups; that was the initial purpose of introducing it in the first place
That's not true, we'd likely want to do the same thing in the other place too (Manage tokens) which would only lead to the same code duplication
I'm not passing the whole |
On a second look, the confirmation hide asset dialog in Global/Popups is used only from one place; I can partially remove that and keep one in AssetsView.qml 👍 |
874fc4c
to
87d6fb0
Compare
Fixed too |
@@ -1168,35 +1169,24 @@ QtObject { | |||
destroyOnClose: true | |||
communitiesStore: root.communitiesStore | |||
|
|||
onHideClicked: (tokenSymbol, tokenName, tokenImage, isAsset) => isAsset ? root.openConfirmHideAssetPopup(tokenSymbol, tokenName, tokenImage) | |||
: root.openConfirmHideCollectiblePopup(tokenSymbol, tokenName, tokenImage) | |||
onHideClicked: (tokenSymbol, tokenName, tokenImage, isAsset) => isAsset ? root.openConfirmHideAssetPopup(tokenSymbol, tokenName, tokenImage, true) |
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.
Here we need the (shared) confirmHideAssetPopup
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.
Hmm I don't get this; I am not altering AssetsView API whatsover, and I can't remove those confirmation modals from the global Popups either; the very same codepath is being used from Settings/Manage tokens
Using Global.*
in AssetsView
was changing the API of that component indeed and it was my key concern - hideRequested
and hideCommunityAssetsRequested
would be never called and therefore effectively removed. So thank you for removing those calls and keeping that interaction explicit by having signals exposed via public API.
I'm almost fine with the current version, modulo the issue I raised inline. It should be straightforward to adjust either way.
Ideally, those 2 popups when not reachable now via AssetsView
, they should have their own SB pages, but maybe we can do just when needed.
56dc286
to
8a6553f
Compare
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.
Thank you for the alignments regarding code structure!
But... have you run the app after your last changes? The app is not starting at all because improper placing Component
object in RightTabView
.
Ouch, will fix |
- partially reuse the already available Global/Popups methods to hide assets (which also emit proper notifications); those are needed as anotehr shared modal from Popups uses it too (may come from outside of Wallet) - some warnings cleanup in the controller Fixes #15777
8a6553f
to
36e6630
Compare
Should run and work correctly now @micieslak |
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.
Works fine now, thanks!
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! Tested 👍
What does the PR do
Fixes #15777
Affected areas
Wallet
Screenshot of functionality (including design for comparison)
Zaznam.obrazovky.z.2024-07-25.12-47-15.webm