mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
For #7289: Adds telemetry for selecting dark theme
This commit is contained in:
parent
321251c49c
commit
0a76fdaa58
@ -1760,3 +1760,19 @@ about_page:
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
||||
app_theme:
|
||||
dark_theme_selected:
|
||||
type: event
|
||||
description: >
|
||||
A user selected Dark Theme
|
||||
extra_keys:
|
||||
source:
|
||||
description: "The source from where dark theme was selected. The source can be 'SETTINGS' or 'ONBOARDING'"
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/7289
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/7968
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
@ -12,6 +12,7 @@ import mozilla.components.service.glean.Glean
|
||||
import mozilla.components.service.glean.private.NoExtraKeys
|
||||
import mozilla.components.support.base.log.logger.Logger
|
||||
import org.mozilla.fenix.GleanMetrics.AboutPage
|
||||
import org.mozilla.fenix.GleanMetrics.AppTheme
|
||||
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
|
||||
import org.mozilla.fenix.GleanMetrics.Collections
|
||||
import org.mozilla.fenix.GleanMetrics.ContextMenu
|
||||
@ -482,6 +483,10 @@ private val Event.wrapper: EventWrapper<*>?
|
||||
is Event.LibrariesThatWeUseTapped -> EventWrapper<NoExtraKeys>(
|
||||
{ AboutPage.librariesTapped.record(it) }
|
||||
)
|
||||
is Event.DarkThemeSelected -> EventWrapper(
|
||||
{ AppTheme.darkThemeSelected.record(it) },
|
||||
{ AppTheme.darkThemeSelectedKeys.valueOf(it) }
|
||||
)
|
||||
// Don't record other events in Glean:
|
||||
is Event.AddBookmark -> null
|
||||
is Event.OpenedBookmark -> null
|
||||
|
@ -20,6 +20,7 @@ import mozilla.components.support.base.facts.FactProcessor
|
||||
import mozilla.components.support.base.facts.Facts
|
||||
import mozilla.components.support.base.log.logger.Logger
|
||||
import org.mozilla.fenix.BuildConfig
|
||||
import org.mozilla.fenix.GleanMetrics.AppTheme
|
||||
import org.mozilla.fenix.GleanMetrics.Collections
|
||||
import org.mozilla.fenix.GleanMetrics.ContextMenu
|
||||
import org.mozilla.fenix.GleanMetrics.CrashReporter
|
||||
@ -316,6 +317,12 @@ sealed class Event {
|
||||
get() = mapOf(SearchShortcuts.selectedKeys.engine to engineName)
|
||||
}
|
||||
|
||||
data class DarkThemeSelected(val source: Source) : Event() {
|
||||
enum class Source { SETTINGS, ONBOARDING }
|
||||
override val extras: Map<AppTheme.darkThemeSelectedKeys, String>?
|
||||
get() = mapOf(AppTheme.darkThemeSelectedKeys.source to source.name)
|
||||
}
|
||||
|
||||
class ContextMenuItemTapped private constructor(val item: String) : Event() {
|
||||
override val extras: Map<ContextMenu.itemTappedKeys, String>?
|
||||
get() = mapOf(ContextMenu.itemTappedKeys.named to item)
|
||||
|
@ -11,6 +11,7 @@ import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kotlinx.android.synthetic.main.onboarding_theme_picker.view.*
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.settings
|
||||
|
||||
@ -57,6 +58,11 @@ class OnboardingThemePickerViewHolder(view: View) : RecyclerView.ViewHolder(view
|
||||
}
|
||||
|
||||
radioDarkTheme.onClickListener {
|
||||
view.context.components.analytics.metrics.track(
|
||||
Event.DarkThemeSelected(
|
||||
Event.DarkThemeSelected.Source.ONBOARDING
|
||||
)
|
||||
)
|
||||
setNewTheme(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,8 @@ import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.getPreferenceKey
|
||||
import org.mozilla.fenix.ext.requireComponents
|
||||
import org.mozilla.fenix.ext.showToolbar
|
||||
@ -81,6 +83,11 @@ class ThemeFragment : PreferenceFragmentCompat() {
|
||||
val keyDarkTheme = getPreferenceKey(R.string.pref_key_dark_theme)
|
||||
radioDarkTheme = requireNotNull(findPreference(keyDarkTheme))
|
||||
radioDarkTheme.onClickListener {
|
||||
requireContext().components.analytics.metrics.track(
|
||||
Event.DarkThemeSelected(
|
||||
Event.DarkThemeSelected.Source.SETTINGS
|
||||
)
|
||||
)
|
||||
setNewTheme(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ The following metrics are added to the ping:
|
||||
| about_page.privacy_notice_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on "Privacy notice" item from About page |[1](https://github.com/mozilla-mobile/fenix/pull/8047)||2020-09-01 |
|
||||
| about_page.rights_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on "Know your rights" item from About page |[1](https://github.com/mozilla-mobile/fenix/pull/8047)||2020-09-01 |
|
||||
| about_page.support_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on "Support" item from About page |[1](https://github.com/mozilla-mobile/fenix/pull/8047)||2020-09-01 |
|
||||
| app_theme.dark_theme_selected |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user selected Dark Theme |[1](https://github.com/mozilla-mobile/fenix/pull/7968)|<ul><li>source: The source from where dark theme was selected. The source can be 'SETTINGS' or 'ONBOARDING'</li></ul>|2020-09-01 |
|
||||
| bookmarks_management.copied |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user copied a bookmark. |[1](https://github.com/mozilla-mobile/fenix/pull/1708)||2020-09-01 |
|
||||
| bookmarks_management.edited |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user edited the title and/or URL of an existing bookmark. |[1](https://github.com/mozilla-mobile/fenix/pull/1708)||2020-09-01 |
|
||||
| bookmarks_management.folder_add |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user added a new bookmark folder. |[1](https://github.com/mozilla-mobile/fenix/pull/1708)||2020-09-01 |
|
||||
|
Loading…
Reference in New Issue
Block a user