Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #986 - Adds support for opening Fenix with a link to telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
boek committed Mar 19, 2019
1 parent 6b68d16 commit 27a8990
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions app/src/main/java/org/mozilla/fenix/HomeActivity.kt
Expand Up @@ -59,12 +59,17 @@ open class HomeActivity : AppCompatActivity() {
setSupportActionBar(navigationToolbar)
NavigationUI.setupWithNavController(navigationToolbar, hostNavController, 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)
}
Expand Down
Expand Up @@ -12,7 +12,7 @@ sealed class 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)
}
Expand Down

0 comments on commit 27a8990

Please sign in to comment.