Closes #26215: add telemetry events for wallpaper onboarding dialog
This commit is contained in:
parent
805fb0ff60
commit
9cb441a6ca
|
@ -8095,7 +8095,7 @@ wallpapers:
|
|||
wallpaper_selected:
|
||||
type: event
|
||||
description: |
|
||||
A wallpaper is selected from the settings screen.
|
||||
A wallpaper is selected from the settings screen or onboarding dialog.
|
||||
extra_keys:
|
||||
name:
|
||||
description: The name of the selected wallpaper
|
||||
|
@ -8103,20 +8103,78 @@ wallpapers:
|
|||
theme_collection:
|
||||
description: The theme collection the selected wallpaper belongs to.
|
||||
type: string
|
||||
source:
|
||||
description: |
|
||||
A string that tells us how the user selected the wallpaper.
|
||||
Possible values are: `settings`, `onboarding`
|
||||
type: string
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/23381
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/23382
|
||||
- https://github.com/mozilla-mobile/fenix/pull/26893
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
expires: 114
|
||||
expires: 116
|
||||
no_lint:
|
||||
- COMMON_PREFIX
|
||||
metadata:
|
||||
tags:
|
||||
- Wallpapers
|
||||
onboarding_opened:
|
||||
type: event
|
||||
description: |
|
||||
The wallpaper onboarding dialog has been displayed.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/26215
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/26893
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
expires: 116
|
||||
metadata:
|
||||
tags:
|
||||
- Wallpapers
|
||||
onboarding_closed:
|
||||
type: event
|
||||
description: |
|
||||
The wallpaper onboarding dialog has been closed.
|
||||
extra_keys:
|
||||
is_selected:
|
||||
description: Whether or not a wallpaper has been selected.
|
||||
type: boolean
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/26215
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/26893
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
expires: 116
|
||||
metadata:
|
||||
tags:
|
||||
- Wallpapers
|
||||
onboarding_explore_more_click:
|
||||
type: event
|
||||
description: |
|
||||
The wallpaper onboarding learn more button was clicked.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/26215
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/26893
|
||||
notification_emails:
|
||||
- android-probes@mozilla.com
|
||||
data_sensitivity:
|
||||
- interaction
|
||||
expires: 116
|
||||
metadata:
|
||||
tags:
|
||||
- Wallpapers
|
||||
|
||||
recently_visited_homepage:
|
||||
history_highlight_opened:
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package org.mozilla.fenix.onboarding
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.DialogInterface
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
|
@ -18,8 +19,11 @@ import androidx.navigation.fragment.findNavController
|
|||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlinx.coroutines.launch
|
||||
import mozilla.components.lib.state.ext.observeAsComposableState
|
||||
import mozilla.telemetry.glean.private.NoExtras
|
||||
import org.mozilla.fenix.GleanMetrics.Wallpapers
|
||||
import org.mozilla.fenix.NavGraphDirections
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.requireComponents
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.theme.FirefoxTheme
|
||||
|
@ -51,9 +55,21 @@ class WallpaperOnboardingDialogFragment : BottomSheetDialogFragment() {
|
|||
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
|
||||
}
|
||||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
super.onDismiss(dialog)
|
||||
|
||||
val currentWallpaper = requireContext().components.appStore.state.wallpaperState.currentWallpaper
|
||||
Wallpapers.onboardingClosed.record(
|
||||
Wallpapers.OnboardingClosedExtra(
|
||||
isSelected = currentWallpaper.name != Wallpaper.defaultName,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
requireContext().settings().showWallpaperOnboarding = false
|
||||
Wallpapers.onboardingOpened.record(NoExtras())
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
|
@ -81,16 +97,35 @@ class WallpaperOnboardingDialogFragment : BottomSheetDialogFragment() {
|
|||
onExploreMoreButtonClicked = {
|
||||
val directions = NavGraphDirections.actionGlobalWallpaperSettingsFragment()
|
||||
findNavController().navigate(directions)
|
||||
Wallpapers.onboardingExploreMoreClick.record(NoExtras())
|
||||
},
|
||||
loadWallpaperResource = { wallpaperUseCases.loadThumbnail(it) },
|
||||
onSelectWallpaper = {
|
||||
coroutineScope.launch { wallpaperUseCases.selectWallpaper(it) }
|
||||
coroutineScope.launch {
|
||||
val result = wallpaperUseCases.selectWallpaper(it)
|
||||
onWallpaperSelected(it, result)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun onWallpaperSelected(
|
||||
wallpaper: Wallpaper,
|
||||
result: Wallpaper.ImageFileState,
|
||||
) {
|
||||
if (result == Wallpaper.ImageFileState.Downloaded) {
|
||||
Wallpapers.wallpaperSelected.record(
|
||||
Wallpapers.WallpaperSelectedExtra(
|
||||
name = wallpaper.name,
|
||||
source = "onboarding",
|
||||
themeCollection = wallpaper.collection.name,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val THUMBNAILS_COUNT = 6
|
||||
}
|
||||
|
|
|
@ -97,6 +97,14 @@ class WallpaperSettingsFragment : Fragment() {
|
|||
findNavController().navigate(R.id.homeFragment)
|
||||
}
|
||||
.show()
|
||||
|
||||
Wallpapers.wallpaperSelected.record(
|
||||
Wallpapers.WallpaperSelectedExtra(
|
||||
name = wallpaper.name,
|
||||
source = "settings",
|
||||
themeCollection = wallpaper.collection.name,
|
||||
),
|
||||
)
|
||||
}
|
||||
Wallpaper.ImageFileState.Error -> {
|
||||
FenixSnackbar.make(
|
||||
|
|
|
@ -13,7 +13,6 @@ import kotlinx.coroutines.Dispatchers
|
|||
import kotlinx.coroutines.withContext
|
||||
import mozilla.components.concept.fetch.Client
|
||||
import org.mozilla.fenix.FeatureFlags
|
||||
import org.mozilla.fenix.GleanMetrics.Wallpapers
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.AppStore
|
||||
import org.mozilla.fenix.components.appstate.AppAction
|
||||
|
@ -441,12 +440,6 @@ class WallpapersUseCases(
|
|||
settings.currentWallpaperTextColor = wallpaper.textColor ?: 0
|
||||
settings.currentWallpaperCardColor = wallpaper.cardColor ?: 0
|
||||
store.dispatch(AppAction.WallpaperAction.UpdateCurrentWallpaper(wallpaper))
|
||||
Wallpapers.wallpaperSelected.record(
|
||||
Wallpapers.WallpaperSelectedExtra(
|
||||
name = wallpaper.name,
|
||||
themeCollection = wallpaper.collection.name,
|
||||
),
|
||||
)
|
||||
return Wallpaper.ImageFileState.Downloaded
|
||||
}
|
||||
}
|
||||
|
@ -482,12 +475,6 @@ class WallpapersUseCases(
|
|||
private fun selectWallpaper(wallpaper: Wallpaper) {
|
||||
settings.currentWallpaperName = wallpaper.name
|
||||
store.dispatch(AppAction.WallpaperAction.UpdateCurrentWallpaper(wallpaper))
|
||||
Wallpapers.wallpaperSelected.record(
|
||||
Wallpapers.WallpaperSelectedExtra(
|
||||
name = wallpaper.name,
|
||||
themeCollection = wallpaper.collection.name,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private fun dispatchDownloadState(wallpaper: Wallpaper, downloadState: Wallpaper.ImageFileState) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.junit.Assert.assertTrue
|
|||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.GleanMetrics.Wallpapers
|
||||
import org.mozilla.fenix.components.AppStore
|
||||
import org.mozilla.fenix.components.appstate.AppAction
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
@ -514,7 +513,6 @@ class WallpapersUseCasesTest {
|
|||
appStore.waitUntilIdle()
|
||||
assertEquals(selectedWallpaper.name, slot.captured)
|
||||
assertEquals(selectedWallpaper, appStore.state.wallpaperState.currentWallpaper)
|
||||
assertEquals(selectedWallpaper.name, Wallpapers.wallpaperSelected.testGetValue()?.first()?.extra?.get("name")!!)
|
||||
assertEquals(wallpaperFileState, Wallpaper.ImageFileState.Downloaded)
|
||||
}
|
||||
|
||||
|
@ -537,7 +535,6 @@ class WallpapersUseCasesTest {
|
|||
appStore.waitUntilIdle()
|
||||
assertEquals(selectedWallpaper.name, slot.captured)
|
||||
assertEquals(selectedWallpaper, appStore.state.wallpaperState.currentWallpaper)
|
||||
assertEquals(selectedWallpaper.name, Wallpapers.wallpaperSelected.testGetValue()?.first()?.extra?.get("name")!!)
|
||||
assertEquals(wallpaperFileState, Wallpaper.ImageFileState.Downloaded)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user