Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
For #5519: Add telemetry for theme settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare authored and mergify[bot] committed Oct 13, 2021
1 parent 356b93f commit ec65103
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,20 @@ pro_tips:
The tip code of tip being clicked.
Can be one of fresh_look_tip, allow_list_tip, request_desktop_tip.
type: string

preferences:
user_theme:
type: string
description: >
A string that indicates the theme.
Can be one of LIGHT, DARK, or FOLLOW DEVICE.
Default is FOLLOW DEVICE.
bugs:
- https://github.com/mozilla-mobile/focus-android/issues/5519
data_reviews:
- https://github.com/mozilla-mobile/focus-android/pull/5526
data_sensitivity:
- interaction
notification_emails:
- [email protected]
expires: "2022-10-01"
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.mozilla.focus.GleanMetrics.GleanBuildInfo
import org.mozilla.focus.GleanMetrics.LegacyIds
import org.mozilla.focus.GleanMetrics.MozillaProducts
import org.mozilla.focus.GleanMetrics.Pings
import org.mozilla.focus.GleanMetrics.Preferences
import org.mozilla.focus.GleanMetrics.Shortcuts
import org.mozilla.focus.GleanMetrics.TrackingProtection
import org.mozilla.focus.ext.components
Expand Down Expand Up @@ -113,6 +114,25 @@ class GleanMetricsService(context: Context) : MetricsService {
TrackingProtection.hasAnalyticsBlocked.set(settings.hasAnalyticsBlocked())
TrackingProtection.hasContentBlocked.set(settings.hasContentBlocked())
TrackingProtection.hasSocialBlocked.set(settings.hasSocialBlocked())

// theme telemetry
val currentTheme =
when {
settings.lightThemeSelected -> {
"Light"
}
settings.darkThemeSelected -> {
"Dark"
}

settings.useDefaultThemeSelected -> {
"Follow device"
}
else -> ""
}
if (currentTheme.isNotEmpty()) {
Preferences.userTheme.set(currentTheme)
}
}

private fun getDefaultSearchEngineIdentifierForTelemetry(context: Context): String {
Expand Down

0 comments on commit ec65103

Please sign in to comment.