Skip to content

Commit 39f6bfa

Browse files
committed
feat(identity): link metametrics event library and replace magic strings
1 parent 801b4c6 commit 39f6bfa

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

app/core/Engine/Engine.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ import { SignatureControllerInit } from './controllers/signature-controller';
204204
import { GasFeeControllerInit } from './controllers/gas-fee-controller';
205205
import I18n from '../../../locales/i18n';
206206
import { Platform } from '@metamask/profile-sync-controller/sdk';
207+
import { MetaMetrics as BackupAndSyncMetaMetrics } from '@metamask/profile-sync-controller';
207208
import { isProductSafetyDappScanningEnabled } from '../../util/phishingDetection';
208209
import { appMetadataControllerInit } from './controllers/app-metadata-controller';
209210
import { InternalAccount } from '@metamask/keyring-internal-api';
@@ -1026,11 +1027,11 @@ export class Engine {
10261027
MetricsEventBuilder.createEventBuilder(
10271028
MetaMetricsEvents.PROFILE_ACTIVITY_UPDATED,
10281029
)
1029-
.addProperties({
1030-
profile_id: profileId,
1031-
feature_name: 'Contacts Sync',
1032-
action: 'Contacts Sync Contact Updated',
1033-
})
1030+
.addProperties(
1031+
BackupAndSyncMetaMetrics.BackupAndSyncEventProperties.CONTACT_UPDATED(
1032+
profileId,
1033+
),
1034+
)
10341035
.build(),
10351036
);
10361037
},
@@ -1039,11 +1040,11 @@ export class Engine {
10391040
MetricsEventBuilder.createEventBuilder(
10401041
MetaMetricsEvents.PROFILE_ACTIVITY_UPDATED,
10411042
)
1042-
.addProperties({
1043-
profile_id: profileId,
1044-
feature_name: 'Contacts Sync',
1045-
action: 'Contacts Sync Contact Deleted',
1046-
})
1043+
.addProperties(
1044+
BackupAndSyncMetaMetrics.BackupAndSyncEventProperties.CONTACT_DELETED(
1045+
profileId,
1046+
),
1047+
)
10471048
.build(),
10481049
);
10491050
},
@@ -1052,12 +1053,12 @@ export class Engine {
10521053
MetricsEventBuilder.createEventBuilder(
10531054
MetaMetricsEvents.PROFILE_ACTIVITY_UPDATED,
10541055
)
1055-
.addProperties({
1056-
profile_id: profileId,
1057-
feature_name: 'Contacts Sync',
1058-
action: 'Contacts Sync Erroneous Situation',
1059-
additional_description: situationMessage,
1060-
})
1056+
.addProperties(
1057+
BackupAndSyncMetaMetrics.BackupAndSyncEventProperties.CONTACT_SYNC_ERROR(
1058+
profileId,
1059+
situationMessage,
1060+
),
1061+
)
10611062
.build(),
10621063
);
10631064
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
"@metamask/post-message-stream": "^10.0.0",
219219
"@metamask/ppom-validator": "0.36.0",
220220
"@metamask/preferences-controller": "^18.2.0",
221-
"@metamask/profile-sync-controller": "^18.0.0",
221+
"@metamask/profile-sync-controller": "npm:@metamask-previews/profile-sync-controller@19.0.0-preview-f9a5dd05",
222222
"@metamask/react-native-actionsheet": "2.4.2",
223223
"@metamask/react-native-button": "^3.0.0",
224224
"@metamask/react-native-payments": "^2.0.0",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5699,10 +5699,10 @@
56995699
"@metamask/base-controller" "^8.0.1"
57005700
"@metamask/controller-utils" "^11.10.0"
57015701

5702-
"@metamask/profile-sync-controller@^18.0.0":
5703-
version "18.0.0"
5704-
resolved "https://registry.yarnpkg.com/@metamask/profile-sync-controller/-/profile-sync-controller-18.0.0.tgz#659faf9990296271d4a7fd12b56d49ce640c2067"
5705-
integrity sha512-ClO1h8BNv1Cf2jlRCJb/PeLf+kMJUnw5jMni6lqNcuAmzcr9NKPEF2v2lyz83+MeCR+jNgRhLFQaGCrji4i+DA==
5702+
"@metamask/profile-sync-controller@npm:@metamask-previews/profile-sync-controller@19.0.0-preview-f9a5dd05":
5703+
version "19.0.0-preview-f9a5dd05"
5704+
resolved "https://registry.yarnpkg.com/@metamask-previews/profile-sync-controller/-/profile-sync-controller-19.0.0-preview-f9a5dd05.tgz#676ba6722afeaf46d6b012781516df566867fa41"
5705+
integrity sha512-F+RqMAyS6oLb1yw27REWWLNfYBsm2Eq/ET9xN0NFzSgXzNYgiXC8xpkDjlRo6xlv+8mTLjZtjaLGBXo8IaBF8g==
57065706
dependencies:
57075707
"@metamask/base-controller" "^8.0.1"
57085708
"@metamask/snaps-sdk" "^7.1.0"

0 commit comments

Comments
 (0)