Skip to content

feat: add share button and share sheet to Token Details page#31868

Merged
salimtb merged 8 commits into
mainfrom
feat/token-details-share-button
Jun 22, 2026
Merged

feat: add share button and share sheet to Token Details page#31868
salimtb merged 8 commits into
mainfrom
feat/token-details-share-button

Conversation

@salimtb

@salimtb salimtb commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

add share button and share sheet to Token Details page

Description

Changelog

CHANGELOG entry: add share button and share sheet to Token Details page

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Share.mov

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

Note

Low Risk
User-facing share and analytics only; no auth, payments, or sensitive data handling beyond existing token route params.

Overview
Adds a share action on Token Details so users can share a MetaMask deep link to the current asset.

TokenDetailsInlineHeader now accepts optional onSharePress and shows a share icon alongside the price-alert control (same ambient-color gating as other header actions). TokenDetails wires handleShare: it no-ops if CAIP-19 assetId cannot be resolved, otherwise opens the native share sheet with https://link.metamask.io/asset?assetId=… (encoded), uses { url } on iOS and { message } on Android, and emits TOKEN_DETAILS_SHARED with chain, symbol, and address.

Analytics registers the new event in MetaMetrics.events. Tests cover share URL encoding, Android vs iOS payloads, analytics, header visibility, plus expanded TokenDetails coverage for close/open tracking, CTAs, disclaimer, and non-EVM rendering.

Reviewed by Cursor Bugbot for commit 0f471cb. Bugbot is set up for automated code reviews on this repo. Configure here.

- Add share icon button to the TokenDetailsInlineHeader next to the bell
- Implement ShareTokenSheet bottom sheet with a branded dark share card
  showing token identity, 24h change, price, market cap, 24h volume,
  sparkline chart, QR code, and MetaMask branding
- Conditional social share circles (WhatsApp, Telegram, X, Signal) shown
  only when the respective apps are installed via Linking.canOpenURL
- Copy and More (image capture via react-native-view-shot + expo-sharing)
  action buttons with larger size for better tap targets
- Three-tier market data resolution: Redux cache → search discovery → API
- All UI strings use i18n translations under the share_token namespace
- Design tokens used throughout (darkTheme for card, theme for chrome)
@github-actions

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.

@metamask-ci

metamask-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Description section is empty. Describe what changed and why.
  • Related issues section is empty. Add Fixes: #123 / Closes: <URL> / Refs: <Jira key>, or write a short rationale after the colon.
  • Manual testing steps still contain template content (the Gherkin example title or a [...] placeholder). Replace with real steps, or write N/A — <reason>.
  • Pre-merge author checklist has unchecked items (e.g. "I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards."). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

@socket-security

socket-security Bot commented Jun 17, 2026

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

salimtb and others added 3 commits June 22, 2026 00:18
- Add TOKEN_DETAILS_SHARED ('Token Details Shared') to MetaMetrics.events.ts
- Fire the event from handleShare with chain_id, token_symbol, and
  token_address to identify the most-shared assets in Segment
- Add unit tests for onSharePress wiring, URL encoding, and event properties
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added size-M and removed size-L labels Jun 21, 2026
@github-actions github-actions Bot added size-L and removed size-M labels Jun 22, 2026
@salimtb salimtb marked this pull request as ready for review June 22, 2026 09:05
@salimtb salimtb requested a review from a team as a code owner June 22, 2026 09:05

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4cf3892. Configure here.

@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 72%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR adds a "Share" button to the Token Details screen (TokenDetailsInlineHeader) and a new analytics event (TOKEN_DETAILS_SHARED). The changes are:

  1. MetaMetrics.events.ts: Purely additive - adds TOKEN_DETAILS_SHARED enum value and event generator. No existing events are modified.

  2. TokenDetails.tsx: Adds handleShare callback using React Native's Share API to share a deep link URL with CAIP-19 asset ID. Passes onSharePress to TokenDetailsInlineHeader.

  3. TokenDetailsInlineHeader.tsx: Adds onSharePress prop and renders a new Share ButtonIcon alongside the existing price alert button. Layout changed from single endButtonHitArea to a new endButtons container wrapping both buttons.

  4. Test files: Unit tests for the new functionality.

Tag selection reasoning: The Token Details screen is accessed from the token list in the wallet home. SmokeWalletPlatform covers core wallet platform features including token-related flows. No dedicated E2E tests exist for TokenDetails share functionality, but SmokeWalletPlatform tests exercise the wallet home and token list which leads to TokenDetails. The layout change in TokenDetailsInlineHeader (wrapping buttons in a new endButtons container) could potentially affect existing price alert button rendering, warranting regression testing of the wallet platform flows.

No other tags are needed as this change is isolated to the Token Details component and doesn't affect confirmations, swaps, network management, accounts, or other feature areas.

Performance Test Selection:
The changes add a Share button to the Token Details screen and a new analytics event. These changes do not affect any performance-sensitive code paths such as app launch, login, onboarding, asset loading, swap flows, or account list rendering. No performance test files were modified. The Share API call is user-initiated and not part of any measured performance scenario.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@juanmigdr juanmigdr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I have seent his in prod in some links, wondering if this is going to be the case for this link...

Image

@salimtb

salimtb commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

LGTM, I have seent his in prod in some links, wondering if this is going to be the case for this link...

Image

i think we do this for all deeplinks actually , but worth reconsidering this indeed

@salimtb salimtb added this pull request to the merge queue Jun 22, 2026
Merged via the queue into main with commit c2bb189 Jun 22, 2026
122 checks passed
@salimtb salimtb deleted the feat/token-details-share-button branch June 22, 2026 16:15
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
@metamaskbot metamaskbot added the release-8.1.0 Issue or pull request that will be included in release 8.1.0 label Jun 29, 2026
@gauthierpetetin

Copy link
Copy Markdown
Contributor

No release label on PR. Adding release label release-8.1.0 on PR, as PR was added to branch 8.1.0 when release was cut.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.1.0 Issue or pull request that will be included in release 8.1.0 risk:medium AI analysis: medium risk size-L team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants