Disable marketing telemetry until privacy pop window approved in Mozillaonline builds

(cherry picked from commit f7826c41bf)
This commit is contained in:
rxu 2022-07-04 11:13:11 +08:00 committed by Mugurell
parent 95fb1e7395
commit 6904f4ecd5
2 changed files with 10 additions and 7 deletions

View File

@ -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) }

View File

@ -247,9 +247,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(