feat: shield-deep-link
Description
This PR add shield deep link handle which open shield website in app browser instead of showing invalid deeplink screen for shield
Changelog
CHANGELOG entry: Handle shield deep link
Related issues
Fixes:
Manual testing steps
Feature: shield deep link
Scenario: user use shield deep lnk
Given app with wallet created
When user press shield deep link
Then app open with in app browser to shield website
Screenshots/Recordings
Before
After
https://github.com/user-attachments/assets/053920c9-104c-4d68-9277-788a4c2bc9fd
Pre-merge author checklist
- [x] I’ve followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards.
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using JSDoc format if applicable
- [x] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
Pre-merge reviewer checklist
- [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
- [x] 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.
[!NOTE] Adds
ACTIONS.SHIELDdeep link that opens the MetaMask Transaction Shield website in the in-app browser, with support in both legacy and v2 navigation handlers and accompanying tests.
- Deep link handling:
- Add
ACTIONS.SHIELDandSHIELD_WEBSITE_URLconstant (https://metamask.io/transaction-shield).- Legacy handler: route
shieldlinks tohandleBrowserUrlwithSHIELD_WEBSITE_URL.- V2
NavigationHandler: supportshield, navigate toRoutes.BROWSER.VIEWwith{ newTabUrl: SHIELD_WEBSITE_URL, linkType: EXTERNAL_LINK_TYPE, timestamp }.- Tests:
- Legacy universal link tests: add case asserting
shieldis handled.- V2 navigation tests: add case asserting navigation to browser with
SHIELD_WEBSITE_URL.Written by Cursor Bugbot for commit 94e7ee6cdf4d85a674e8b7c2aa17db486cf99281. This will update automatically on new commits. Configure here.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 78.87%. Comparing base (71b1e6e) to head (9b593f8).
:warning: Report is 2 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #23663 +/- ##
==========================================
- Coverage 78.89% 78.87% -0.03%
==========================================
Files 4050 4054 +4
Lines 106202 106308 +106
Branches 21458 21492 +34
==========================================
+ Hits 83789 83849 +60
- Misses 16536 16573 +37
- Partials 5877 5886 +9
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
🔍 Smart E2E Test Selection
- Selected E2E tags: SmokeCore
- Risk Level: low
- AI Confidence: 82%
click to see 🤖 AI reasoning details
The changes add a new deeplink action "SHIELD" that opens the MetaMask Shield website in the in-app browser. This is an additive change that:
- Creates a new constant file (app/constants/shield.ts) with a URL
- Adds SHIELD to the ACTIONS enum in deeplinks.ts
- Adds a new case handler in handleUniversalLink.ts that uses the existing handleBrowserUrl function
- Includes comprehensive unit tests for the new functionality
The change follows established patterns already used by similar actions (like PREDICT) and doesn't modify any existing functionality. The handleBrowserUrl function being used is already well-tested and stable.
While the files are in app/core/ (marked as critical), the changes are minimal, additive, and well-tested at the unit level. No E2E tests exist specifically for deeplink handling in the test suite.
Selecting SmokeCore as a sanity check since this touches core deeplink infrastructure, but the risk is low given the additive nature and pattern-following implementation.
Quality Gate passed
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code