Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sets data marketing to false in case of non-selection #10154

Merged
merged 4 commits into from
Aug 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
jonybur marked this conversation as resolved.
Show resolved Hide resolved
}
// 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);
jonybur marked this conversation as resolved.
Show resolved Hide resolved
}

// trait indicating if user opts in for data collection for marketing
let dataCollectionForMarketingTraits;
if (this.props.isDataCollectionForMarketingEnabled) {
Expand Down
Loading