Skip to content

Commit

Permalink
Sets data marketing to false in case of non-selection
Browse files Browse the repository at this point in the history
  • Loading branch information
jonybur committed Jun 27, 2024
1 parent f2dad68 commit 7c25a02
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/components/UI/OptinMetrics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down

0 comments on commit 7c25a02

Please sign in to comment.