For #21239 improve telemetry values for Allow users to customize their home screen

This commit is contained in:
Arturo Mejia 2021-09-22 09:53:57 -04:00 committed by mergify[bot]
parent 83e3e0b19d
commit c05fbfb6c3

View File

@ -342,23 +342,23 @@ sealed class Event {
val enabled: Boolean, val enabled: Boolean,
val context: Context val context: Context
) : Event() { ) : Event() {
private val booleanPreferenceTelemetryAllowList = listOf( private val telemetryAllowMap = mapOf(
context.getString(R.string.pref_key_enable_top_frecent_sites), context.getString(R.string.pref_key_enable_top_frecent_sites) to "most_visited_sites",
context.getString(R.string.pref_key_recent_tabs), context.getString(R.string.pref_key_recent_tabs) to "jump_back_in",
context.getString(R.string.pref_key_recent_bookmarks), context.getString(R.string.pref_key_recent_bookmarks) to "recently_saved",
context.getString(R.string.pref_key_pocket_homescreen_recommendations), context.getString(R.string.pref_key_history_metadata_feature) to "recently_visited",
context.getString(R.string.pref_key_history_metadata_feature) context.getString(R.string.pref_key_pocket_homescreen_recommendations) to "pocket",
) )
override val extras: Map<Events.preferenceToggledKeys, String>? override val extras: Map<Events.preferenceToggledKeys, String>
get() = mapOf( get() = mapOf(
Events.preferenceToggledKeys.preferenceKey to preferenceKey, Events.preferenceToggledKeys.preferenceKey to (telemetryAllowMap[preferenceKey] ?: ""),
Events.preferenceToggledKeys.enabled to enabled.toString() Events.preferenceToggledKeys.enabled to enabled.toString()
) )
init { init {
// If the event is not in the allow list, we don't want to track it // If the event is not in the allow list, we don't want to track it
require(booleanPreferenceTelemetryAllowList.contains(preferenceKey)) require(telemetryAllowMap.contains(preferenceKey))
} }
} }