Skip to content

Commit

Permalink
For mozilla-mobile#24212 - Remove Event.wrapper for Preferences metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandru2909 committed Mar 29, 2022
1 parent ffbcaa8 commit ca83a0c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ sealed class Event {
)
}
object AddonsOpenInSettings : Event()
object StudiesSettings : Event()
object VoiceSearchTapped : Event()
object SearchWidgetInstalled : Event()
object ChangedToDefaultBrowser : Event()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import org.mozilla.fenix.GleanMetrics.MediaState
import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.Pocket
import org.mozilla.fenix.GleanMetrics.Preferences
import org.mozilla.fenix.GleanMetrics.ProgressiveWebApp
import org.mozilla.fenix.GleanMetrics.ReaderMode
import org.mozilla.fenix.GleanMetrics.RecentBookmarks
Expand Down Expand Up @@ -588,9 +587,6 @@ private val Event.wrapper: EventWrapper<*>?
is Event.AddonsOpenInSettings -> EventWrapper<NoExtraKeys>(
{ Addons.openAddonsInSettings.record(it) }
)
is Event.StudiesSettings -> EventWrapper<NoExtraKeys>(
{ Preferences.studiesPreferenceEnabled.record(it) }
)
is Event.AddonsOpenInToolbarMenu -> EventWrapper(
{ Addons.openAddonInToolbarMenu.record(it) },
{ Addons.openAddonInToolbarMenuKeys.valueOf(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.databinding.SettingsStudiesBinding
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings

Expand Down Expand Up @@ -41,7 +40,6 @@ class StudiesFragment : Fragment() {
requireContext().settings(),
experiments,
::isAttached,
requireContext().metrics
).bind()

return binding.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import mozilla.components.service.nimbus.NimbusApi
import mozilla.components.support.base.log.logger.Logger
import mozilla.telemetry.glean.private.NoExtras
import org.mozilla.experiments.nimbus.internal.EnrolledExperiment
import org.mozilla.fenix.GleanMetrics.Preferences
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.databinding.SettingsStudiesBinding
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.settings
Expand All @@ -43,7 +43,6 @@ class StudiesView(
private val settings: Settings,
private val experiments: NimbusApi,
private val isAttached: () -> Boolean,
private val metrics: MetricController
) : StudiesAdapterDelegate {
private val logger = Logger("StudiesView")

Expand All @@ -56,7 +55,7 @@ class StudiesView(
provideStudiesSwitch().isChecked = settings.isExperimentationEnabled
provideStudiesSwitch().setOnClickListener {
val isChecked = provideStudiesSwitch().isChecked
metrics.track(Event.StudiesSettings)
Preferences.studiesPreferenceEnabled.record(NoExtras())
provideStudiesTitle().text = getSwitchCheckedTitle()
val builder = AlertDialog.Builder(context)
.setPositiveButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import io.mockk.spyk
import io.mockk.verify
import kotlinx.coroutines.test.TestCoroutineScope
import mozilla.components.service.nimbus.NimbusApi
import mozilla.components.support.test.mock
import mozilla.components.support.test.robolectric.testContext
import mozilla.components.support.test.rule.MainCoroutineRule
import org.junit.After
Expand Down Expand Up @@ -62,8 +61,7 @@ class StudiesViewTest {
interactor,
settings,
experiments,
isAttached = { true },
metrics = mock()
isAttached = { true }
)
)
}
Expand Down

0 comments on commit ca83a0c

Please sign in to comment.