Skip to content

refactor(analytics): migrate Batch 3-1: mobile-platform#26312

Merged
NicolasMassart merged 2 commits into
mainfrom
refactor/MCWP-301_analytics_migration_batch_3-1_no-team
Feb 20, 2026
Merged

refactor(analytics): migrate Batch 3-1: mobile-platform#26312
NicolasMassart merged 2 commits into
mainfrom
refactor/MCWP-301_analytics_migration_batch_3-1_no-team

Conversation

@NicolasMassart

@NicolasMassart NicolasMassart commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Description

Phase 3 analytics migration (Batch 3-1): migrate Authentication core's Authentication.ts from MetaMetrics.getInstance() to the new analytics system.

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

Changes: Authentication.ts now uses 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-301 (Batch 3-1)

Manual testing steps

Feature: Authentication analytics

  Scenario: user triggers an authentication flow event
    Given app is open and user is in an authentication flow

    When user performs an action that triggers analytics (e.g. unlock wallet, login)
    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
Small refactor limited to how the “metrics enabled” flag is read plus corresponding test mock updates; minimal behavioral risk beyond potential differences in enabled-state resolution.

Overview
Authentication.unlockWallet now uses the shared analytics.isEnabled() helper (instead of MetaMetrics.getInstance().isEnabled()) to decide whether to route users into the opt-in metrics onboarding flow.

Updates Authentication.test.ts to mock the new analytics module and replaces all MetaMetrics spies with analytics.isEnabled spies to keep navigation/login tests consistent.

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

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Feb 20, 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.

@NicolasMassart NicolasMassart self-assigned this Feb 20, 2026
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Feb 20, 2026
@NicolasMassart NicolasMassart changed the title refactor(analytics): migrate Batch 3-1: no team refactor(analytics): migrate Batch 3-1: mobile-platform Feb 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
This PR is a pure refactoring change that replaces MetaMetrics.getInstance().isEnabled() with analytics.isEnabled() in the Authentication service. The change is functionally identical because the old MetaMetrics.isEnabled() method already delegates to analytics.isEnabled() internally (as seen in MetaMetrics.ts line 120: isEnabled = (): boolean => analytics.isEnabled()).

The changes are:

  1. Authentication.ts: Import change and method call simplification - removing one layer of indirection
  2. Authentication.test.ts: Updated test mocks to use the new analytics module pattern

This is a low-risk change because:

  • No business logic is modified
  • The functionality is identical (just removing indirection)
  • Unit tests are properly updated to test the same behavior
  • The affected code path (navigation after wallet unlock based on metrics opt-in status) will behave exactly the same

Since this is a straightforward refactoring with comprehensive unit test coverage and no functional changes, E2E tests are not necessary to validate this change.

Performance Test Selection:
This is a pure refactoring change that replaces one analytics API call with another equivalent one. The change doesn't affect any rendering, data loading, state management, or app initialization paths. The functionality is identical - just removing an indirection layer. No performance impact is expected from this change.

View GitHub Actions results

@NicolasMassart NicolasMassart requested review from a team and removed request for a team February 20, 2026 00:19
@sonarqubecloud

Copy link
Copy Markdown

@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 20, 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 20, 2026
Merged via the queue into main with commit e4effa3 Feb 20, 2026
68 checks passed
@NicolasMassart NicolasMassart deleted the refactor/MCWP-301_analytics_migration_batch_3-1_no-team branch February 20, 2026 01:58
@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 20, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 20, 2026
@metamaskbot metamaskbot added release-7.68.0 Issue or pull request that will be included in release 7.68.0 release-7.67.0 Issue or pull request that will be included in release 7.67.0 and removed release-7.68.0 Issue or pull request that will be included in release 7.68.0 labels Feb 20, 2026
@metamaskbot

Copy link
Copy Markdown
Collaborator

Missing release label release-7.67.0 on PR. Adding release label release-7.67.0 on PR and removing other release labels(release-7.68.0), as PR was cherry-picked in branch 7.67.0.

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

Labels

release-7.67.0 Issue or pull request that will be included in release 7.67.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