Skip to content

Commit

Permalink
For mozilla-mobile#21292: Enable or disable Glean directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare committed May 4, 2022
1 parent 79e6de6 commit 8956439
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.navigation.findNavController
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import mozilla.components.service.glean.Glean
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.MetricServiceType
import org.mozilla.fenix.ext.components
Expand All @@ -29,9 +30,9 @@ class DataChoicesFragment : PreferenceFragmentCompat() {
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this) { _, key ->
if (key == getPreferenceKey(R.string.pref_key_telemetry)) {
if (context.settings().isTelemetryEnabled) {
context.components.analytics.metrics.start(MetricServiceType.Data)
Glean.setUploadEnabled(true)
} else {
context.components.analytics.metrics.stop(MetricServiceType.Data)
Glean.setUploadEnabled(false)
}
// Reset experiment identifiers on both opt-in and opt-out; it's likely
// that in future we will need to pass in the new telemetry client_id
Expand Down

0 comments on commit 8956439

Please sign in to comment.