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

[#20828] feat: display toast for all wallet connect actions #21534

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

mohsen-ghafouri
Copy link
Contributor

fixes #20828

Summary

rel to this closed PR #20870

In this PR we show toasts when:

  • disconnecting dapp (was there already, just updated text)
  • disconnecting dapp failed (was there already, just updated text)
  • connecting to dapp successful
  • rejecting connection
  • sign request rejected
  • sign request confirmed
  • transaction request rejected
  • transaction request confirmed

Areas that maybe impacted

  • Dapp communication

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Oct 30, 2024

Jenkins Builds

Click to see older builds (22)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 1a4cdaa #2 2024-10-30 14:38:55 ~8 min tests 📄log
✔️ 1a4cdaa #2 2024-10-30 14:39:39 ~8 min android-e2e 🤖apk 📲
✔️ 1a4cdaa #2 2024-10-30 14:40:39 ~9 min android 🤖apk 📲
✔️ 1a4cdaa #2 2024-10-30 14:41:03 ~10 min ios 📱ipa 📲
✔️ c670e7a #3 2024-11-05 11:19:20 ~4 min tests 📄log
✔️ c670e7a #3 2024-11-05 11:22:46 ~8 min android-e2e 🤖apk 📲
✔️ c670e7a #3 2024-11-05 11:23:00 ~8 min android 🤖apk 📲
✔️ c670e7a #3 2024-11-05 11:25:13 ~10 min ios 📱ipa 📲
ef6ab36 #4 2024-11-06 15:28:11 ~3 min ios 📄log
✔️ ef6ab36 #4 2024-11-06 15:30:25 ~5 min tests 📄log
✔️ ef6ab36 #4 2024-11-06 15:34:28 ~9 min android-e2e 🤖apk 📲
✔️ ef6ab36 #4 2024-11-06 15:34:59 ~10 min android 🤖apk 📲
9bdf58a #5 2024-11-07 05:26:40 ~2 min ios 📄log
✔️ 9bdf58a #5 2024-11-07 05:28:29 ~4 min tests 📄log
✔️ 9bdf58a #5 2024-11-07 05:30:23 ~6 min android-e2e 🤖apk 📲
✔️ 9bdf58a #5 2024-11-07 05:32:18 ~8 min android 🤖apk 📲
9bdf58a #6 2024-11-07 19:44:50 ~1 min ios 📄log
✔️ 9bdf58a #7 2024-11-11 09:28:55 ~9 min ios 📱ipa 📲
920c585 #6 2024-11-12 10:44:41 ~2 min tests 📄log
✔️ 920c585 #6 2024-11-12 10:48:15 ~6 min android-e2e 🤖apk 📲
✔️ 920c585 #6 2024-11-12 10:50:12 ~8 min android 🤖apk 📲
✔️ 920c585 #8 2024-11-12 10:51:50 ~9 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6870d86 #7 2024-11-12 11:32:53 ~4 min tests 📄log
✔️ 6870d86 #7 2024-11-12 11:36:59 ~8 min android-e2e 🤖apk 📲
✔️ 6870d86 #7 2024-11-12 11:37:36 ~8 min android 🤖apk 📲
✔️ 6870d86 #9 2024-11-12 11:39:41 ~10 min ios 📱ipa 📲
✔️ c04bbcf #8 2024-11-13 08:59:12 ~5 min tests 📄log
✔️ c04bbcf #8 2024-11-13 09:03:14 ~9 min android-e2e 🤖apk 📲
✔️ c04bbcf #8 2024-11-13 09:03:46 ~9 min android 🤖apk 📲
✔️ c04bbcf #10 2024-11-13 09:03:50 ~9 min ios 📱ipa 📲

Copy link
Member

@clauxx clauxx left a comment

Choose a reason for hiding this comment

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

Looks good 👍

:on-success (fn []
(log/info "Wallet Connect session proposal rejected")
(rf/dispatch [:toasts/upsert
{:type :positive
Copy link
Member

Choose a reason for hiding this comment

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

Should this toast be of type :positive if the session proposal was rejected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this isn’t an error and the user intended to reject the session, we can confirm it was successfully rejected by :positive type IMO.

@status-im-auto
Copy link
Member

75% of end-end tests have passed

Total executed tests: 8
Failed tests: 2
Expected to fail tests: 0
Passed tests: 6
IDs of failed tests: 703133,702843 

Failed tests (2)

Click to expand
  • Rerun failed tests

  • Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843

    Device 2: Find `Text` by `xpath`: `//android.view.ViewGroup[@content-desc='chat-item']//android.widget.TextView[contains(@text,'https://status.app/c/')]`
    Device 2: Wait for element `Button` for max 120s and click when it is available

    Test setup failed: critical/chats/test_public_chat_browsing.py:350: in prepare_devices
        self.community_2.join_community()
    ../views/chat_view.py:420: in join_community
        self.join_button.wait_and_click(120)
    ../views/base_element.py:100: in wait_and_click
        self.wait_for_visibility_of_element(sec)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: Button by accessibility id:`show-request-to-join-screen-button` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    # STEP: Check that removed user is not shown in the list anymore
    Device 1: Wait for element Button for max 30s and click when it is available

    critical/chats/test_public_chat_browsing.py:240: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.sign_in.show_profiles_button.wait_and_click()
    ../views/base_element.py:100: in wait_and_click
        self.wait_for_visibility_of_element(sec)
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: Button by accessibility id:`show-profiles` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Passed tests (6)

    Click to expand

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230
    2. test_wallet_send_eth, id: 727229

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    2. test_wallet_balance_mainnet, id: 740490

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    @mariia-skrypnyk
    Copy link

    mariia-skrypnyk commented Nov 4, 2024

    Hey @mohsen-ghafouri !

    Thanks for your PR!

    1. Have a question regarding such toast:

    disconnecting dapp
    when we manually in Status app decline a connection request

    Screenshot 2024-11-04 at 15 03 57

    Shouldn't it be like we see here in Decline section:

    https://www.figma.com/design/HOJ4lV2ko3jzMjorsDzaoP/Wallet-%2F-dApp-notifications?node-id=0-1&node-type=canvas&m=dev

    Screenshot 2024-11-04 at 15 04 16
    1. Please, help me to figure out how can I manually trigger such activity?

    disconnecting dapp failed

    @mohsen-ghafouri
    Copy link
    Contributor Author

    Hello @mariia-skrypnyk, thanks for testing! Manually disconnecting a dapp is different from declining a connection request—each has its own message.

    As for the 2nd point, it’s unlikely to trigger unless the WalletConnect library throws an error, which should be rare. Just thinking out loud—if you disconnect a dapp on the dapp side first, would trying to disconnect it again in Status throw any error? 🤔

    @clauxx
    Copy link
    Member

    clauxx commented Nov 5, 2024

    ... if you disconnect a dapp on the dapp side first, would trying to disconnect it again in Status throw any error? 🤔

    @mohsen-ghafouri disconnecting from the dapp side would trigger a session_delete event on the wallet side immediately (or on the next WC initialization if app is closed), so AFAIK the user shouldn't even get the chance to disconnect from the wallet. But we did have client-side bugs a while back where it did error out when trying to disconnect an already disconnected dapp.

    @mariia-skrypnyk
    Copy link

    mariia-skrypnyk commented Nov 5, 2024

    Manually disconnecting a dapp is different from declining a connection request—each has its own message.

    So @mohsen-ghafouri in my 1. point I see the correct toast when I decline connection request?

    if you disconnect a dapp on the dapp side first, would trying to disconnect it again in Status throw any error? 🤔

    In practice if I disconnect connection on the dApp side then in app connection disconnects automatically and dissapears from the connection list.

    Did you have a chance to catch the disconnecting dapp failed toast on your dev side? I want to make sure it works in case I can’t emulate this situation manually.

    @mohsen-ghafouri
    Copy link
    Contributor Author

    mohsen-ghafouri commented Nov 5, 2024

    Hey @mariia-skrypnyk i tried to record video for different scenarios, i hope it helps.

    In first video :

    • I declined first request
    • for second request i approved and dApp successfully connected
    • at the end i manually disconnect the dApp successfully
    Simulator.Screen.Recording.-.iPhone.13.-.2024-11-05.at.14.54.43.mp4

    in second video i could programmatically produce the fail situation that user can't disconnect the dapp and here is the result

    Simulator.Screen.Recording.-.iPhone.13.-.2024-11-05.at.14.56.55.mp4

    @mariia-skrypnyk
    Copy link

    mariia-skrypnyk commented Nov 5, 2024

    Thanks @mohsen-ghafouri !

    1. Now it's clear for me, thanks, your video helped.
    2. I see no such validation text in Figma : Failed to disconnect... Can you show me the source of it or it was not made by you?
    3. I found that we do not have such toast when disconnect on the dApp side (connect just dissapears from the list with no toast) :

    https://github.com/user-attachments/assets/0a4e4da4-5a02-41bd-b4f4-e84708e70cfc
    Can we add this toast?

    Everything else is fine all places you've mentioned in a PR.

    @mohsen-ghafouri
    Copy link
    Contributor Author

    @mariia-skrypnyk About point 2, there were some conversation about tech limitation and other stuff that @clauxx did with design team, some are available in figma file https://www.figma.com/design/HOJ4lV2ko3jzMjorsDzaoP/Wallet-%2F-dApp-notifications?node-id=1-81335&t=yTFW0izl574K99Tp-4.

    In this PR i just added changes from #20870 with just made it compatible with latest code base changes.

    about point 3 there is no requirement that i'm aware about it. we just wanted to show toast for user action that they do inside the status app IMO.

    @mariia-skrypnyk
    Copy link

    Thanks @mohsen-ghafouri !

    1. Ok, thanks for all comments and hystory.
    2. We have such requirement in Figma https://www.figma.com/design/HOJ4lV2ko3jzMjorsDzaoP/Wallet-%2F-dApp-notifications?node-id=0-1&node-type=canvas&m=dev
    Screenshot 2024-11-05 at 14 21 09 Screenshot 2024-11-05 at 14 20 59

    Is it in a scope of your PR?

    @mohsen-ghafouri
    Copy link
    Contributor Author

    Sure @mariia-skrypnyk i will update PR, also i couldn't find any reference about display account name when user disconnect from dApp, so i will update text to Disconnected from {dapp name}

    @mariia-skrypnyk
    Copy link

    mariia-skrypnyk commented Nov 6, 2024

    Hey @mohsen-ghafouri !

    Please use this design https://www.figma.com/design/mLyiYPXqu8KetdQONOlZpV/dApp-Interactions?node-id=780-12729&node-type=frame&m=dev for disconnection case.

    Discussion is here https://discord.com/channels/1210237582470807632/1274068685266489434/1303689180643065887

    @mohsen-ghafouri
    Copy link
    Contributor Author

    Hey @clauxx could you please my last commit? not sure if there is any other way to access to dApp name and account name.

    Comment on lines 541 to 546
    (defn get-account-by-session
    [db session]
    (let [accounts (get-in db [:wallet :accounts])
    session-account-address (first (:accounts session))
    [_ address] (network-utils/split-network-full-address session-account-address)]
    (get-account-by-address (vals accounts) address)))
    Copy link
    Member

    Choose a reason for hiding this comment

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

    this util seems specific to wallet-connect, since you're passing the session. You could either move it to the wallet-connect ns or pass the address instead of the session (but then you already have get-account-by-address that does almost the same thing)

    @clauxx
    Copy link
    Member

    clauxx commented Nov 6, 2024

    Hey @clauxx could you please my last commit? not sure if there is any other way to access to dApp name and account name.

    yeah looks good! left just one comment

    @mohsen-ghafouri
    Copy link
    Contributor Author

    Hey @mariia-skrypnyk, I applied changes. but ios pipeline has issue. whenever they resolve the problem. it's ready for test again.

    @mariia-skrypnyk
    Copy link

    @mohsen-ghafouri thanks !

    Ping me please in case you found first that iOS build is ready.

    @mohsen-ghafouri mohsen-ghafouri force-pushed the feat/wc-toasts branch 2 times, most recently from 920c585 to 6870d86 Compare November 12, 2024 11:28
    @mohsen-ghafouri
    Copy link
    Contributor Author

    Hey @mariia-skrypnyk it's ready for test.

    @status-im-auto
    Copy link
    Member

    88% of end-end tests have passed

    Total executed tests: 8
    Failed tests: 0
    Expected to fail tests: 1
    Passed tests: 7
    
    IDs of expected to fail tests: 702843 
    

    Expected to fail tests (1)

    Click to expand

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843
    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Skipped due to waku issue on staging fleet]]

    Passed tests (7)

    Click to expand

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230
    2. test_wallet_send_eth, id: 727229

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    2. test_wallet_balance_mainnet, id: 740490

    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_profile_switch, id: 703133
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    @mariia-skrypnyk
    Copy link

    Thanks @mohsen-ghafouri !

    PR can be merged!

    @mohsen-ghafouri mohsen-ghafouri merged commit 2a7da75 into develop Nov 13, 2024
    5 checks passed
    @mohsen-ghafouri mohsen-ghafouri deleted the feat/wc-toasts branch November 13, 2024 09:09
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Status: DONE
    Development

    Successfully merging this pull request may close these issues.

    Not all toasts are shown for Wallet Connect
    6 participants