[pull] main from MetaMask:main#530
Merged
Merged
Conversation
…26140) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Fixes a bug where clicking "Buy" / "Add Funds" on Android lands on a blank screen showing only "DepositRoot" in the header, instead of proceeding to the Buy flow. ### Root Cause When the V1 unified buy flag is enabled, selecting a token routes to the Deposit flow's `Root` component. This component renders nothing (`return null`) and relies on an async `useEffect` to check for an existing auth token via `SecureKeychain.getSecureItem()` before navigating to `BuildQuote`. On Android, the Keystore operation can hang indefinitely in certain device states, causing `initializeFlow` to never complete — leaving the user stuck on a blank screen. ### Changes - **Added a 5-second timeout** around `checkExistingToken()` so the flow continues even if the Android Keystore hangs - **Added `.catch()` error handling** on `initializeFlow()` so any unexpected failure falls back to navigating to `BuildQuote` instead of leaving the user stranded - **Replaced `return null` with a loading spinner** so users see visual feedback during initialization instead of a blank page - **Fixed variable shadowing** of `params` inside the effect (renamed to `navParams`) - **Added test coverage** for the error fallback path <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Fixes a buy navigation bug on Android and adds a loading spinner ## **Related issues** Fixes: #26079 ## **Manual testing steps** ```gherkin 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** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches Deposit navigation initialization and introduces timeout/error fallback behavior; risk is moderate due to potential routing changes, but scope is contained and covered by tests. > > **Overview** > Prevents the Deposit `Root` flow from getting stuck by wrapping `checkExistingToken()` in a **5s timeout** and logging/falling back to `Routes.DEPOSIT.BUILD_QUOTE` when token lookup fails or `initializeFlow` throws. > > Replaces the previous blank render (`return null`) with a centered loading spinner, and cleans up navigation param handling (avoids `params` shadowing). Adds a new unit test + snapshot update to cover the rejection fallback path. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit bd626fb. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…6047) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Bumps the bridge-controller and bridge-status-controller versions. Also passing in the `gasFeeEstimatesByChainId` state which the bridge-controller needs for calculating network fees. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: chore: use chain-agnostic gas fee estimates source for bridging ## **Related issues** Fixes: N/A ## **Manual testing steps** N/A - no user-facing changes and swaps e2e flow should not change ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [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](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Moderate risk due to upgrading `@metamask/bridge-controller`/`bridge-status-controller` and changing the gas fee estimates shape consumed by bridge selectors, which can affect quote calculation and bridging UX across networks. > > **Overview** > Updates the bridge integration to use chain-agnostic gas fee data by passing `GasFeeController.gasFeeEstimatesByChainId` into the bridge “app state” selectors (replacing the single-chain `selectGasFeeControllerEstimates` output). > > Removes the local Yarn patch for `@metamask/bridge-controller` by bumping to `^66.1.1` (and `bridge-status-controller` to `^66.0.2`), letting upstream provide the prior behavior changes. Also adjusts a token actions unit test mock signature to allow an optional `chainId` parameter. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 31591bf. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…re swaps/bridge txs (#25919) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR adds additional guards to ensure that `autoSign` is only called for hardware Swap/Bridge txs. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Removed notifications for all swap/bridge txs ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-4076 ## **Manual testing steps** ```gherkin Feature: Hardware wallet guard for swap and bridge auto-signing Scenario: Software wallet swap transaction does not trigger auto-sign Given the user has a software wallet account selected When the user submits a swap transaction Then the transaction is auto confirmed and auto-sign is not called Scenario: Hardware wallet swap transaction triggers auto-sign Given the user has a Ledger or QR hardware wallet account selected When the user submits a swap transaction Then auto-sign is called and the hardware signing modal is presented Scenario: Software wallet bridge transaction does not trigger auto-sign Given the user has a software wallet account selected When the user submits a bridge transaction Then the transaction is auto confirmed and auto-sign is not called Scenario: Hardware wallet bridge transaction triggers auto-sign Given the user has a Ledger or QR hardware wallet account selected When the user submits a bridge transaction Then auto-sign is called and the hardware signing modal is presented ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [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](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes transaction-type classification and the auto-sign trigger conditions; mistakes could prevent auto-sign for valid hardware swap/bridge flows or incorrectly classify swaps. > > **Overview** > Tightens `autoSign` eligibility so it only triggers for **hardware wallet** swap/bridge transactions, by extracting the unapproved-tx handler into a dedicated `onUnapprovedTransaction` helper and adding explicit hardware guards for swap (`isHardwareSwapApproveOrSwapTransaction`) and bridge (`isHardwareBridgeTransaction`). > > Swap detection no longer relies on `origin`; it now keys off `transactionMeta.type` (`swap`/`swapApproval`) plus validated contract/spender addresses, and smart-transaction utilities/tests were updated accordingly. New unit tests cover the new handler and the hardware-guard helpers. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 646a516. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR consolidates navigation styles across the codebase by replacing inline `navigationOptions` style definitions with the shared `getNavigationOptionsTitle` utility function. **Reason for change:** - Preparing the codebase for the upgrade to React Navigation v6 - Navigation header styles were defined inconsistently across components using the legacy `navigationOptions` pattern - Centralizing navigation options will make the migration to React Navigation v6's new API smoother and reduce the scope of changes required during the upgrade **Solution:** - Replaced inline style definitions with the centralized `getNavigationOptionsTitle` function from `app/components/UI/Navbar` - This ensures consistent navigation header styling across the app and simplifies the upcoming React Navigation v6 migration ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: #23765 Part of React Navigation v6 upgrade preparation (split from original PR for easier code review by team) ## **Manual testing steps** Feature: Navigation header consistency Scenario: User navigates to screens affected by this PR Given the app is running When user navigates to any screen modified in this PR Then the navigation header should display correctly with proper title styling And the back button should function as expected ## **Screenshots/Recordings** <!-- No visual changes expected - this is a code refactoring PR --> ### **Before** N/A - No visual changes ### **After** N/A - No visual changes ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [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](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk UI navigation change limited to route targets/params for opening the in-app browser and the bridge block-explorer modal; main risk is misrouting if route signatures differ across navigators. > > **Overview** > Bridge transaction details and the block-explorer modal now navigate *directly* to `Routes.BROWSER.VIEW` with `newTabUrl`/`timestamp`, instead of routing through `Routes.BROWSER.HOME` with nested `screen`/`params`. > > For bridge transactions, opening the block explorer modal now navigates straight to `Routes.BRIDGE.MODALS.TRANSACTION_DETAILS_BLOCK_EXPLORER` rather than via the modal stack root. Associated tests were updated to assert the new navigation call shape. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 79a9f8d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…act renaming (#26141) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** 1. **What is the reason for the change?** - The build workflow was failing on some runners (e.g. self-hosted) during iOS setup: missing Ruby 3.1.6 (rbenv) and/or wrong Gemfile path (`ios/ios/Gemfile`) when using job-level `BUNDLE_GEMFILE` with setup-e2e-env. The workflow also relied on remap env vars for secrets instead of `builds.yml`, and artifact upload/naming was inconsistent across build types. 2. **What is the improvement/solution?** - Use the **setup-e2e-env** action for iOS (same as build-ios-e2e): install Ruby 3.1.6, Bundler, and CocoaPods before `yarn setup:github-ci`, and remove job-level `BUNDLE_GEMFILE` so the action’s steps that run from `ios/` find the Gemfile correctly. - In `build.sh`, when `GITHUB_ACTIONS` is set, use `loadBuildConfig()` from `builds.yml` instead of remap*; keep remap* for Bitrise/local. - Add `scripts/rename-artifacts.js` and a single “Rename build artifacts” + upload flow for all build types (iOS and Android), with consistent naming (e.g. `metamask-{environment}-{buildType}-{version}-{buildNumber}`). To note, codefencing or built in feature flags values are not being applied properly, It's missing some changes that will be reflected on a new PR ([Bigger PR here for reference](#25177)) Android and IOS is working Android build: https://github.com/MetaMask/metamask-mobile/actions/runs/22079638138 IOS build: https://github.com/MetaMask/metamask-mobile/actions/runs/22080704672 ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin 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** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes modify CI build configuration and artifact handling for both iOS and Android; misconfiguration could break builds or produce incorrectly named/missing artifacts, but no production runtime code is affected. > > **Overview** > Build workflow now applies non-secret config from `builds.yml` into `GITHUB_ENV` and updates `scripts/build.sh` to load build config via `apply-build-config.js` when running in GitHub Actions (keeping legacy Bitrise env remapping for non-GHA runs). > > CI setup is adjusted to improve iOS reliability on self-hosted runners by adding the `setup-e2e-env` action (Ruby/Bundler/CocoaPods) and removing job-level `BUNDLE_GEMFILE`/Android gradle-properties copying. The workflow also adds `scripts/rename-artifacts.js` to standardize Android/iOS artifact names and replaces the prior iOS-only dev-build upload with consistent artifact uploads for both platforms. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f52c4d9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description**
This PR fixes Bridge token selector network behavior across source and
destination flows.
Reason for change:
- Source and destination selectors used different chain-ranking logic,
causing inconsistent network visibility.
- Visible network pills were component-local state, so selection context
did not persist cleanly across picker flows.
- Selecting tokens on unconfigured networks could block expected source
selection behavior.
Improvement/solution:
- Unified source/destination network ranking to
`selectAllowedChainRanking` (feature-flag ranking filtered by
`ALLOWED_BRIDGE_CHAIN_IDS`).
- Removed source-only filtering by user-configured networks in network
pills and network list modal so all supported bridge networks are
visible.
- Lifted visible network-pill state into Redux (`visiblePillChainIds`)
so ordering persists across picker flows.
- Updated pills behavior so selecting a non-visible network promotes it
to the front.
- Added network auto-add during token selection via `PopularList` +
`NetworkController.addNetwork`:
- Source selection aborts if add-network fails.
- Destination selection continues if add-network fails.
## **Changelog**
CHANGELOG entry: Fixed Bridge token selectors to show all supported
networks, persist selected network pills, and auto-add missing networks
on token selection.
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
Feature: Bridge token selector network visibility and selection behavior
Scenario: source and destination selectors show the same supported network set
Given a wallet with only a subset of networks configured
And Bridge is enabled
When the user opens the source token selector network controls
And the user opens the destination token selector network controls
Then both selectors show networks from the same allowed bridge chain ranking
Scenario: selecting a non-visible network promotes it into pills
Given the token selector shows limited visible network pills and a "+X more" control
When the user opens the network list modal and selects a network not currently visible as a pill
Then the selected network appears as the first visible pill
And the remaining pills shift accordingly
Scenario: selecting a token on an unconfigured source network adds the network
Given a token exists on a supported network that is not currently configured in wallet settings
When the user selects that token as source
Then the app attempts to add the network configuration
And source token selection completes if network add succeeds
Scenario: source vs destination behavior when auto-add fails
Given network add fails for a token on an unconfigured network
When the user selects that token as source
Then source selection is aborted and the selector closes
When the user selects that token as destination
Then the flow continues without blocking
```
## **Screenshots/Recordings**
### **Before**
N/A
### **After**
N/A
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches Bridge token selection flow and introduces automatic network
addition via `NetworkController.addNetwork`, which could affect
navigation and state if misconfigured or if the add-network call fails
unexpectedly.
>
> **Overview**
> Bridge token selection and network filtering are unified so
source/dest pickers now use the same `selectAllowedChainRanking` list
(feature-flag ranking filtered by `ALLOWED_BRIDGE_CHAIN_IDS`), and the
network list modal no longer depends on route `type`.
>
> Network pill ordering is lifted into Redux via new
`visiblePillChainIds`, so selecting a network from the modal can promote
it into the visible pill set and the order persists across picker flows.
>
> Token selection now attempts to auto-add missing networks from
`PopularList` via `NetworkController.addNetwork`, aborting *source*
selection on failure but allowing *dest* selection to proceed; tests and
bridge mocks are updated accordingly.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2b37e66. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
## **Description** Phase 2 analytics migration (Batch 2-4): migrate Confirmations' signature metrics hook from MetaMetrics.getInstance() to the new analytics system (useAnalytics + AnalyticsEventBuilder). **Reason**: Deprecate MetaMetrics in favour of the shared analytics utility and AnalyticsController. **Changes**: `useSignatureMetrics.ts` now uses `useAnalytics()` and `createEventBuilder` from the analytics hook instead of `MetaMetrics.getInstance().trackEvent()` and `MetricsEventBuilder`; test mocks updated to mock `useAnalytics` at `app/components/hooks/useAnalytics/useAnalytics` with a chainable createEventBuilder. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-297 (Batch 2-4) ## **Manual testing steps** ```gherkin Feature: Confirmations analytics Scenario: user triggers a confirmations flow event Given app is open and user is in a confirmations flow When user performs an action that triggers analytics (e.g. signature requested, signature approved, signature rejected) Then the event is tracked on Mixpanel ``` ## **Screenshots/Recordings** N/A – analytics migration, no UI change. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [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](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Refactor-only change to how analytics events are dispatched; behavior should be equivalent aside from potential wiring/mocking mismatches. > > **Overview** > Migrates the confirmations `useSignatureMetrics` hook off `MetaMetrics.getInstance()`/`MetricsEventBuilder` to the new analytics API via `useAnalytics()` with `trackEvent` + `createEventBuilder`. > > Updates `useSignatureMetrics.test.ts` to mock `useAnalytics` (including a chainable event builder) instead of mocking `MetaMetrics`, while keeping existing signature event coverage (requested/approved/rejected) and property expectations intact. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a27ea8f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
Remove optout section
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Remove opt out button from Rewards settings
## **Related issues**
Fixes:
## **Manual testing steps**
```gherkin
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**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [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](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> UI removal and test cleanup only; no changes to rewards linking/opt-in
logic or data handling.
>
> **Overview**
> Removes the Rewards settings *opt-out* section from the account group
settings screen by dropping `RewardSettingsOptOut` from the list footer.
>
> Cleans up tests accordingly: deletes `RewardSettingsOptOut` and its
unit test, and updates `RewardSettingsAccountGroupList` tests to stop
mocking `useOptout` and to no longer assert opt-out-related `testID`s
(footer now only verifies presence via `list-footer`).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
565bbc2. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR is part of a series to remove the legacy code after BIP-44 was shipped, several components, hooks, views, etc. still uses the remote feature flag for BIP-44 causing an unnecessary overcomplexity that can be easily removed. The change includes updating the snap components. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: ## **Manual testing steps** Not applicable ## **Screenshots/Recordings** Not applicable ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I've included tests if applicable - [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Small refactor limited to Snap UI display/labeling logic; risk is mainly minor UI behavior changes in which name/address is preferred. > > **Overview** > Snap UI components no longer gate account-group behavior behind the `selectMultichainAccountsState2Enabled` flag. > > `useDisplayName` now always prefers an `accountGroupName` when available, and `SnapUIAvatar` always uses the EVM `accountGroupAddress` as the displayed address when present (falling back to the parsed CAIP address otherwise). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 998fb9c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Phase 2 analytics migration (Batch 2-5): migrate Settings' components and hooks from useMetrics/MetaMetrics/withMetricsAwareness to the new analytics system (useAnalytics, withAnalyticsAwareness, analytics utility). **Reason**: Deprecate MetaMetrics in favour of the shared analytics utility and AnalyticsController. **Changes**: - Settings main view, SecuritySettings, ProtectYourWallet, BlockaidSettings, DisplayNFTMediaSettings, BatchAccountBalanceSettings, AutoDetectTokensSettings, AutoDetectNFTSettings: useMetrics → useAnalytics; MetaMetricsEvents from app/core/Analytics. - NetworkSettings, AdvancedSettings, GeneralSettings: withMetricsAwareness → withAnalyticsAwareness; NetworkSettings now uses this.props.metrics (from HOC) for addTraitsToUser and trackEvent instead of MetaMetrics.getInstance(); GeneralSettings helpers use metrics.createEventBuilder instead of MetricsEventBuilder. - Related test files: mocks updated to useAnalytics/withAnalyticsAwareness; MetaMetricsEvents imported from app/core/Analytics where needed; chainable createEventBuilder mocks; NetworkSettings tests pass metrics in props. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-297 (Batch 2-5) ## **Manual testing steps** ```gherkin Feature: Settings analytics Scenario: user triggers a settings flow event Given app is open and user is in a settings flow When user performs an action that triggers analytics (e.g. opens General/Advanced/Security, toggles security alerts, changes currency, adds/removes network RPC) Then the event is tracked on Mixpanel ``` ## **Screenshots/Recordings** N/A – analytics migration, no UI change. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [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](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches analytics instrumentation across several Settings flows (including network configuration actions), so tracking regressions are possible if `analytics` injection/mocks don’t match runtime behavior; no user-facing logic changes are intended. > > **Overview** > Migrates multiple Settings screens (General/Advanced/Security and related sub-settings) from legacy `useMetrics`/`withMetricsAwareness` and direct `MetaMetrics.getInstance()` usage to the new analytics hook/HOC (`useAnalytics`, `withAnalyticsAwareness`) and `analytics.createEventBuilder`. > > Updates event and trait tracking call sites (e.g., currency change, toggles, network RPC add/remove/update, network add/remove) to route through the injected `analytics` prop/hook, and revises unit tests/mocks to provide the new `analytics` interface (including chainable event-builder mocks) and adjust assertions accordingly. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e83dd26. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## **Description** Phase 2 analytics migration (Batch 2-6): migrate mobile-core-ux's Network Management components and hooks from the legacy MetaMetrics system to the new analytics system. **Reason**: Deprecate MetaMetrics in favour of the shared analytics utility and AnalyticsController. **Changes**: - `NetworkSelector.tsx` now uses `analytics.identify()` from `app/util/analytics/analytics` instead of `MetaMetrics.getInstance().addTraitsToUser()`. - `useSwitchNetworks.ts`, `useNetworkConnectionBanner.ts`, and `useAddPopularNetwork.ts` now use `useAnalytics` from `app/components/hooks/useAnalytics/useAnalytics` instead of `useMetrics`; `MetaMetricsEvents` is imported from `app/core/Analytics`. - Test mocks updated to mock `useAnalytics` and `analytics` instead of `useMetrics` and `MetaMetrics`. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-298 (Batch 2-6) ## **Manual testing steps** ```gherkin Feature: Network Management analytics Scenario: user triggers a network management flow event Given app is open and user is in a network management flow When user performs an action that triggers analytics (e.g. network switch, add popular network, network connection banner interaction) Then the event is tracked on Mixpanel ``` ## **Screenshots/Recordings** N/A – analytics migration, no UI change. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [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](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Primarily a refactor of analytics wiring and test mocks with minimal impact to user-facing behavior; main risk is altered analytics/identify calls or event payloads. > > **Overview** > Migrates Network Management analytics instrumentation off legacy MetaMetrics APIs. > > `NetworkSelector` now records network-removal traits via `analytics.identify(removeItemFromChainIdList(...))` instead of `MetaMetrics.getInstance().addTraitsToUser(...)`, and `useSwitchNetworks`, `useAddPopularNetwork`, and `useNetworkConnectionBanner` now use `useAnalytics` (with `MetaMetricsEvents` imported from `core/Analytics`) in place of `useMetrics`. Associated unit tests were updated to mock `useAnalytics`/`analytics` and to align with renamed IDs (`getAnalyticsId` vs `getMetaMetricsId`) and event builder shape. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 593461a. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )