Skip to content

Improve settings#247

Merged
brunobar79 merged 9 commits into
masterfrom
improve-settings
Dec 20, 2018
Merged

Improve settings#247
brunobar79 merged 9 commits into
masterfrom
improve-settings

Conversation

@brunobar79

Copy link
Copy Markdown
Contributor

Description
Created a new settings reducer and added a few options:

  • Search Engine is now configurable (default to DuckDuckGo)
  • Auto-lock options: (immediately, after 5s, 10, 15, 30, 60 or never)

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(?)

@brunobar79 brunobar79 requested review from bitpshr and estebanmino and removed request for estebanmino December 20, 2018 05:58

@bitpshr bitpshr 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.

Looks good.

@brunobar79 brunobar79 merged commit 93ff30a into master Dec 20, 2018
@brunobar79 brunobar79 deleted the improve-settings branch December 20, 2018 18:14
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
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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants