Skip to content

Commit c7416ce

Browse files
committed
fix: Add metric trait for privacy mode
1 parent 4752afd commit c7416ce

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

app/scripts/controllers/metametrics-controller.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1453,6 +1453,7 @@ describe('MetaMetricsController', function () {
14531453
participateInMetaMetrics: true,
14541454
currentCurrency: 'usd',
14551455
dataCollectionForMarketing: false,
1456+
preferences: { privacyMode: true },
14561457
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
14571458
custodyAccountDetails: {},
14581459
///: END:ONLY_INCLUDE_IF
@@ -1541,6 +1542,7 @@ describe('MetaMetricsController', function () {
15411542
allNfts: {},
15421543
participateInMetaMetrics: true,
15431544
dataCollectionForMarketing: false,
1545+
preferences: { privacyMode: true },
15441546
securityAlertsEnabled: true,
15451547
names: {
15461548
ethereumAddress: {},
@@ -1604,6 +1606,7 @@ describe('MetaMetricsController', function () {
16041606
allNfts: {},
16051607
participateInMetaMetrics: true,
16061608
dataCollectionForMarketing: false,
1609+
preferences: { privacyMode: true },
16071610
securityAlertsEnabled: true,
16081611
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
16091612
custodyAccountDetails: {},
@@ -1668,6 +1671,7 @@ describe('MetaMetricsController', function () {
16681671
},
16691672
participateInMetaMetrics: true,
16701673
dataCollectionForMarketing: false,
1674+
preferences: { privacyMode: true },
16711675
securityAlertsEnabled: true,
16721676
security_providers: ['blockaid'],
16731677
currentCurrency: 'usd',
@@ -1713,6 +1717,7 @@ describe('MetaMetricsController', function () {
17131717
allNfts: {},
17141718
participateInMetaMetrics: true,
17151719
dataCollectionForMarketing: false,
1720+
preferences: { privacyMode: true },
17161721
names: {
17171722
ethereumAddress: {},
17181723
},

app/scripts/controllers/metametrics-controller.ts

+5
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ export type MetaMaskState = {
164164
security_providers: string[];
165165
addressBook: AddressBookControllerState['addressBook'];
166166
currentCurrency: string;
167+
preferences: {
168+
privacyMode: PreferencesControllerState['preferences']['privacyMode'];
169+
};
167170
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
168171
custodyAccountDetails: {
169172
[address: string]: {
@@ -1228,6 +1231,8 @@ export default class MetaMetricsController extends BaseController<
12281231
metamaskState.dataCollectionForMarketing,
12291232
[MetaMetricsUserTrait.TokenSortPreference]:
12301233
metamaskState.tokenSortConfig?.key || '',
1234+
[MetaMetricsUserTrait.PrivacyModeEnabled]:
1235+
metamaskState.preferences.privacyMode,
12311236
};
12321237

12331238
if (!previousUserTraits) {

shared/constants/metametrics.ts

+4
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,10 @@ export enum MetaMetricsUserTrait {
590590
* Identified when the user changes token sort order on asset-list
591591
*/
592592
TokenSortPreference = 'token_sort_preference',
593+
/**
594+
* Identifies if the Privacy Mode is enabled
595+
*/
596+
PrivacyModeEnabled = 'privacy_mode_toggle',
593597
}
594598

595599
/**

0 commit comments

Comments
 (0)