Skip to content

feat: disable auto-lock during Ramps unified buy v2 flow#26723

Merged
AxelGes merged 3 commits into
mainfrom
feat/TRAM-3300_disable-autolock-ramps-v2
Mar 2, 2026
Merged

feat: disable auto-lock during Ramps unified buy v2 flow#26723
AxelGes merged 3 commits into
mainfrom
feat/TRAM-3300_disable-autolock-ramps-v2

Conversation

@AxelGes

@AxelGes AxelGes commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Description

This PR disables the app's auto-lock mechanism while users are in the Ramps unified buy v2 flow.

Reason for change: When users minimize the app to check personal details, verify their identity, or complete payment information with external providers during the Ramps flow, they get locked out after the configured timeout, forcing them to re-authenticate and disrupting their purchase journey.

Solution: Temporarily disable auto-lock by stopping the AppState listener in LockManagerService when entering the Ramps flow, and re-enable it when exiting. This follows the exact same pattern used by the Card onboarding flow.

Technical implementation: The TokenListRoutes component is the root navigator for all Ramps v2 screens. A useEffect hook calls LockManagerService.stopListening() on mount and LockManagerService.startListening() on unmount, ensuring the entire flow (token selection, build quote, checkout webview, KYC screens, order completion) is covered.

Changelog

CHANGELOG entry: Improved Ramps buy flow by preventing auto-lock during checkout

Related issues

Refs: TRAM-3300

Manual testing steps

Feature: Auto-lock disabled during Ramps unified buy v2 flow

  Scenario: Auto-lock is disabled when entering Ramps flow from token selection
    Given the user has auto-lock set to "After 5 seconds" in Settings
    And the user is on the wallet home screen

    When the user navigates to Ramps token selection
    And the user backgrounds the app
    And waits for 10 seconds
    And the user foregrounds the app
    Then the user should return to the Ramps token selection screen
    And the app should NOT show the lock screen

  Scenario: Auto-lock is disabled when entering Ramps flow from token details
    Given the user has auto-lock set to "After 5 seconds" in Settings
    And the user is viewing a token's details page

    When the user presses "Buy" to enter the Ramps flow
    And the user backgrounds the app during checkout
    And waits for 10 seconds
    And the user foregrounds the app
    Then the user should return to the Ramps checkout screen
    And the app should NOT show the lock screen

  Scenario: Auto-lock is re-enabled after exiting Ramps flow
    Given the user was in the Ramps flow (auto-lock disabled)
    And the user exits the flow by pressing back

    When the user backgrounds the app
    And waits for 6 seconds
    And the user foregrounds the app
    Then the app should show the lock screen

  Scenario: Auto-lock works normally on non-Ramps screens
    Given the user has auto-lock set to "After 5 seconds" in Settings
    And the user is on the wallet home screen or swap screen

    When the user backgrounds the app
    And waits for 6 seconds
    And the user foregrounds the app
    Then the app should show the lock screen

Screenshots/Recordings

Before

After

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2026-02-27.at.22.21.39.mov

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

Medium Risk
Changes session/lock behavior by disabling the app auto-lock listener while users are in the Ramps flow, which could increase exposure if the flow fails to re-enable listening on exit. Scope is localized to the Ramps route root and covered by a new unit test for mount/unmount behavior.

Overview
Disables auto-lock for the duration of the Ramps unified buy v2 navigation flow by calling LockManagerService.stopListening() when TokenListRoutes mounts and restoring it via startListening() on unmount.

Adds a Jest test (routes.test.tsx) that mounts/unmounts the routes under a NavigationContainer and asserts the lock listener is stopped on entry and restarted on exit.

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

Temporarily disable the app's auto-lock mechanism while users are in the
Ramps unified buy v2 flow. This prevents the app from locking when users
minimize it to check personal details, verify identity, or complete
payment information with external providers.

The implementation mirrors the Card onboarding flow pattern by using
LockManagerService to stop/start the AppState listener in the root
TokenListRoutes navigator component.

Changes:
- Modified TokenListRoutes to disable auto-lock on mount and re-enable on unmount
- Added comprehensive tests to verify lock behavior

Refs: TRAM-3300
@AxelGes AxelGes self-assigned this Feb 28, 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.

@metamaskbot metamaskbot added the team-money-movement issues related to Money Movement features label Feb 28, 2026
@AxelGes AxelGes marked this pull request as ready for review February 28, 2026 01:23
@AxelGes AxelGes requested a review from a team as a code owner February 28, 2026 01:23
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes are focused on the Ramp (buy/sell crypto) feature routes. The modification adds auto-lock management to the TokenListRoutes component, disabling auto-lock when users are in the Ramps flow and re-enabling it when they exit. This is a UX improvement that allows users to minimize the app during verification steps without being locked out.

The changes:

  1. routes.tsx: Added useEffect hook to manage LockManagerService (stopListening on mount, startListening on unmount)
  2. routes.test.tsx: New test file validating the auto-lock management behavior

The SmokeRamps tag is appropriate because:

  • The changes are directly in the Ramp routes component (app/components/UI/Ramp/routes.tsx)
  • This affects the buy/sell crypto user flow
  • The routes.tsx file is the main navigation component for the Ramps feature

No other tags are needed because:

  • The change doesn't affect wallet home or actions entry points (no SmokeWalletPlatform needed)
  • The change is isolated to the Ramps navigation flow
  • No confirmations, accounts, or other features are impacted

Performance Test Selection:
No performance tests needed. The change adds a simple useEffect hook that calls LockManagerService.stopListening() on mount and startListening() on unmount. This doesn't affect UI rendering performance, data loading, list rendering, or any performance-critical paths. The LockManagerService calls are lightweight service method invocations that don't impact app responsiveness.

View GitHub Actions results

@amitabh94

Copy link
Copy Markdown
Contributor

Does it have any side effects such as stale data ?

@AxelGes AxelGes added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit 25d0121 Mar 2, 2026
86 checks passed
@AxelGes AxelGes deleted the feat/TRAM-3300_disable-autolock-ramps-v2 branch March 2, 2026 18:56
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 2, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Mar 2, 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-M team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants