1
0
Fork 0

For #6396 - Added metrics for tracking history/bookmarks account sync toggles (#6601)

master
Mihai Branescu 2019-11-27 11:16:23 +02:00 committed by GitHub
parent cc216d0a6f
commit 7cf71c8ef3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 5 deletions

View File

@ -114,7 +114,7 @@ events:
description: "The preference key for the boolean (true/false) preference the user toggled. We currently track: description: "The preference key for the boolean (true/false) preference the user toggled. We currently track:
show_search_suggestions, remote_debugging, telemetry, tracking_protection, search_bookmarks, show_search_suggestions, remote_debugging, telemetry, tracking_protection, search_bookmarks,
search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, open_links_in_a_private_tab, search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, open_links_in_a_private_tab,
and pref_key_sync_logins" pref_key_sync_logins, pref_key_sync_bookmarks and pref_key_sync_history"
enabled: enabled:
description: "Whether or not the preference is *now* enabled" description: "Whether or not the preference is *now* enabled"
bugs: bugs:
@ -122,12 +122,14 @@ events:
- https://github.com/mozilla-mobile/fenix/issues/5094 - https://github.com/mozilla-mobile/fenix/issues/5094
- https://github.com/mozilla-mobile/fenix/issues/5737 - https://github.com/mozilla-mobile/fenix/issues/5737
- https://github.com/mozilla-mobile/fenix/issues/5586 - https://github.com/mozilla-mobile/fenix/issues/5586
- https://github.com/mozilla-mobile/fenix/issues/6396
data_reviews: data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/1896 - https://github.com/mozilla-mobile/fenix/pull/1896
- https://github.com/mozilla-mobile/fenix/pull/5704 - https://github.com/mozilla-mobile/fenix/pull/5704
- https://github.com/mozilla-mobile/fenix/pull/5886 - https://github.com/mozilla-mobile/fenix/pull/5886
- https://github.com/mozilla-mobile/fenix/pull/5975 - https://github.com/mozilla-mobile/fenix/pull/5975
- https://github.com/mozilla-mobile/fenix/pull/6352 - https://github.com/mozilla-mobile/fenix/pull/6352
- https://github.com/mozilla-mobile/fenix/pull/6601
notification_emails: notification_emails:
- fenix-core@mozilla.com - fenix-core@mozilla.com
expires: "2020-03-01" expires: "2020-03-01"

View File

@ -151,7 +151,9 @@ sealed class Event {
context.getString(R.string.pref_key_show_clipboard_suggestions), context.getString(R.string.pref_key_show_clipboard_suggestions),
context.getString(R.string.pref_key_show_search_shortcuts), context.getString(R.string.pref_key_show_search_shortcuts),
context.getString(R.string.pref_key_open_links_in_a_private_tab), context.getString(R.string.pref_key_open_links_in_a_private_tab),
context.getString(R.string.pref_key_sync_logins) context.getString(R.string.pref_key_sync_logins),
context.getString(R.string.pref_key_sync_bookmarks),
context.getString(R.string.pref_key_sync_history)
) )
override val extras: Map<Events.preferenceToggledKeys, String>? override val extras: Map<Events.preferenceToggledKeys, String>?

View File

@ -166,7 +166,12 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
val historyNameKey = getPreferenceKey(R.string.pref_key_sync_history) val historyNameKey = getPreferenceKey(R.string.pref_key_sync_history)
findPreference<CheckBoxPreference>(historyNameKey)?.apply { findPreference<CheckBoxPreference>(historyNameKey)?.apply {
setOnPreferenceChangeListener { _, newValue -> setOnPreferenceChangeListener { _, newValue ->
SyncEnginesStorage(context).setStatus(SyncEngine.History, newValue as Boolean) requireComponents.analytics.metrics.track(Event.PreferenceToggled(
preferenceKey = historyNameKey,
enabled = newValue as Boolean,
context = context
))
SyncEnginesStorage(context).setStatus(SyncEngine.History, newValue)
@Suppress("DeferredResultUnused") @Suppress("DeferredResultUnused")
context.components.backgroundServices.accountManager.syncNowAsync(SyncReason.EngineChange) context.components.backgroundServices.accountManager.syncNowAsync(SyncReason.EngineChange)
true true
@ -176,7 +181,12 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
val bookmarksNameKey = getPreferenceKey(R.string.pref_key_sync_bookmarks) val bookmarksNameKey = getPreferenceKey(R.string.pref_key_sync_bookmarks)
findPreference<CheckBoxPreference>(bookmarksNameKey)?.apply { findPreference<CheckBoxPreference>(bookmarksNameKey)?.apply {
setOnPreferenceChangeListener { _, newValue -> setOnPreferenceChangeListener { _, newValue ->
SyncEnginesStorage(context).setStatus(SyncEngine.Bookmarks, newValue as Boolean) requireComponents.analytics.metrics.track(Event.PreferenceToggled(
preferenceKey = bookmarksNameKey,
enabled = newValue as Boolean,
context = context
))
SyncEnginesStorage(context).setStatus(SyncEngine.Bookmarks, newValue)
@Suppress("DeferredResultUnused") @Suppress("DeferredResultUnused")
context.components.backgroundServices.accountManager.syncNowAsync(SyncReason.EngineChange) context.components.backgroundServices.accountManager.syncNowAsync(SyncReason.EngineChange)
true true

File diff suppressed because one or more lines are too long