Closes #26945: adds telemetry for learn more link on wallpaper settings

This commit is contained in:
MatthewTighe 2022-09-14 15:10:53 -07:00 committed by mergify[bot]
parent af1fbd5eeb
commit 9ce3f65b51
3 changed files with 35 additions and 5 deletions

View File

@ -8175,6 +8175,29 @@ wallpapers:
metadata:
tags:
- Wallpapers
learn_more_link_click:
type: event
description: |
The learn more link for a wallpaper collection has been clicked.
extra_keys:
collection_name:
description: The name of the wallpaper collection the link leads to.
type: string
url:
description: The URL associated with the wallpaper collection.
type: string
bugs:
- https://github:com/mozilla-mobile/fenix/issues/26945
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/26990
notification_emails:
- android-probes@mozilla.com
data_sensitivity:
- interaction
expires: 116
metadata:
tags:
- Wallpapers
recently_visited_homepage:
history_highlight_opened:

View File

@ -59,6 +59,7 @@ import org.mozilla.fenix.wallpapers.Wallpaper
* @param loadWallpaperResource Callback to handle loading a wallpaper bitmap. Only optional in the default case.
* @param onSelectWallpaper Callback for when a new wallpaper is selected.
* @param onLearnMoreClick Callback for when the learn more action is clicked from the group description.
* Parameters are the URL that is clicked and the name of the collection.
*/
@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
@Composable
@ -69,7 +70,7 @@ fun WallpaperSettings(
loadWallpaperResource: suspend (Wallpaper) -> Bitmap?,
selectedWallpaper: Wallpaper,
onSelectWallpaper: (Wallpaper) -> Unit,
onLearnMoreClick: (String) -> Unit,
onLearnMoreClick: (String, String) -> Unit,
) {
Column(
modifier = Modifier
@ -109,7 +110,7 @@ fun WallpaperSettings(
@Composable
private fun WallpaperGroupHeading(
collection: Wallpaper.Collection,
onLearnMoreClick: (String) -> Unit,
onLearnMoreClick: (String, String) -> Unit,
) {
// Since the last new collection of wallpapers was tied directly to an MR release,
// it was decided that we should use string resources for these titles
@ -153,7 +154,7 @@ private fun WallpaperGroupHeading(
clickableStartIndex = linkStartIndex,
clickableEndIndex = linkEndIndex,
) {
onLearnMoreClick(collection.learnMoreUrl)
onLearnMoreClick(collection.learnMoreUrl, collection.name)
}
}
}
@ -302,7 +303,7 @@ private fun WallpaperThumbnailsPreview() {
wallpaperGroups = mapOf(Wallpaper.DefaultCollection to listOf(Wallpaper.Default)),
selectedWallpaper = Wallpaper.Default,
onSelectWallpaper = {},
onLearnMoreClick = {},
onLearnMoreClick = { _, _ -> },
)
}
}

View File

@ -68,12 +68,18 @@ class WallpaperSettingsFragment : Fragment() {
onWallpaperSelected(it, result, this@apply)
}
},
onLearnMoreClick = { url ->
onLearnMoreClick = { url, collectionName ->
(activity as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = url,
newTab = true,
from = BrowserDirection.FromWallpaper,
)
Wallpapers.learnMoreLinkClick.record(
Wallpapers.LearnMoreLinkClickExtra(
url = url,
collectionName = collectionName,
),
)
},
)
}