From c4b18eddea8503dca11b2d745f353de7d9459fa8 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Mon, 18 Dec 2023 23:20:26 +0530 Subject: [PATCH] fix: metrics event not fired when blockaid is disabled (#8088) --- .../BlockaidIndicator/BlockaidIndicator.tsx | 2 +- .../Views/Settings/ExperimentalSettings/index.tsx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/components/Views/Settings/ExperimentalSettings/BlockaidIndicator/BlockaidIndicator.tsx b/app/components/Views/Settings/ExperimentalSettings/BlockaidIndicator/BlockaidIndicator.tsx index acd4b071211..d78662556c3 100644 --- a/app/components/Views/Settings/ExperimentalSettings/BlockaidIndicator/BlockaidIndicator.tsx +++ b/app/components/Views/Settings/ExperimentalSettings/BlockaidIndicator/BlockaidIndicator.tsx @@ -69,7 +69,7 @@ const BlockaidIndicator = ({ navigation }: Props) => { AnalyticsV2.trackEvent( MetaMetricsEvents.SETTINGS_EXPERIMENTAL_SECURITY_ALERTS_ENABLED, { - security_alerts_enabled: !securityAlertsEnabled, + security_alerts_enabled: true, }, ); }); diff --git a/app/components/Views/Settings/ExperimentalSettings/index.tsx b/app/components/Views/Settings/ExperimentalSettings/index.tsx index 9828ec7f5c1..fa5d6e6690e 100644 --- a/app/components/Views/Settings/ExperimentalSettings/index.tsx +++ b/app/components/Views/Settings/ExperimentalSettings/index.tsx @@ -8,6 +8,8 @@ import Text, { TextVariant, TextColor, } from '../../../../component-library/components/Texts/Text'; +import AnalyticsV2 from '../../../../util/analyticsV2'; +import { MetaMetricsEvents } from '../../../../core/Analytics'; import { getNavigationOptionsTitle } from '../../../UI/Navbar'; import StyledButton from '../../../UI/StyledButton'; import SECURITY_ALERTS_TOGGLE_TEST_ID from './constants'; @@ -39,6 +41,12 @@ const ExperimentalSettings = ({ navigation, route }: Props) => { ppomInitializationCompleted: false, }); PreferencesController?.setSecurityAlertsEnabled(!securityAlertsEnabled); + AnalyticsV2.trackEvent( + MetaMetricsEvents.SETTINGS_EXPERIMENTAL_SECURITY_ALERTS_ENABLED, + { + security_alerts_enabled: false, + }, + ); } else { navigation.navigate(Routes.MODAL.ROOT_MODAL_FLOW, { screen: Routes.SHEET.BLOCKAID_INDICATOR,