Skip to content

fix: redirection issue after chain switch on sign request#8496

Merged
christopherferreira9 merged 1 commit into
mainfrom
fix_WalletConnect-redirect-issues-after-switchEthereumChain-request
Mar 4, 2024
Merged

fix: redirection issue after chain switch on sign request#8496
christopherferreira9 merged 1 commit into
mainfrom
fix_WalletConnect-redirect-issues-after-switchEthereumChain-request

Conversation

@omridan159

@omridan159 omridan159 commented Feb 1, 2024

Copy link
Copy Markdown
Contributor

Description

Issue Link: MetaMask/metamask-mobile#7878

Summary:

This PR addresses a redirection issue in MetaMask Mobile where users were prematurely redirected back to the dApp following a chain switch request, without waiting for the completion of a personal_sign request.

Key Points:

Problem: After initiating a chain switch as part of a personal_sign request, users were redirected back to the dApp immediately, rather than after the personal_sign request was completed. This led to a disjointed user experience.

Solution: We've introduced a mechanism to check for any pending personal_sign requests. The wallet will now redirect users back to the dApp only after these requests have been fully processed (either approved or denied).

Implementation:

  • Check for Pending Sign Requests: Before redirecting, the wallet checks if there are any pending personal_sign requests in the session.
  • Conditional Redirection: Users are redirected back to the dApp only if there are no pending personal_sign requests, ensuring the sign request process is not interrupted.

This update ensures a seamless integration between MetaMask Mobile and dApps, enhancing user experience by aligning redirection behavior with the expected transaction flow.

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Screen.Recording.2024-02-01.at.10.54.46.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

…n request and right after it a personal_sign request
@omridan159 omridan159 requested a review from a team as a code owner February 1, 2024 09:07
@github-actions

github-actions Bot commented Feb 1, 2024

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (4dd9073) 40.62% compared to head (6b74aa1) 40.66%.
Report is 7 commits behind head on main.

Files Patch % Lines
app/core/WalletConnect/WalletConnectV2.ts 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8496      +/-   ##
==========================================
+ Coverage   40.62%   40.66%   +0.04%     
==========================================
  Files        1239     1240       +1     
  Lines       29989    30015      +26     
  Branches     2870     2873       +3     
==========================================
+ Hits        12182    12206      +24     
- Misses      17109    17110       +1     
- Partials      698      699       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sonarqubecloud

sonarqubecloud Bot commented Feb 1, 2024

Copy link
Copy Markdown

@christopherferreira9 christopherferreira9 added team-sdk-deprecated DEPRECATED: please use "team-wallet-integrations" instead needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Feb 1, 2024
@omridan159 omridan159 added needs-qa Any New Features that needs a full manual QA prior to being added to a release. and removed INVALID-PR-TEMPLATE PR's body doesn't match template labels Feb 1, 2024
@omridan159 omridan159 requested a review from abretonc7s February 1, 2024 13:24

@abretonc7s abretonc7s left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@siosio34 siosio34 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@siosio34

Copy link
Copy Markdown

When will this pull request be merged?

@christopherferreira9 christopherferreira9 added QA in Progress QA has started on the feature. and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. labels Mar 4, 2024
@christopherferreira9

Copy link
Copy Markdown
Contributor

Looking good. Tested for both iOS and Android.

@christopherferreira9 christopherferreira9 merged commit 08b149f into main Mar 4, 2024
@christopherferreira9 christopherferreira9 deleted the fix_WalletConnect-redirect-issues-after-switchEthereumChain-request branch March 4, 2024 12:36
@github-actions github-actions Bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Mar 4, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 4, 2024
@metamaskbot metamaskbot added the release-7.19.0 Issue or pull request that will be included in release 7.19.0 label Mar 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA in Progress QA has started on the feature. release-7.19.0 Issue or pull request that will be included in release 7.19.0 team-sdk-deprecated DEPRECATED: please use "team-wallet-integrations" instead

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants