Skip to content

refactor(analytics): migrate Batch 3-16: mobile-platform#26593

Merged
NicolasMassart merged 3 commits into
mainfrom
refactor/MCWP-302_analytics_migration_batch_3-16_mobile-platform
Feb 27, 2026
Merged

refactor(analytics): migrate Batch 3-16: mobile-platform#26593
NicolasMassart merged 3 commits into
mainfrom
refactor/MCWP-302_analytics_migration_batch_3-16_mobile-platform

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 3 analytics migration (Batch 3-16): migrate selectors (legalNotices, bridgeController) from MetaMetrics.getInstance() to the new analytics system.

Reason: Deprecate MetaMetrics in favour of the shared analytics utility and AnalyticsController.

Changes: legalNotices/index.ts and bridgeController/index.ts now use analytics.isEnabled() from app/util/analytics/analytics instead of MetaMetrics.getInstance().isEnabled(); test mocks updated to mock the analytics utility instead of MetaMetrics.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-302 (Batch 3-16)

Manual testing steps

Feature: Selectors analytics

  Scenario: user triggers a selector-dependent flow event
    Given app is open and user is in a flow that relies on legalNotices or bridgeController selectors

    When user performs an action that triggers analytics (e.g. PNA25 notice display, bridge quote request)
    Then the event is tracked on Mixpanel

Screenshots/Recordings

N/A – analytics migration, no UI change.

Pre-merge author checklist

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
Low risk refactor that only swaps the opt-in check from MetaMetrics.getInstance().isEnabled() to analytics.isEnabled() in a couple of selectors and updates unit test mocks accordingly.

Overview
Migrates selector logic in bridgeController and legalNotices off deprecated MetaMetrics.getInstance() and onto the shared analytics helper.

participateInMetaMetrics (bridge app state) and the PNA25 notice gating check now call analytics.isEnabled(), and the legalNotices selector tests were updated to mock the new analytics utility instead of MetaMetrics.

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

@NicolasMassart NicolasMassart added the team-mobile-platform Mobile Platform team label Feb 25, 2026
@NicolasMassart NicolasMassart self-assigned this Feb 25, 2026
@NicolasMassart NicolasMassart requested a review from a team February 25, 2026 18:19
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Feb 25, 2026
@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.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a refactoring change that migrates from MetaMetrics.getInstance().isEnabled() to analytics.isEnabled() in two selector files:

  1. bridgeController/index.ts: The selectBridgeAppState selector now uses analytics.isEnabled() to set participateInMetaMetrics. This selector is used by bridge-related hooks (useInsufficientBalance, useNeedsGasFaucet).

  2. legalNotices/index.ts: The selectShouldShowPna25Notice selector now uses analytics.isEnabled() to check if MetaMetrics is enabled before showing privacy notices.

Both changes are functionally equivalent - the new analytics.isEnabled() method checks the same analytics enabled state via Redux selectors (selectAnalyticsEnabled). The test file was properly updated to mock the new analytics module.

Since the bridge controller selector is affected and is used in bridge flows, SmokeTrade should be run to verify bridge functionality still works correctly. The legal notices change is a UI display concern that doesn't have a dedicated test tag but is low risk.

This is a low-risk refactoring with no behavioral changes expected - just an API migration to a newer analytics helper pattern.

Performance Test Selection:
This is a pure refactoring change that replaces one method call (MetaMetrics.getInstance().isEnabled()) with another equivalent method call (analytics.isEnabled()). Both methods check the same analytics enabled state. There are no changes to UI rendering, data loading patterns, state management, or any performance-critical code paths. The change is in selector files that return the same values as before, just using a different API. No performance impact expected.

View GitHub Actions results

@Cal-L Cal-L 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

@NicolasMassart NicolasMassart added this pull request to the merge queue Feb 27, 2026
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Feb 27, 2026
Merged via the queue into main with commit 66a4f56 Feb 27, 2026
86 of 87 checks passed
@NicolasMassart NicolasMassart deleted the refactor/MCWP-302_analytics_migration_batch_3-16_mobile-platform branch February 27, 2026 19:55
@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Feb 27, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 27, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Feb 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.69.0 Issue or pull request that will be included in release 7.69.0 size-S team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants