Skip to content

Commit

Permalink
fix: sets data marketing to false in case of non-selection (#10154)
Browse files Browse the repository at this point in the history
<!--
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**

Avoids showing the experience enhancer modal after onboarding.

## **Related issues**

Fixes: MetaMask/MetaMask-planning#2704

## **Manual testing steps**

1. Onboard
2. User should not see experience enhancer after onboarding

## **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**

- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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.
  • Loading branch information
jonybur authored Aug 13, 2024
1 parent 8d6c43c commit ee2a71e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion app/components/UI/OptinMetrics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,18 @@ class OptinMetrics extends PureComponent {
* Callback on press cancel
*/
onCancel = async () => {
const {
isDataCollectionForMarketingEnabled,
setDataCollectionForMarketing,
} = this.props;
setTimeout(async () => {
const { clearOnboardingEvents, metrics } = this.props;
if (
isDataCollectionForMarketingEnabled === null &&
setDataCollectionForMarketing
) {
setDataCollectionForMarketing(false);
}
// if users refuses tracking, get rid of the stored events
// and never send them to Segment
// and disable analytics
Expand All @@ -314,11 +324,23 @@ class OptinMetrics extends PureComponent {
* Callback on press confirm
*/
onConfirm = async () => {
const { events, metrics } = this.props;
const {
events,
metrics,
isDataCollectionForMarketingEnabled,
setDataCollectionForMarketing,
} = this.props;
await metrics.enable();
InteractionManager.runAfterInteractions(async () => {
// add traits to user for identification

if (
isDataCollectionForMarketingEnabled === null &&
setDataCollectionForMarketing
) {
setDataCollectionForMarketing(false);
}

// trait indicating if user opts in for data collection for marketing
let dataCollectionForMarketingTraits;
if (this.props.isDataCollectionForMarketingEnabled) {
Expand Down

0 comments on commit ee2a71e

Please sign in to comment.