-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate PreferencesController to BaseController v2 #25917
Labels
Comments
mcmire
changed the title
Convert PreferencesController to TypeScript, and migrate to BaseController v2
Migrate PreferencesController to BaseController v2
Jul 18, 2024
29 tasks
This was referenced Sep 20, 2024
github-merge-queue bot
pushed a commit
that referenced
this issue
Oct 14, 2024
<!-- 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** In this PR, we want to bring PreferencesController up to date with our latest controller patterns by upgrading to BaseControllerV2. <!-- 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? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27398?quickstart=1) ## **Related issues** Fixes: #25917 ## **Manual testing steps** Use case 1 1. Install the previous release 2. Complete user onboarding 3. Go to settings and change couple of user settings. For example language, currency and theme. 4. Close and disable MM in the extension 5. Checkout the version with these changes 6. Build and login 7. Make sure, the user preferences set earlier are still there Use case 2 1. Disable all the MM extensions 2. Install the version with these changes 3. When you click on MM, the default language should be English 4. Complete user onboarding 5. Go to settings and change couple of user settings. For example language, currency and theme. 6. Close and disable and enable the MM in extension. which forces user to login MM in the extension 7. Once you login again, make sure, the user preferences set earlier are still there ## **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 Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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. --------- Co-authored-by: Michele Esposito <[email protected]> Co-authored-by: MetaMask Bot <[email protected]> Co-authored-by: cryptodev-2s <[email protected]>
metamaskbot
added
the
release-12.7.0
Issue or pull request that will be included in release 12.7.0
label
Oct 14, 2024
gauthierpetetin
added
release-12.6.0
Issue or pull request that will be included in release 12.6.0
and removed
release-12.7.0
Issue or pull request that will be included in release 12.7.0
labels
Oct 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
What is this about?
Following the Wallet Framework team's OKRs for Q3 2024, we want to bring
PreferencesController
up to date with our latest controller patterns.Scenario
No response
Design
No response
Technical Details
No response
Threat Modeling Framework
No response
Acceptance Criteria
controllerName
exists which holds the name of the controller.controllerMetadata
exists which holds the metadata for the state.getDefaultPreferencesControllerState
.PreferencesController
inherits fromBaseController
instead ofEventEmitter
.PreferencesController
constructor signature is updated to take a partialstate
option instead ofinitState
.PreferencesController
constructor is updated tosuper
to the superclass.PreferencesController
usesthis.messagingSystem
to refer to the messenger.PreferencesController
no longer registersPreferencesController:getState
or an initial event payload forPreferencesController:stateChange
(as this is done automatically).PreferencesController
no longer takes or sets anetwork
property.PreferencesController
usesNetworkController:getState
to getnetworkConfigurationsByChainId
instead of taking anetworkConfigurationsByChainId
option.this.state
is used to access state instead ofthis.store.getState
.this.update
is used to update state instead ofthis.store.updateState
.PreferencesControllerState
type exists and represents the current shape of the state object.PreferencesControllerGetStateAction
andPreferencesControllerStateChangeEvent
types exist.PreferencesControllerActions
andPreferencesControllerEvents
types exist.AllowedActions
andAllowedEvents
types exist.PreferencesControllerMessenger
type exists and expectsAccountsController:stateChange
,NetworkController:getState
,AccountsController:getAccountByAddress
,AccountsController:setSelectedAccount
, andAccountsController:setAccountName
to be allowed.PreferencesControllerState
exists and represents the current shape of the state object.preferencesController.state
is used to access state instead ofpreferencesController.store.getState()
.beforeEach
is not corrected, as this would take too long. We can solve this in another PR.Stakeholder review needed before the work gets merged
References
The text was updated successfully, but these errors were encountered: