Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@EdouardBougon
Copy link
Contributor

@EdouardBougon EdouardBougon commented Sep 29, 2025

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

Note

Introduces a new hideReturnToAppNotification option (default false) and passes it through to deeplink/QR URLs as hr=0/1; refactors SDK option initialization and updates tests.

  • SDK Options:
    • Add hideReturnToAppNotification (default false) to MetaMaskSDKOptions and defaultMetaMaskSDKOptions.
    • Refactor constructor to merge with defaultMetaMaskSDKOptions; auto-fill dappMetadata.url if missing in web env.
    • Set default in performSDKInitialization and expected options in tests.
  • Remote Connection:
    • Add hideReturnToAppNotification to RemoteConnectionState; initialize from sdk.options.
    • In startConnection, append hr=0/1 to linkParams and ensure it’s included for connectWith flows; QR link reflects hr.
  • PostMessageStream:
    • Add hideReturnToAppNotification to RemoteCommunicationPostMessageStream state and constructor.
    • getPostMessageStream forwards the flag from remoteConnection.state.
  • URL Handling:
    • In write, include hr=0/1 in deeplink URL params based on state.hideReturnToAppNotification.
  • Tests:
    • Add/adjust tests covering option defaults, constructor merge, flag propagation, and presence of hr=0/1 in generated links.

Written by Cursor Bugbot for commit 7caf78f. This will update automatically on new commits. Configure here.

@codecov
Copy link

codecov bot commented Sep 29, 2025

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 74.99%. Comparing base (13cd092) to head (7caf78f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/sdk/src/sdk.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1350      +/-   ##
==========================================
+ Coverage   74.93%   74.99%   +0.05%     
==========================================
  Files         184      184              
  Lines        4513     4519       +6     
  Branches     1105     1108       +3     
==========================================
+ Hits         3382     3389       +7     
+ Misses       1131     1130       -1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@EdouardBougon EdouardBougon marked this pull request as ready for review September 29, 2025 14:21
@EdouardBougon EdouardBougon requested a review from a team as a code owner September 29, 2025 14:21
Comment on lines 52 to 53
this.state.hideReturnToAppModal =
hideReturnToAppModal ?? this.state.hideReturnToAppModal;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the fallback be false? I guess I'm not clear if the goal here is to preserve a previous value on the same instance? Is that even possible? Won't this value clear once the stream is torn down?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It’s to fall back to the default value set in the state at line 29.

  public state: RemoteCommunicationPostMessageStreamState = {
    _name: null,
    remote: null,
    deeplinkProtocol: false,
    hideReturnToAppModal: false,
    platformManager: null,
  };

connector?: RemoteCommunication;
qrcodeLink?: string;
useDeeplink?: boolean;
hideReturnToAppModal?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] since this isn't a modal anymore I suppose we should make it more generic: hideReturnToAppNotification?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally agree :)

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

adonesky1
adonesky1 previously approved these changes Sep 30, 2025
Copy link
Contributor

@adonesky1 adonesky1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@adonesky1 adonesky1 merged commit 1cff69d into main Oct 1, 2025
47 of 49 checks passed
@adonesky1 adonesky1 deleted the hideReturnToApp branch October 1, 2025 17:55
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 1, 2025

@adonesky1 adonesky1 mentioned this pull request Nov 13, 2025
eth-crafter6045 added a commit to eth-crafter6045/metamask-sdk that referenced this pull request Dec 11, 2025
* feat: Add option to hide return modal

* fix: review

* fix: test

* fix: lint

* fix: test

* fix: cursor comment MetaMask/metamask-sdk#1350 (comment)
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.

3 participants