Skip to content

Commit

Permalink
For mozilla-mobile#21239 improve telemetry values for Allow users to …
Browse files Browse the repository at this point in the history
…customize their home screen
  • Loading branch information
Amejia481 authored and mergify[bot] committed Sep 22, 2021
1 parent 83e3e0b commit c05fbfb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt
Original file line number Diff line number Diff line change
Expand Up @@ -342,23 +342,23 @@ sealed class Event {
val enabled: Boolean,
val context: Context
) : Event() {
private val booleanPreferenceTelemetryAllowList = listOf(
context.getString(R.string.pref_key_enable_top_frecent_sites),
context.getString(R.string.pref_key_recent_tabs),
context.getString(R.string.pref_key_recent_bookmarks),
context.getString(R.string.pref_key_pocket_homescreen_recommendations),
context.getString(R.string.pref_key_history_metadata_feature)
private val telemetryAllowMap = mapOf(
context.getString(R.string.pref_key_enable_top_frecent_sites) to "most_visited_sites",
context.getString(R.string.pref_key_recent_tabs) to "jump_back_in",
context.getString(R.string.pref_key_recent_bookmarks) to "recently_saved",
context.getString(R.string.pref_key_history_metadata_feature) to "recently_visited",
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(
Events.preferenceToggledKeys.preferenceKey to preferenceKey,
Events.preferenceToggledKeys.preferenceKey to (telemetryAllowMap[preferenceKey] ?: ""),
Events.preferenceToggledKeys.enabled to enabled.toString()
)

init {
// If the event is not in the allow list, we don't want to track it
require(booleanPreferenceTelemetryAllowList.contains(preferenceKey))
require(telemetryAllowMap.contains(preferenceKey))
}
}

Expand Down

0 comments on commit c05fbfb

Please sign in to comment.