From 84ddaab605d93441abeed6b586248709b0f36407 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 4 Jul 2022 11:13:11 +0800 Subject: [PATCH] [fenix] Disable marketing telemetry until privacy pop window approved in Mozillaonline builds --- .../home/mozonline/PrivacyContentDisplayHelper.kt | 13 ++++++++----- .../main/java/org/mozilla/fenix/utils/Settings.kt | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/home/mozonline/PrivacyContentDisplayHelper.kt b/app/src/main/java/org/mozilla/fenix/home/mozonline/PrivacyContentDisplayHelper.kt index 53fa587356..a8f665ea53 100644 --- a/app/src/main/java/org/mozilla/fenix/home/mozonline/PrivacyContentDisplayHelper.kt +++ b/app/src/main/java/org/mozilla/fenix/home/mozonline/PrivacyContentDisplayHelper.kt @@ -12,6 +12,8 @@ import android.text.method.LinkMovementMethod import android.widget.TextView import androidx.appcompat.app.AlertDialog import org.mozilla.fenix.R +import org.mozilla.fenix.components.metrics.MetricServiceType +import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.settings import kotlin.system.exitProcess @@ -44,11 +46,12 @@ fun showPrivacyPopWindow(context: Context, activity: Activity) { // Users can only use fenix after they agree with the privacy notice val builder = AlertDialog.Builder(activity) .setPositiveButton( - context.getString(R.string.privacy_notice_positive_button), - { _, _ -> - context.settings().shouldShowPrivacyPopWindow = false - } - ) + context.getString(R.string.privacy_notice_positive_button) + ) { _, _ -> + context.settings().shouldShowPrivacyPopWindow = false + context.settings().isMarketingTelemetryEnabled = true + context.components.analytics.metrics.start(MetricServiceType.Marketing) + } .setNeutralButton( context.getString(R.string.privacy_notice_neutral_button_2), { _, _ -> exitProcess(0) } diff --git a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt index 6f69b6df47..4a330cb6b4 100644 --- a/app/src/main/java/org/mozilla/fenix/utils/Settings.kt +++ b/app/src/main/java/org/mozilla/fenix/utils/Settings.kt @@ -248,9 +248,9 @@ class Settings(private val appContext: Context) : PreferencesHolder { default = true ) - val isMarketingTelemetryEnabled by booleanPreference( + var isMarketingTelemetryEnabled by booleanPreference( appContext.getPreferenceKey(R.string.pref_key_marketing_telemetry), - default = true + default = !Config.channel.isMozillaOnline ) var isExperimentationEnabled by booleanPreference(