From 7c25a023ad805e5536ae84201df5e60323512b66 Mon Sep 17 00:00:00 2001 From: Jonathan Bursztyn Date: Thu, 27 Jun 2024 23:38:13 +0100 Subject: [PATCH] Sets data marketing to false in case of non-selection --- app/components/UI/OptinMetrics/index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/components/UI/OptinMetrics/index.js b/app/components/UI/OptinMetrics/index.js index ef195031657..004690410e3 100644 --- a/app/components/UI/OptinMetrics/index.js +++ b/app/components/UI/OptinMetrics/index.js @@ -299,8 +299,15 @@ 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(false); + } // if users refuses tracking, get rid of the stored events // and never send them to Segment // and disable analytics @@ -314,11 +321,20 @@ 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(false); + } + // trait indicating if user opts in for data collection for marketing let dataCollectionForMarketingTraits; if (this.props.isDataCollectionForMarketingEnabled) {