For #15644: change apply to with in GleanMetricsService.

While the callback receiver is identical in these two methods, they're
semantically different: apply is for initializing the receiver while with
is anything else benefiting from a new `this` receiver.

I didn't change the usage of apply that has a return statement because I
was afraid my change might change behavior.
upstream-sync
Michael Comella 4 years ago committed by Michael Comella
parent 690554b5c6
commit 4a000ab4f9

@ -762,7 +762,7 @@ class GleanMetricsService(
internal fun setStartupMetrics() {
setPreferenceMetrics()
Metrics.apply {
with(Metrics) {
defaultBrowser.set(browsersCache.all(context).isDefaultBrowser)
mozillaProductDetector.getMozillaBrowserDefault(context)?.also {
defaultMozBrowser.set(it)
@ -819,7 +819,7 @@ class GleanMetricsService(
// We purposefully make all of our preferences the string_list format to make data analysis
// simpler. While it makes things like booleans a bit more complicated, it means all our
// preferences can be analyzed with the same dashboard and compared.
Preferences.apply {
with(Preferences) {
showSearchSuggestions.set(context.settings().shouldShowSearchSuggestions.toStringList())
remoteDebugging.set(context.settings().isRemoteDebuggingEnabled.toStringList())
telemetry.set(context.settings().isTelemetryEnabled.toStringList())

Loading…
Cancel
Save