mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Issue #19956: Add telemetry for tab view setting changes
This differs from `tab_view_setting` which tells us what the user's tab setting is at startup. It does not tell us if the user explicitly changed it instead of just using the default (which was recently changed in #19809).
This commit is contained in:
parent
01555c2bea
commit
31081073e9
@ -389,6 +389,26 @@ events:
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: "2021-12-10"
|
||||
tab_view_changed:
|
||||
type: event
|
||||
description: |
|
||||
Indicates that the user has changed their tab view
|
||||
settings, either from the default or by personal
|
||||
preference.
|
||||
extra_keys:
|
||||
type:
|
||||
description: |
|
||||
A string containing the name of the tab view the user tapped.
|
||||
These items include: list or grid.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/19956
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/19959#issuecomment-882539619
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
expires: "2022-05-10"
|
||||
|
||||
onboarding:
|
||||
fxa_auto_signin:
|
||||
|
@ -605,6 +605,13 @@ sealed class Event {
|
||||
get() = mapOf(Autoplay.settingChangedKeys.autoplaySetting to setting.toString().lowercase(Locale.ROOT))
|
||||
}
|
||||
|
||||
data class TabViewSettingChanged(val type: Type) : Event() {
|
||||
enum class Type { LIST, GRID }
|
||||
|
||||
override val extras: Map<Events.tabViewChangedKeys, String>?
|
||||
get() = mapOf(Events.tabViewChangedKeys.type to type.toString().lowercase(Locale.ROOT))
|
||||
}
|
||||
|
||||
sealed class Search
|
||||
|
||||
internal open val extras: Map<*, String>?
|
||||
|
@ -827,6 +827,10 @@ private val Event.wrapper: EventWrapper<*>?
|
||||
is Event.HomeScreenDisplayed -> EventWrapper<NoExtraKeys>(
|
||||
{ HomeScreen.homeScreenDisplayed.record(it) }
|
||||
)
|
||||
is Event.TabViewSettingChanged -> EventWrapper(
|
||||
{ Events.tabViewChanged.record(it) },
|
||||
{ Events.tabViewChangedKeys.valueOf(it) }
|
||||
)
|
||||
|
||||
is Event.BrowserToolbarHomeButtonClicked -> EventWrapper<NoExtraKeys>(
|
||||
{ Events.browserToolbarHomeTapped.record(it) }
|
||||
|
@ -32,6 +32,9 @@ open class RadioButtonPreference @JvmOverloads constructor(
|
||||
private var defaultValue: Boolean = false
|
||||
private var clickListener: (() -> Unit)? = null
|
||||
|
||||
val isChecked: Boolean
|
||||
get() = radioButton?.isChecked == true
|
||||
|
||||
init {
|
||||
layoutResource = R.layout.preference_widget_radiobutton
|
||||
|
||||
|
@ -11,6 +11,8 @@ import androidx.preference.PreferenceFragmentCompat
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.components.metrics.Event.TabViewSettingChanged
|
||||
import org.mozilla.fenix.components.metrics.Event.TabViewSettingChanged.Type
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.showToolbar
|
||||
import org.mozilla.fenix.utils.view.addToRadioGroup
|
||||
@ -66,6 +68,9 @@ class TabsSettingsFragment : PreferenceFragmentCompat() {
|
||||
requirePreference<PreferenceCategory>(R.string.pref_key_start_on_home_category).isVisible =
|
||||
FeatureFlags.showStartOnHomeSettings
|
||||
|
||||
listRadioButton.onClickListener(::sendTabViewTelemetry)
|
||||
gridRadioButton.onClickListener(::sendTabViewTelemetry)
|
||||
|
||||
setupRadioGroups()
|
||||
}
|
||||
|
||||
@ -88,4 +93,14 @@ class TabsSettingsFragment : PreferenceFragmentCompat() {
|
||||
startOnHomeRadioNever
|
||||
)
|
||||
}
|
||||
|
||||
private fun sendTabViewTelemetry() {
|
||||
val metrics = requireContext().components.analytics.metrics
|
||||
|
||||
if (listRadioButton.isChecked && !gridRadioButton.isChecked) {
|
||||
metrics.track(TabViewSettingChanged(Type.LIST))
|
||||
} else {
|
||||
metrics.track(TabViewSettingChanged(Type.GRID))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user