Skip to content

Commit

Permalink
For mozilla-mobile#16827: Add copy url from long press metrics.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare committed Dec 8, 2020
1 parent 5a95a81 commit f831c79
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ sealed class Event {

object TabSettingsOpened : Event()

object CopyUrlUsed : Event()

// Interaction events with extras

data class TopSiteSwipeCarousel(val page: Int) : Event() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,12 @@ private val Event.wrapper: EventWrapper<*>?
{ Tabs.settingOpened.record(it) }
)

Event.CopyUrlUsed -> EventWrapper<NoExtraKeys>(
{ Metrics.copyUrlUsedCount.add(1) }
).also {
Metrics.hasUsedUrlCopy.set(true)
}

// Don't record other events in Glean:
is Event.AddBookmark -> null
is Event.OpenedBookmark -> null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import mozilla.components.browser.state.selector.selectedTab
import mozilla.components.browser.state.store.BrowserStore
import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import java.lang.ref.WeakReference

Expand Down Expand Up @@ -74,6 +75,7 @@ object ToolbarPopupWindow {
.setText(context.getString(R.string.browser_toolbar_url_copied_to_clipboard_snackbar))
.show()
}
context.components.analytics.metrics.track(Event.CopyUrlUsed)
}

customView.paste.setOnClickListener {
Expand Down

0 comments on commit f831c79

Please sign in to comment.