1
0
Fork 0

For #986 - Adds support for opening Fenix with a link to telemetry

master
Jeff Boek 2019-03-18 20:49:17 -07:00
parent 32f8e06e98
commit b5bd9357fc
4 changed files with 16 additions and 10 deletions

View File

@ -62,12 +62,17 @@ open class HomeActivity : AppCompatActivity() {
setSupportActionBar(navigationToolbar)
NavigationUI.setupWithNavController(navigationToolbar, navHost.navController, appBarConfiguration)
val safeIntent = intent?.let { SafeIntent(it) }
if (safeIntent?.isLauncherIntent == true) {
val source = if (isCustomTab) Event.OpenedApp.Source.CUSTOM_TAB else Event.OpenedApp.Source.APP_ICON
components.analytics.metrics.track(Event.OpenedApp(source))
}
intent
?.let { SafeIntent(it) }
?.let {
when {
isCustomTab -> Event.OpenedApp.Source.CUSTOM_TAB
it.isLauncherIntent -> Event.OpenedApp.Source.APP_ICON
it.action == Intent.ACTION_VIEW -> Event.OpenedApp.Source.LINK
else -> null
}
}
?.also { components.analytics.metrics.track(Event.OpenedApp(it)) }
handleOpenedFromExternalSourceIfNecessary(intent)
}

View File

@ -251,7 +251,9 @@ class BrowserFragment : Fragment(), BackHandler {
requireComponents.core.sessionManager.selectedSession?.id)
)
requireComponents.analytics.metrics.track(Event.SearchBarTapped(Event.SearchBarTapped.Source.BROWSER))
requireComponents.analytics.metrics.track(
Event.SearchBarTapped(Event.SearchBarTapped.Source.BROWSER)
)
}
is SearchAction.ToolbarMenuItemTapped -> handleToolbarItemInteraction(it)
}

View File

@ -13,7 +13,7 @@ import org.mozilla.fenix.debug.GleanMetrics.Metrics
import org.mozilla.fenix.debug.GleanMetrics.Events
private val Event.metricType: EventMetricType?
get() = when(this) {
get() = when (this) {
is Event.OpenedApp -> Events.appOpened
is Event.SearchBarTapped -> Events.searchBarTapped
is Event.EnteredUrl -> Events.enteredUrl

View File

@ -10,9 +10,8 @@ sealed class Event {
object RemoveBookmark : Event()
object OpenedBookmark : Event()
data class OpenedApp(val source: Source) : Event() {
enum class Source { APP_ICON, CUSTOM_TAB }
enum class Source { APP_ICON, LINK, CUSTOM_TAB }
override val extras: Map<String, String>?
get() = hashMapOf("source" to source.name)
}