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

Feat/request payment modal 16736 #16744

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

Conversation

Cuteivist
Copy link
Contributor

Closes #16736

What does the PR do

  • Added feature flag for Request Payment. Disabled until whole feature is finished
  • Added Request payment modal
  • Added menu for message commands (now featuring add image and add request payment). Request payment is disabled for testnet to prevent corner cases or issues.
  • Added RequestPaymentStore to easily pass required models and stores to modal
  • Updated storybook

Affected areas

Architecture compliance

Screenshot of functionality (including design for comparison)

  • I've checked the design and this PR matches it

image

image

Impact on end user

What is the impact of these changes on the end user (before/after behaviour)

How to test

  • How should one proceed with testing this PR.
    Enable request payment feature flag, go to any chat on mainnet.
  • What kind of user flows should be checked?

Risk

Described potential risks and worst case scenarios.

Tick one:

  • Low risk: 2 devs MUST perform testing as specified above and attach their results as comments to this PR before merging.
  • High risk: QA team MUST perform additional testing in the specified affected areas before merging.

@status-im-auto
Copy link
Member

status-im-auto commented Nov 11, 2024

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
cfc1b4c #1 2024-11-11 14:26:13 ~7 min macos/aarch64 📄log
✖️ cfc1b4c #1 2024-11-11 14:26:28 ~7 min tests/nim 📄log
cfc1b4c #1 2024-11-11 14:29:04 ~9 min tests/ui 📄log
cfc1b4c #1 2024-11-11 14:29:38 ~10 min linux-nix/x86_64 📄log
cfc1b4c #1 2024-11-11 14:30:47 ~11 min macos/x86_64 📄log
cfc1b4c #1 2024-11-11 14:30:48 ~11 min linux/x86_64 📄log
cfc1b4c #1 2024-11-11 14:33:09 ~13 min windows/x86_64 📄log
✔️ 6556a35 #2 2024-11-23 13:38:10 ~7 min macos/aarch64 🍎dmg
✔️ 6556a35 #2 2024-11-23 13:38:28 ~7 min tests/nim 📄log
✔️ 6556a35 #2 2024-11-23 13:43:16 ~12 min tests/ui 📄log
✔️ 6556a35 #2 2024-11-23 13:45:15 ~14 min macos/x86_64 🍎dmg
✔️ 6556a35 #2 2024-11-23 13:46:32 ~15 min linux-nix/x86_64 📦tgz
✔️ 6556a35 #2 2024-11-23 13:51:33 ~20 min windows/x86_64 💿exe
✔️ 6556a35 #2 2024-11-23 13:53:56 ~23 min linux/x86_64 📦tgz

Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

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

LGTM in general, apart from the vertical (mis)alignment between the amount and the token selector when looking at the screenshot :)

if (!valid)
return 0

return parseFloat(text.replace(LocaleUtils.userInputLocale.decimalPoint, "."))
Copy link
Member

Choose a reason for hiding this comment

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

Are we fine with loss of precision here? 🤔

@alexjba
Copy link
Contributor

alexjba commented Nov 19, 2024

Build fails on all platforms

[2024-11-11T14:30:45.449Z] /home/jenkins/workspace/rs_linux_x86_64_package_PR-16744/src/app/global/feature_flags.nim(13, 1) template/generic instantiation of `QtObject` from here
[2024-11-11T14:30:45.450Z] /home/jenkins/workspace/rs_linux_x86_64_package_PR-16744/src/app/global/feature_flags.nim(26, 32) Error: undeclared field: 'requestPaymentEnabled=' for type feature_flags.FeatureFlags [type declared in /home/jenkins/workspace/rs_linux_x86_64_package_PR-16744/src/app/global/feature_flags.nim(14, 8)]

Copy link
Contributor

@alexjba alexjba left a comment

Choose a reason for hiding this comment

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

Nice work! LGTM in general!

A few findings below.

id: reopenButton
anchors.centerIn: parent
text: "Reopen"
enabled: !requestPaymentModalComponent.visible
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not needed. Also, here we're using the Component and visible is undefined.

StatusDialog {
id: root

required property SharedStores.RequestPaymentStore store
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT of removing the store dependency here and replace it with properties? Would be much clearer what is needed for this Modal.

I see we're not using many properties/functions from the store and could be easely done.


readonly property bool isSelectedHoldingValidAsset: !!selectedHolding.item

readonly property var adaptor: TokenSelectorViewAdaptor {
Copy link
Contributor

Choose a reason for hiding this comment

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

We have this warning in storybook:
file:///status-desktop/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml:285:17: Unable to assign [undefined] to QAbstractItemModel*

store: control.requestPaymentStore

onAccepted: {
control.requestPaymentStore.addPaymentRequest(selectedTokenKey, amount, selectedAccountAddress, selectedNetworkChainId)
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing requestPaymentStore.addPaymentRequest implementation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please add qml tests for the new component (or add a task to do it before we need to add more features on top of this)

Copy link
Member

@micieslak micieslak left a comment

Choose a reason for hiding this comment

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

Definitely good job in general, however I have several concerns regarding the architecture which are worth amending imo:

  1. The modal should be fully decoupled from StatusChatInput. StatusChatInput should only emit signal with request to launch the modal instead of managing it internally, because it causes that StatusChagInput depends on everything the modal depends on now and will depend on in the future. Those two things become tightly coupled unnecessarily.
  2. RequestPaymentStore is probably not needed at all. Broadly speaking, the store is not intended to be a container to move stuff around UI components. It's to expose backend's functionality. And every backend's mode/signal/function should be exposed only once via a single store.
  3. The RequestPaymentModal should be a plain UI component taking some models and emitting some signals with no dependency on any store. Also transformations like that done by TokenSelectorViewAdaptor should not be done internally. Instead the modal should depend on the model. It's up to the caller to compose data using any adaptor that's needed.

In case of any doubts please ping me, I will be happy to discuss about that.

@Cuteivist Cuteivist force-pushed the feat/request-payment-modal-16736 branch from cfc1b4c to 6556a35 Compare November 23, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request payment - modal
5 participants