2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/24709 - Remove Event.wrapper for Wallpapers telemetry

This commit is contained in:
Alexandru2909 2022-04-12 10:03:29 +03:00 committed by mergify[bot]
parent 07c88fb1c9
commit 759fd90263
4 changed files with 21 additions and 47 deletions

View File

@ -253,11 +253,6 @@ sealed class Event {
sealed class Search sealed class Search
object WallpaperSettingsOpened : Event()
data class WallpaperSelected(val wallpaper: org.mozilla.fenix.wallpapers.Wallpaper) : Event()
data class WallpaperSwitched(val wallpaper: org.mozilla.fenix.wallpapers.Wallpaper) : Event()
data class ChangeWallpaperWithLogoToggled(val checked: Boolean) : Event()
sealed class Messaging(open val messageId: String) : Event() { sealed class Messaging(open val messageId: String) : Event() {
data class MessageShown(override val messageId: String) : Messaging(messageId) data class MessageShown(override val messageId: String) : Messaging(messageId)
data class MessageDismissed(override val messageId: String) : Messaging(messageId) data class MessageDismissed(override val messageId: String) : Messaging(messageId)

View File

@ -30,7 +30,6 @@ import org.mozilla.fenix.GleanMetrics.SearchTerms
import org.mozilla.fenix.GleanMetrics.StartOnHome import org.mozilla.fenix.GleanMetrics.StartOnHome
import org.mozilla.fenix.GleanMetrics.SyncedTabs import org.mozilla.fenix.GleanMetrics.SyncedTabs
import org.mozilla.fenix.GleanMetrics.Tabs import org.mozilla.fenix.GleanMetrics.Tabs
import org.mozilla.fenix.GleanMetrics.Wallpapers
import org.mozilla.fenix.GleanMetrics.Messaging import org.mozilla.fenix.GleanMetrics.Messaging
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
@ -360,38 +359,6 @@ private val Event.wrapper: EventWrapper<*>?
) )
} }
) )
is Event.WallpaperSettingsOpened -> EventWrapper<NoExtraKeys>(
{ Wallpapers.wallpaperSettingsOpened.record() }
)
is Event.WallpaperSelected -> EventWrapper<NoExtraKeys>(
{
Wallpapers.wallpaperSelected.record(
Wallpapers.WallpaperSelectedExtra(
name = this.wallpaper.name,
themeCollection = this.wallpaper::class.simpleName,
),
)
}
)
is Event.WallpaperSwitched -> EventWrapper<NoExtraKeys>(
{
Wallpapers.wallpaperSwitched.record(
Wallpapers.WallpaperSwitchedExtra(
name = this.wallpaper.name,
themeCollection = this.wallpaper::class.simpleName,
),
)
}
)
is Event.ChangeWallpaperWithLogoToggled -> EventWrapper<NoExtraKeys>(
{
Wallpapers.changeWallpaperLogoToggled.record(
Wallpapers.ChangeWallpaperLogoToggledExtra(
checked = this.checked,
),
)
}
)
is Event.HistoryHighlightOpened -> EventWrapper<NoExtraKeys>( is Event.HistoryHighlightOpened -> EventWrapper<NoExtraKeys>(
{ RecentlyVisitedHomepage.historyHighlightOpened.record() } { RecentlyVisitedHomepage.historyHighlightOpened.record() }

View File

@ -78,6 +78,7 @@ import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.Config import org.mozilla.fenix.Config
import org.mozilla.fenix.FeatureFlags import org.mozilla.fenix.FeatureFlags
import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.Wallpapers
import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.browser.BrowserAnimator.Companion.getToolbarNavOptions import org.mozilla.fenix.browser.BrowserAnimator.Companion.getToolbarNavOptions
@ -747,7 +748,12 @@ class HomeFragment : Fragment() {
binding.wordmark.setOnClickListener { binding.wordmark.setOnClickListener {
val manager = requireComponents.wallpaperManager val manager = requireComponents.wallpaperManager
val newWallpaper = manager.switchToNextWallpaper() val newWallpaper = manager.switchToNextWallpaper()
requireComponents.analytics.metrics.track(Event.WallpaperSwitched(newWallpaper)) Wallpapers.wallpaperSwitched.record(
Wallpapers.WallpaperSwitchedExtra(
name = newWallpaper.name,
themeCollection = newWallpaper::class.simpleName
)
)
manager.updateWallpaper( manager.updateWallpaper(
wallpaperContainer = binding.wallpaperImageView, wallpaperContainer = binding.wallpaperImageView,
newWallpaper = newWallpaper newWallpaper = newWallpaper

View File

@ -16,8 +16,9 @@ import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import mozilla.components.service.glean.private.NoExtras
import org.mozilla.fenix.GleanMetrics.Wallpapers
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.showToolbar import org.mozilla.fenix.ext.showToolbar
import org.mozilla.fenix.theme.FirefoxTheme import org.mozilla.fenix.theme.FirefoxTheme
@ -33,16 +34,12 @@ class WallpaperSettingsFragment : Fragment() {
requireComponents.settings requireComponents.settings
} }
private val metrics by lazy {
requireComponents.analytics.metrics
}
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, inflater: LayoutInflater,
container: ViewGroup?, container: ViewGroup?,
savedInstanceState: Bundle? savedInstanceState: Bundle?
): View? { ): View? {
metrics.track(Event.WallpaperSettingsOpened) Wallpapers.wallpaperSettingsOpened.record(NoExtras())
return ComposeView(requireContext()).apply { return ComposeView(requireContext()).apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent { setContent {
@ -59,14 +56,23 @@ class WallpaperSettingsFragment : Fragment() {
onSelectWallpaper = { selectedWallpaper: Wallpaper -> onSelectWallpaper = { selectedWallpaper: Wallpaper ->
currentWallpaper = selectedWallpaper currentWallpaper = selectedWallpaper
wallpaperManager.currentWallpaper = selectedWallpaper wallpaperManager.currentWallpaper = selectedWallpaper
metrics.track(Event.WallpaperSelected(selectedWallpaper)) Wallpapers.wallpaperSelected.record(
Wallpapers.WallpaperSelectedExtra(
name = selectedWallpaper.name,
themeCollection = selectedWallpaper::class.simpleName
)
)
}, },
onViewWallpaper = { findNavController().navigate(R.id.homeFragment) }, onViewWallpaper = { findNavController().navigate(R.id.homeFragment) },
tapLogoSwitchChecked = wallpapersSwitchedByLogo, tapLogoSwitchChecked = wallpapersSwitchedByLogo,
onTapLogoSwitchCheckedChange = { onTapLogoSwitchCheckedChange = {
settings.wallpapersSwitchedByLogoTap = it settings.wallpapersSwitchedByLogoTap = it
wallpapersSwitchedByLogo = it wallpapersSwitchedByLogo = it
metrics.track(Event.ChangeWallpaperWithLogoToggled(it)) Wallpapers.changeWallpaperLogoToggled.record(
Wallpapers.ChangeWallpaperLogoToggledExtra(
checked = it
)
)
} }
) )
} }