You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: SL-312: simplified metric for social login (MetaMask#22469)
<!--
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**
Due to previous implementation to have social login to default enable
metametric collection, it is made the metametric logic more complex and
hard to debug.
This PR is to simplify the implementation
The new metametric will always
- enabled for social login user
- disable for srp user ( user will be prompted meta metricscreen for
consent once wallet is created)
This PR also implement migration from `social login metametric flag`
that is used before to metametric flag so that existing social login
user that updated metamask app will enable metametic flag
Old SRP behavior
metametric flag is persisted after wallet reseted and create new SRP
wallet
New Behaviour
metametric flag will be default to false when user created SRP wallet (
even if enabled before wallet reset)
<!--
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: Social Login user create wallet will always enable
metametric flag
CHANGELOG entry: SRP user create wallet will always disable metametric
flag by default and prompted metametric screen
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/SL-312
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user create new wallet
Given create wallet with social login
Then metametric will be enabled
Scenario: user create new wallet
Given create wallet with SRP wallet
Then metametric will be disabled by default and prompt metamteric screen when wallet created
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
https://github.com/user-attachments/assets/3fefdc27-4ab7-47bf-817b-a5c8b0fc89c3https://github.com/user-attachments/assets/e2e1be10-d8fd-427c-9d83-88cc42e109dc
## **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]
> Replaces social-login-specific metrics toggle with a single
MetaMetrics.enable flow, migrates prior social-login opt-in to standard
opt-in, and updates onboarding, settings, tracing, and tests
accordingly.
>
> - **Analytics/Core**
> - Remove `enableSocialLogin` and related state from `MetaMetrics`;
`isEnabled` now reflects only `enable` state.
> - Update `IMetaMetrics`/hook types and `useMetrics` to expose only
`enable(...)`.
> - Simplify ID retrieval tests and adjust call order expectations.
> - **Onboarding** (`app/components/Views/Onboarding`)
> - Use `metrics.enable(false)` for SRP create/import and
`metrics.enable(true)` after successful OAuth.
> - Align tests to expect `enable(true|false)` calls.
> - **Settings** (`MetaMetricsAndDataCollectionSection`)
> - Replace social-login-specific enabling with `enable(...)` for
toggles; keep marketing sync and traits updates.
> - Update tests to reflect new enable behavior across SRP/social flows.
> - **Tracing** (`util/trace.ts`)
> - Consent check now only reads `METRICS_OPT_IN`; remove social-login
opt-in fallback.
> - **Migration**
> - Add migration `108`: if `METRICS_OPT_IN_SOCIAL_LOGIN === AGREED` and
`METRICS_OPT_IN !== AGREED`, set `METRICS_OPT_IN` to `AGREED` and remove
the social-login key.
> - Register migration and add comprehensive tests.
> - **Tests**
> - Widespread updates removing `enableSocialLogin` mocks/assertions;
add new assertions for `enable(...)` and migration behavior.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
bc4a6aa. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Copy file name to clipboardExpand all lines: app/components/Views/Settings/SecuritySettings/Sections/MetaMetricsAndDataCollectionSection/MetaMetricsAndDataCollectionSection.test.tsx
Copy file name to clipboardExpand all lines: app/components/Views/Settings/SecuritySettings/Sections/MetaMetricsAndDataCollectionSection/MetaMetricsAndDataCollectionSection.tsx
0 commit comments