From 83f6b9352cd674f5687f8f5728ca3d21563c2019 Mon Sep 17 00:00:00 2001 From: Roger Yang Date: Wed, 7 Sep 2022 12:55:49 -0400 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/26502: Add time group and private extras in history telemetry --- mobile/android/fenix/app/metrics.yaml | 52 ++++++---------------- .../fenix/library/history/HistoryFragment.kt | 18 +++++--- 2 files changed, 25 insertions(+), 45 deletions(-) diff --git a/mobile/android/fenix/app/metrics.yaml b/mobile/android/fenix/app/metrics.yaml index c39544eb5f16..aafc5ebd5b66 100644 --- a/mobile/android/fenix/app/metrics.yaml +++ b/mobile/android/fenix/app/metrics.yaml @@ -3238,37 +3238,30 @@ history: type: boolean description: | True if the history item is synced from other devices otherwise false. + time_group: + type: string + description: | + What time group does the history item belongs to. + Possible values: [Today], [Yesterday], [ThisWeek], [ThisMonth], + [Older]. + is_private: + type: boolean + description: | + True if the history item is opened in a private tab, otherwise false. bugs: - https://github.com/mozilla-mobile/fenix/issues/18178 + - https://github.com/mozilla-mobile/fenix/issues/26502 data_reviews: - https://github.com/mozilla-mobile/fenix/pull/18261 - https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789 - https://github.com/mozilla-mobile/fenix/pull/21038#issuecomment-906757301 - https://github.com/mozilla-mobile/fenix/pull/26503#issuecomment-1219761407 + - https://github.com/mozilla-mobile/fenix/pull/26863 data_sensitivity: - interaction notification_emails: - android-probes@mozilla.com - - mavduevskiy@mozilla.com - expires: never - metadata: - tags: - - History - opened_item_in_new_tab: - type: event - description: | - A user opened a history item in a new tab - bugs: - - https://github.com/mozilla-mobile/fenix/issues/18178 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/18261 - - https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789 - - https://github.com/mozilla-mobile/fenix/pull/21038#issuecomment-906757301 - data_sensitivity: - - interaction - notification_emails: - - android-probes@mozilla.com - - erichards@mozilla.com + - royang@mozilla.com expires: never metadata: tags: @@ -3293,25 +3286,6 @@ history: metadata: tags: - History - opened_item_in_private_tab: - type: event - description: | - A user opened a history item in a private tab - bugs: - - https://github.com/mozilla-mobile/fenix/issues/18178 - data_reviews: - - https://github.com/mozilla-mobile/fenix/pull/18261 - - https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789 - - https://github.com/mozilla-mobile/fenix/pull/21038#issuecomment-906757301 - data_sensitivity: - - interaction - notification_emails: - - android-probes@mozilla.com - - erichards@mozilla.com - expires: never - metadata: - tags: - - History opened_items_in_private_tabs: type: event description: | diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragment.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragment.kt index e3107fe025eb..6365b868d4e8 100644 --- a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragment.kt +++ b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragment.kt @@ -333,25 +333,31 @@ class HistoryFragment : LibraryPageFragment(), UserInteractionHandler { } private fun openItem(item: History.Regular) { - GleanHistory.openedItem.record(GleanHistory.OpenedItemExtra(item.isRemote)) + GleanHistory.openedItem.record( + GleanHistory.OpenedItemExtra( + isRemote = item.isRemote, + timeGroup = item.historyTimeGroup.toString(), + isPrivate = (activity as HomeActivity).browsingModeManager.mode == BrowsingMode.Private, + ), + ) (activity as HomeActivity).openToBrowserAndLoad( searchTermOrURL = item.url, newTab = true, - from = BrowserDirection.FromHistory + from = BrowserDirection.FromHistory, ) } private fun displayDeleteTimeRange() { DeleteConfirmationDialogFragment( - historyInteractor = historyInteractor + historyInteractor = historyInteractor, ).show(childFragmentManager, null) } private fun share(data: List) { GleanHistory.shared.record(NoExtras()) val directions = HistoryFragmentDirections.actionGlobalShareFragment( - data = data.toTypedArray() + data = data.toTypedArray(), ) navigateToHistoryFragment(directions) } @@ -359,7 +365,7 @@ class HistoryFragment : LibraryPageFragment(), UserInteractionHandler { private fun navigateToHistoryFragment(directions: NavDirections) { findNavController().nav( R.id.historyFragment, - directions + directions, ) } @@ -371,7 +377,7 @@ class HistoryFragment : LibraryPageFragment(), UserInteractionHandler { } internal class DeleteConfirmationDialogFragment( - private val historyInteractor: HistoryInteractor + private val historyInteractor: HistoryInteractor, ) : DialogFragment() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog = AlertDialog.Builder(requireContext()).apply { -- 2.11.4.GIT