For #986 - Adds support for opening Fenix with a link to telemetry
parent
32f8e06e98
commit
b5bd9357fc
|
@ -62,12 +62,17 @@ open class HomeActivity : AppCompatActivity() {
|
||||||
setSupportActionBar(navigationToolbar)
|
setSupportActionBar(navigationToolbar)
|
||||||
NavigationUI.setupWithNavController(navigationToolbar, navHost.navController, appBarConfiguration)
|
NavigationUI.setupWithNavController(navigationToolbar, navHost.navController, appBarConfiguration)
|
||||||
|
|
||||||
val safeIntent = intent?.let { SafeIntent(it) }
|
intent
|
||||||
|
?.let { SafeIntent(it) }
|
||||||
if (safeIntent?.isLauncherIntent == true) {
|
?.let {
|
||||||
val source = if (isCustomTab) Event.OpenedApp.Source.CUSTOM_TAB else Event.OpenedApp.Source.APP_ICON
|
when {
|
||||||
components.analytics.metrics.track(Event.OpenedApp(source))
|
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)
|
handleOpenedFromExternalSourceIfNecessary(intent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,9 @@ class BrowserFragment : Fragment(), BackHandler {
|
||||||
requireComponents.core.sessionManager.selectedSession?.id)
|
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)
|
is SearchAction.ToolbarMenuItemTapped -> handleToolbarItemInteraction(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.mozilla.fenix.debug.GleanMetrics.Metrics
|
||||||
import org.mozilla.fenix.debug.GleanMetrics.Events
|
import org.mozilla.fenix.debug.GleanMetrics.Events
|
||||||
|
|
||||||
private val Event.metricType: EventMetricType?
|
private val Event.metricType: EventMetricType?
|
||||||
get() = when(this) {
|
get() = when (this) {
|
||||||
is Event.OpenedApp -> Events.appOpened
|
is Event.OpenedApp -> Events.appOpened
|
||||||
is Event.SearchBarTapped -> Events.searchBarTapped
|
is Event.SearchBarTapped -> Events.searchBarTapped
|
||||||
is Event.EnteredUrl -> Events.enteredUrl
|
is Event.EnteredUrl -> Events.enteredUrl
|
||||||
|
|
|
@ -10,9 +10,8 @@ sealed class Event {
|
||||||
object RemoveBookmark : Event()
|
object RemoveBookmark : Event()
|
||||||
object OpenedBookmark : Event()
|
object OpenedBookmark : Event()
|
||||||
|
|
||||||
|
|
||||||
data class OpenedApp(val source: Source) : 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>?
|
override val extras: Map<String, String>?
|
||||||
get() = hashMapOf("source" to source.name)
|
get() = hashMapOf("source" to source.name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue