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: Transaction deep link sharing #16543

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Cuteivist
Copy link
Contributor

Task #16412

User stories: https://www.notion.so/Transaction-deep-link-10d8f96fb65c803c85fed5f4440ad439

Status-go : status-im/status-go#5959

What does the PR do

  • Added ShareButton
  • Added logic to call generation and parsing of transaction deep link
  • Added logic to handle transaction deep link in chat
  • Added logic to open send or swap modals with data passed in the link
  • Added feature flag, disabled by default

NOTE that design is still in progress

Affected areas

Chat
Wallet

Architecture compliance

Screenshot of functionality (including design for comparison)

tx_deep_link.mov

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.

It would be best to follow testing through same code with included unfurling here #16541

Otherwise checkout to this branch status-im/status-go#5959 on status-go and set env variable FLAG_TRANSACTION_DEEP_LINK_ENABLED to "1"

  • What kind of user flows should be checked?

Send modal and swap modal generating the link.
Pasting the link into the chat.

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 Oct 17, 2024

Jenkins Builds

Click to see older builds (14)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ aefe804 #1 2024-10-17 11:10:33 ~7 min tests/nim 📄log
✔️ aefe804 #1 2024-10-17 11:11:49 ~8 min macos/aarch64 🍎dmg
✔️ aefe804 #1 2024-10-17 11:15:33 ~12 min tests/ui 📄log
✔️ aefe804 #1 2024-10-17 11:19:08 ~15 min linux-nix/x86_64 📦tgz
✔️ aefe804 #1 2024-10-17 11:20:08 ~16 min macos/x86_64 🍎dmg
✔️ aefe804 #1 2024-10-17 11:22:24 ~19 min linux/x86_64 📦tgz
✔️ aefe804 #1 2024-10-17 11:27:32 ~24 min windows/x86_64 💿exe
✔️ aefe804 #3 2024-10-21 10:34:10 ~6 min macos/aarch64 🍎dmg
✔️ aefe804 #3 2024-10-21 10:35:03 ~7 min tests/nim 📄log
✔️ aefe804 #3 2024-10-21 10:39:52 ~11 min tests/ui 📄log
✔️ aefe804 #3 2024-10-21 10:40:15 ~12 min linux-nix/x86_64 📦tgz
✔️ aefe804 #3 2024-10-21 10:43:41 ~15 min linux/x86_64 📦tgz
✔️ aefe804 #3 2024-10-21 10:44:16 ~16 min macos/x86_64 🍎dmg
✔️ aefe804 #3 2024-10-21 10:48:13 ~20 min windows/x86_64 💿exe
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6d2decd #2 2024-10-21 10:02:30 ~6 min tests/nim 📄log
✔️ 6d2decd #2 2024-10-21 10:02:43 ~7 min macos/aarch64 🍎dmg
✔️ 6d2decd #2 2024-10-21 10:07:19 ~11 min tests/ui 📄log
✔️ 6d2decd #2 2024-10-21 10:08:10 ~12 min macos/x86_64 🍎dmg
✔️ 6d2decd #2 2024-10-21 10:08:56 ~13 min linux-nix/x86_64 📦tgz
✔️ 6d2decd #2 2024-10-21 10:14:47 ~19 min linux/x86_64 📦tgz
✔️ 6d2decd #2 2024-10-21 10:17:30 ~21 min windows/x86_64 💿exe
✔️ 2000e11 #4 2024-10-21 10:56:40 ~6 min macos/aarch64 🍎dmg
✔️ 2000e11 #4 2024-10-21 10:57:34 ~7 min tests/nim 📄log
✔️ 2000e11 #4 2024-10-21 11:02:31 ~12 min linux-nix/x86_64 📦tgz
✔️ 2000e11 #4 2024-10-21 11:03:20 ~12 min tests/ui 📄log
✔️ 2000e11 #4 2024-10-21 11:03:33 ~13 min macos/x86_64 🍎dmg
✔️ 2000e11 #4 2024-10-21 11:06:21 ~15 min linux/x86_64 📦tgz
✔️ 2000e11 #4 2024-10-21 11:11:02 ~20 min windows/x86_64 💿exe

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.

Overall code LGTM however:

  • missing some QML tests for this new feature; at least the new ShareButton and tst_SwapModal
  • some of the QML components have a SB page, those could use some updates

ui/app/AppLayouts/Wallet/controls/ShareButton.qml Outdated Show resolved Hide resolved
ui/imports/shared/views/chat/MessageView.qml Outdated Show resolved Hide resolved
@Cuteivist
Copy link
Contributor Author

Overall code LGTM however:

  • missing some QML tests for this new feature; at least the new ShareButton and tst_SwapModal
  • some of the QML components have a SB page, those could use some updates

@caybro
This feature is still behind feature flag. The design is not yet finished. When I wlll final polishing run, I will update story book and qml tests.

Some SB were updated in https://github.com/status-im/status-desktop/pull/16555/files

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.

LGTM!

@micieslak
Copy link
Member

@Cuteivist please wait a bit with merging, review in progress.

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.

LGTM in general

I have some doubts related to architecture - mainly caused by already existing problems. We need to think how to address it in a way leaving the codebase in a possibly better shape.


states: State {
name: "success"
when: shareStateTimer.running
Copy link
Member

Choose a reason for hiding this comment

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

nice binding between state and timer :)

Comment on lines +37 to +39
onClicked: {
shareStateTimer.restart()
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
onClicked: {
shareStateTimer.restart()
}
onClicked: shareStateTimer.restart()

Usually we keep single-liners without {}

Comment on lines +158 to +163
const url = root.swapAdaptor.swapStore.getShareTransactionUrl(Constants.SendType.Swap,
root.swapInputParamsForm.fromTokensKey,
root.swapInputParamsForm.fromTokenAmount,
root.swapInputParamsForm.selectedAccountAddress,
root.swapInputParamsForm.selectedNetworkChainId,
root.swapInputParamsForm.toTokenKey)
Copy link
Member

Choose a reason for hiding this comment

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

I know it's not matter of this PR, but please keep in mind to not put stores into adaptors.

@@ -95,6 +96,7 @@ Item {
dappsEnabled: featureFlags ? featureFlags.dappsEnabled : false
swapEnabled: featureFlags ? featureFlags.swapEnabled : false
sendViaPersonalChatEnabled: featureFlags ? featureFlags.sendViaPersonalChatEnabled : false
transactionDeepLinkEnabled: featureFlags ? featureFlags.transactionDeepLinkEnabled : false
Copy link
Member

Choose a reason for hiding this comment

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

There is sth strange regarding that FeatureFlagsStore. It's object with empty, writable properties only.

It should be refactored to be as any other store. It means that access to the context property should be encapsulated in FeatureFlagsStore.qml and all properties marked as read only. Could you please do that small refactor there 🙏 ?

Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to add Storybook page for this new component. It's good to do it as a first step when creating new component bc it speed up development and further maintenance.

Comment on lines +30 to +31
return self.delegate.parseTransactionSharedUrl(url)
Copy link
Member

Choose a reason for hiding this comment

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

Is this method used somewhere?

Please keep standard empty line at the end.

@@ -388,11 +390,47 @@ Item {
""
)
}

function onShowTransactionModal(txType, asset, amount, address, chainId, toAsset) {
Copy link
Member

Choose a reason for hiding this comment

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

Requesting modals or other ui actions from the backend is an architectural problem. The problem begins in activateStatusDeepLink which parses the link and decides what kind of UI action should be done as a result.

The flow should be much simpler and separated here:

  • backend exposes method to parse link returning json object (as a string bc of nim limitations)
  • the method is wrapped in js function in a store. There the string response from original backend method is parsed to json and returns parsed form.
  • UI calls this method exposed from store and decides on UI side what to do (calling modals, displaying details, etc)

I think we have three options here:

  • refactoring existing activateStatusDeepLink according the the description above and adding the new functionality on top (biggest one)
  • exposing the method to parse the url and use it, ignoring the old flow, creating ticket to refactor it
  • keeping it as it is but creating ticket to refactor it

Copy link
Member

Choose a reason for hiding this comment

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

what is this change?

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.

5 participants