Skip to content

Commit 4ee28d7

Browse files
author
Elise Richards
committed
Facts for pwa add to homescreen and install
Add facts to pwa docs remove homescreen tap in favor of install
1 parent c8bcd3a commit 4ee28d7

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

components/feature/pwa/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ This component emits the following [Facts](../../support/base/README.md#Facts):
6565

6666
| Action | Item | Extras | Description |
6767
|--------|---------|----------------|------------------------------------|
68+
| CLICK | install_shortcut | | The user installs a PWA shortcut. |
6869
| CLICK | homescreen_icon_tap | | The user tapped the PWA icon on the homescreen. |
6970
| INTERACTION | enter_background | `itemExtras` | The current system time when the app is backgrounded. |
7071
| INTERACTION | enter_foreground | `itemExtras` | The current system time when the app is foregrounded. |

components/feature/pwa/src/main/java/mozilla/components/feature/pwa/ProgressiveWebAppFacts.kt

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class ProgressiveWebAppFacts {
1818
* Items that specify which portion of the [PwaFeature] was interacted with
1919
*/
2020
object Items {
21+
const val INSTALL_SHORTCUT = "install_shortcut"
2122
const val HOMESCREEN_ICON_TAP = "homescreen_icon_tap"
2223
const val ENTER_BACKGROUND = "enter_background"
2324
const val ENTER_FOREGROUND = "enter_foreground"
@@ -58,6 +59,12 @@ internal fun emitHomescreenIconTapFact() =
5859
ProgressiveWebAppFacts.Items.HOMESCREEN_ICON_TAP
5960
)
6061

62+
internal fun emitPwaInstallFact() =
63+
emitPwaFact(
64+
Action.CLICK,
65+
ProgressiveWebAppFacts.Items.INSTALL_SHORTCUT
66+
)
67+
6168
internal fun emitForegroundTimingFact(timingNs: Long) =
6269
emitPwaFact(
6370
Action.INTERACTION,

components/feature/pwa/src/main/java/mozilla/components/feature/pwa/WebAppShortcutManager.kt

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class WebAppShortcutManager(
8080
if (ShortcutManagerCompat.isRequestPinShortcutSupported(context)) {
8181
val manifest = session.installableManifest()
8282
val shortcut = if (supportWebApps && manifest != null) {
83+
emitPwaInstallFact()
8384
buildWebAppShortcut(context, manifest)
8485
} else {
8586
buildBasicShortcut(context, session, overrideShortcutName)

0 commit comments

Comments
 (0)