Skip to content

Commit

Permalink
Fixes mozilla-mobile#2496 - Collect Telemetry for Light / Dark Mode T…
Browse files Browse the repository at this point in the history
…heme Settings (mozilla-mobile#2621)

* Fixes mozilla-mobile#2496 - Collect Telemetry for Light / Dark Mode Theme Settings

* Fixes mozilla-mobile#2496 - Collect Telemetry for Light / Dark Mode Theme Settings

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
st3fan and mergify[bot] committed Oct 18, 2021
1 parent 4ad4e0b commit 1a5ae3f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions focus-ios/Blockzilla/AppDelegate.swift
Expand Up @@ -424,6 +424,7 @@ extension AppDelegate {
GleanMetrics.TrackingProtection.hasContentBlocked.set(Settings.getToggle(.blockOther))
GleanMetrics.TrackingProtection.hasSocialBlocked.set(Settings.getToggle(.blockSocial))
GleanMetrics.MozillaProducts.hasFirefoxInstalled.set(UIApplication.shared.canOpenURL(URL(string: "firefox://")!))
GleanMetrics.Preferences.userTheme.set(UserDefaults.standard.theme.telemetryValue)
}

func setupExperimentation() {
Expand Down
14 changes: 13 additions & 1 deletion focus-ios/Blockzilla/Theme/Theme.swift
Expand Up @@ -23,6 +23,19 @@ extension Theme {
}
}

extension Theme {
var telemetryValue: String {
switch self {
case .device:
return "Follow device"
case .light:
return "Light"
case .dark:
return "Dark"
}
}
}

extension UserDefaults {
var theme: Theme {
get {
Expand All @@ -34,4 +47,3 @@ extension UserDefaults {
}
}
}

17 changes: 17 additions & 0 deletions focus-ios/Blockzilla/metrics.yaml
Expand Up @@ -252,3 +252,20 @@ shortcuts:
labels:
- removed_from_browser_menu
- removed_from_home_screen

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-ios/issues/2496
data_reviews:
- https://github.com/mozilla-mobile/focus-ios/pull/2621
data_sensitivity:
- interaction
notification_emails:
- focus-ios-data-stewards@mozilla.com
expires: "2022-10-01"

0 comments on commit 1a5ae3f

Please sign in to comment.