2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

For #9533 - Switch to using enum for Library Item Selected Telemetry

This commit is contained in:
ekager 2020-03-30 22:42:13 -07:00 committed by Jeff Boek
parent 8d3d030feb
commit fd60270da8
2 changed files with 5 additions and 4 deletions

View File

@ -236,9 +236,10 @@ sealed class Event {
) )
} }
data class LibrarySelectedItem(val item: String) : Event() { data class LibrarySelectedItem(val item: LibraryItem) : Event() {
enum class LibraryItem { BOOKMARKS, HISTORY }
override val extras: Map<Library.selectedItemKeys, String>? override val extras: Map<Library.selectedItemKeys, String>?
get() = mapOf(Library.selectedItemKeys.item to item) get() = mapOf(Library.selectedItemKeys.item to item.name)
} }
data class ErrorPageVisited(val errorType: ErrorType) : Event() { data class ErrorPageVisited(val errorType: ErrorType) : Event() {

View File

@ -41,7 +41,7 @@ class LibraryFragment : Fragment(R.layout.fragment_library) {
libraryHistory.setOnClickListener { libraryHistory.setOnClickListener {
requireComponents.analytics.metrics requireComponents.analytics.metrics
.track(Event.LibrarySelectedItem(view.context.getString(R.string.library_history))) .track(Event.LibrarySelectedItem(Event.LibrarySelectedItem.LibraryItem.HISTORY))
nav( nav(
R.id.libraryFragment, R.id.libraryFragment,
LibraryFragmentDirections.actionLibraryFragmentToHistoryFragment() LibraryFragmentDirections.actionLibraryFragmentToHistoryFragment()
@ -50,7 +50,7 @@ class LibraryFragment : Fragment(R.layout.fragment_library) {
libraryBookmarks.setOnClickListener { libraryBookmarks.setOnClickListener {
requireComponents.analytics.metrics requireComponents.analytics.metrics
.track(Event.LibrarySelectedItem(view.context.getString(R.string.library_bookmarks))) .track(Event.LibrarySelectedItem(Event.LibrarySelectedItem.LibraryItem.BOOKMARKS))
nav( nav(
R.id.libraryFragment, R.id.libraryFragment,
LibraryFragmentDirections.actionLibraryFragmentToBookmarksFragment(BookmarkRoot.Mobile.id) LibraryFragmentDirections.actionLibraryFragmentToBookmarksFragment(BookmarkRoot.Mobile.id)