Improve settings#247
Merged
Merged
Conversation
rickycodes
pushed a commit
that referenced
this pull request
Jan 31, 2022
* initial work for settings reducer * more changes * search engine added to settings * udpate snapshots * autolock added to settings * fix feedback clearTimeout * fix default value * refactor lock stuff * clean up
7 tasks
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Oct 27, 2025
## **Description** This PR adds support for batch PERPS position estimation in the RewardsController to enable the "close all positions" feature. The backend API (rewards team PR [#247](consensys-vertical-apps/va-mmcx-rewards#247)) was already deployed with support for accepting `perpsContext` as either a single object or an array of positions, returning aggregated points and bonus estimates. **Changes:** 1. Updated `EstimatePointsContextDto` type to accept `perpsContext` as either a single object or an array 2. Enhanced JSDoc documentation to explain batch estimation behavior (aggregated points sum + average bonus) 3. Added minimal unit test coverage for batch PERPS array functionality The implementation maintains backwards compatibility with existing single-position calls and follows a pass-through architecture (no controller logic changes needed). ## **Changelog** CHANGELOG entry: support batch points estimation for perps ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: Batch PERPS position rewards estimation Scenario: user estimates rewards for closing multiple PERPS positions Given user has multiple open PERPS positions And rewards feature is enabled And user has opted into rewards When user requests to close all positions Then RewardsController estimates points for all positions in a single batch request And backend returns aggregated points estimate (sum of all position points) And backend returns average bonus across all positions ``` ## **Screenshots/Recordings** N/A - Backend/Controller change only, no UI modifications ### **Before** `perpsContext` only accepted single object ### **After** `perpsContext` accepts single object or array of objects for batch estimation ## **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. --- ## **Technical Details** ### Files Modified: - `app/core/Engine/controllers/rewards-controller/types.ts` (lines 133-147) - `app/core/Engine/controllers/rewards-controller/RewardsController.ts` (lines 1544-1550) - `app/core/Engine/controllers/rewards-controller/RewardsController.test.ts` (lines 820-850) ### Type Changes: ```typescript // Before perpsContext?: EstimatePerpsContextDto; // After perpsContext?: EstimatePerpsContextDto | EstimatePerpsContextDto[]; ``` ### Test Coverage: - Added test: "estimates points for batch PERPS positions with array" - All existing tests pass (4/4 estimatePoints tests passing) - No regressions introduced <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Add batch PERPS points estimation by allowing `perpsContext` to be an array, updating docs, and adding a unit test; controller forwards requests unchanged. > > - **Rewards/Perps**: > - **Types**: Update `EstimatePointsContextDto` to accept `perpsContext` as `EstimatePerpsContextDto | EstimatePerpsContextDto[]` for batch estimation. > - **Controller**: Add JSDoc note in `RewardsController.estimatePoints` documenting batch behavior (aggregated points, average bonus). > - **Tests**: Add unit test in `RewardsController.test.ts` to verify estimating points with an array of PERPS positions passes through to `RewardsDataService:estimatePoints`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 42bf6bb. 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Created a new settings reducer and added a few options:
Refactored the entire locked screen and removed view logic into a LockScreenManager.
Had to split it in two different files because iOS and Android behave differently while going on background mode (Android ignores setTimeout completely)
Other minor stuff:
Allow to type words from the url input bar - I thought we already fixed this one(?)