1
0
Fork 0

For #5583 - Adds telemetry for download notification (#6554)

master
Gabriel Luong 2019-11-11 18:38:06 -05:00 committed by Gabriel
parent 5eb5cdf361
commit c6562bff98
5 changed files with 136 additions and 15 deletions

View File

@ -1543,3 +1543,82 @@ experiments.metrics:
notification_emails: notification_emails:
- mcooper@mozilla.com - mcooper@mozilla.com
expires: 2019-11-01 expires: 2019-11-01
download_notification:
resume:
type: event
description: >
A user resumed a download in the download notification
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5583
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6554
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
pause:
type: event
description: >
A user paused a download in the download notification
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5583
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6554
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
cancel:
type: event
description: >
A user cancelled a download in the download notification
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5583
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6554
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
try_again:
type: event
description: >
A user tapped on try again when a download fails in the download notification
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5583
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6554
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
open:
type: event
description: >
A user opened a downloaded file in the download notification
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5583
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6554
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
in_app_open:
type: event
description: >
A user opened a downloaded file in the in-app notification link
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5583
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6554
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
in_app_try_again:
type: event
description: >
A user tapped on try again when a download fails in the in-app notification link
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5583
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6554
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"

View File

@ -19,6 +19,7 @@ import org.mozilla.fenix.GleanMetrics.Collections
import org.mozilla.fenix.GleanMetrics.ContextMenu import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.CrashReporter import org.mozilla.fenix.GleanMetrics.CrashReporter
import org.mozilla.fenix.GleanMetrics.CustomTab import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.DownloadNotification
import org.mozilla.fenix.GleanMetrics.ErrorPage import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.FindInPage import org.mozilla.fenix.GleanMetrics.FindInPage
@ -382,6 +383,27 @@ private val Event.wrapper: EventWrapper<*>?
is Event.MediaStopState -> EventWrapper<NoExtraKeys>( is Event.MediaStopState -> EventWrapper<NoExtraKeys>(
{ MediaState.stop.record(it) } { MediaState.stop.record(it) }
) )
is Event.InAppNotificationDownloadOpen -> EventWrapper<NoExtraKeys>(
{ DownloadNotification.inAppOpen.record(it) }
)
is Event.InAppNotificationDownloadTryAgain -> EventWrapper<NoExtraKeys>(
{ DownloadNotification.inAppTryAgain.record(it) }
)
is Event.NotificationDownloadCancel -> EventWrapper<NoExtraKeys>(
{ DownloadNotification.cancel.record(it) }
)
is Event.NotificationDownloadOpen -> EventWrapper<NoExtraKeys>(
{ DownloadNotification.open.record(it) }
)
is Event.NotificationDownloadPause -> EventWrapper<NoExtraKeys>(
{ DownloadNotification.pause.record(it) }
)
is Event.NotificationDownloadResume -> EventWrapper<NoExtraKeys>(
{ DownloadNotification.resume.record(it) }
)
is Event.NotificationDownloadTryAgain -> EventWrapper<NoExtraKeys>(
{ DownloadNotification.tryAgain.record(it) }
)
is Event.NotificationMediaPlay -> EventWrapper<NoExtraKeys>( is Event.NotificationMediaPlay -> EventWrapper<NoExtraKeys>(
{ MediaNotification.play.record(it) } { MediaNotification.play.record(it) }
) )

View File

@ -10,6 +10,7 @@ import mozilla.components.browser.search.SearchEngine
import mozilla.components.browser.toolbar.facts.ToolbarFacts import mozilla.components.browser.toolbar.facts.ToolbarFacts
import mozilla.components.feature.contextmenu.facts.ContextMenuFacts import mozilla.components.feature.contextmenu.facts.ContextMenuFacts
import mozilla.components.feature.customtabs.CustomTabsFacts import mozilla.components.feature.customtabs.CustomTabsFacts
import mozilla.components.feature.downloads.facts.DownloadsFacts
import mozilla.components.feature.findinpage.facts.FindInPageFacts import mozilla.components.feature.findinpage.facts.FindInPageFacts
import mozilla.components.feature.media.facts.MediaFacts import mozilla.components.feature.media.facts.MediaFacts
import mozilla.components.support.base.Component import mozilla.components.support.base.Component
@ -117,6 +118,13 @@ sealed class Event {
object MediaPlayState : Event() object MediaPlayState : Event()
object MediaPauseState : Event() object MediaPauseState : Event()
object MediaStopState : Event() object MediaStopState : Event()
object InAppNotificationDownloadOpen : Event()
object InAppNotificationDownloadTryAgain : Event()
object NotificationDownloadCancel : Event()
object NotificationDownloadOpen : Event()
object NotificationDownloadPause : Event()
object NotificationDownloadResume : Event()
object NotificationDownloadTryAgain : Event()
object NotificationMediaPlay : Event() object NotificationMediaPlay : Event()
object NotificationMediaPause : Event() object NotificationMediaPause : Event()
object TrackingProtectionTrackerList : Event() object TrackingProtectionTrackerList : Event()
@ -332,28 +340,29 @@ private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
Component.FEATURE_CUSTOMTABS to CustomTabsFacts.Items.CLOSE -> Event.CustomTabsClosed Component.FEATURE_CUSTOMTABS to CustomTabsFacts.Items.CLOSE -> Event.CustomTabsClosed
Component.FEATURE_CUSTOMTABS to CustomTabsFacts.Items.ACTION_BUTTON -> Event.CustomTabsActionTapped Component.FEATURE_CUSTOMTABS to CustomTabsFacts.Items.ACTION_BUTTON -> Event.CustomTabsActionTapped
Component.FEATURE_DOWNLOADS to DownloadsFacts.Items.NOTIFICATION -> {
when (action) {
Action.CANCEL -> Event.NotificationDownloadCancel
Action.OPEN -> Event.NotificationDownloadOpen
Action.PAUSE -> Event.NotificationDownloadPause
Action.RESUME -> Event.NotificationDownloadResume
Action.TRY_AGAIN -> Event.NotificationDownloadTryAgain
else -> null
}
}
Component.FEATURE_MEDIA to MediaFacts.Items.NOTIFICATION -> { Component.FEATURE_MEDIA to MediaFacts.Items.NOTIFICATION -> {
when (action) { when (action) {
Action.PLAY -> { Action.PLAY -> Event.NotificationMediaPlay
Event.NotificationMediaPlay Action.PAUSE -> Event.NotificationMediaPause
}
Action.PAUSE -> {
Event.NotificationMediaPause
}
else -> null else -> null
} }
} }
Component.FEATURE_MEDIA to MediaFacts.Items.STATE -> { Component.FEATURE_MEDIA to MediaFacts.Items.STATE -> {
when (action) { when (action) {
Action.PLAY -> { Action.PLAY -> Event.MediaPlayState
Event.MediaPlayState Action.PAUSE -> Event.MediaPauseState
} Action.STOP -> Event.MediaStopState
Action.PAUSE -> {
Event.MediaPauseState
}
Action.STOP -> {
Event.MediaStopState
}
else -> null else -> null
} }
} }

View File

@ -16,6 +16,8 @@ import mozilla.components.browser.state.state.content.DownloadState
import mozilla.components.feature.downloads.AbstractFetchDownloadService import mozilla.components.feature.downloads.AbstractFetchDownloadService
import mozilla.components.feature.downloads.toMegabyteString import mozilla.components.feature.downloads.toMegabyteString
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.theme.ThemeManager import org.mozilla.fenix.theme.ThemeManager
class DownloadNotificationBottomSheetDialog( class DownloadNotificationBottomSheetDialog(
@ -42,6 +44,7 @@ class DownloadNotificationBottomSheetDialog(
) )
setOnClickListener { setOnClickListener {
tryAgain(download.id) tryAgain(download.id)
context.metrics.track(Event.InAppNotificationDownloadTryAgain)
dismiss() dismiss()
} }
} }
@ -66,6 +69,7 @@ class DownloadNotificationBottomSheetDialog(
contentType = download.contentType, contentType = download.contentType,
filePath = download.filePath filePath = download.filePath
) )
context.metrics.track(Event.InAppNotificationDownloadOpen)
dismiss() dismiss()
} }
} }

File diff suppressed because one or more lines are too long