Fixes #945 - Ties leanplum to telemetry toggle
parent
7cbafa58ee
commit
dae42a7451
|
@ -7,9 +7,12 @@ package org.mozilla.fenix
|
|||
import com.leanplum.Leanplum
|
||||
import com.leanplum.LeanplumActivityHelper
|
||||
import com.leanplum.annotations.Parser
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
||||
object LeanplumHelper {
|
||||
fun setupLeanplumIfNeeded(application: FenixApplication) {
|
||||
if (!Settings.getInstance(application).isTelemetryEnabled) { return }
|
||||
|
||||
Leanplum.setApplicationContext(application)
|
||||
Parser.parseVariables(application)
|
||||
LeanplumActivityHelper.enableLifecycleCallbacks(application)
|
||||
|
|
|
@ -7,7 +7,9 @@ package org.mozilla.fenix.settings
|
|||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.SwitchPreference
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
|
||||
class DataChoicesFragment : PreferenceFragmentCompat() {
|
||||
|
||||
|
@ -19,5 +21,9 @@ class DataChoicesFragment : PreferenceFragmentCompat() {
|
|||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.data_choices_preferences, rootKey)
|
||||
|
||||
findPreference<SwitchPreference>(getString(R.string.pref_key_telemetry)).apply {
|
||||
isChecked = Settings.getInstance(context).isTelemetryEnabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@ class Settings private constructor(context: Context) {
|
|||
PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
val defaultSearchEngineName: String
|
||||
get() = preferences.getString(
|
||||
appContext.getPreferenceKey(R.string.pref_key_search_engine),
|
||||
""
|
||||
) ?: ""
|
||||
get() = preferences.getString(appContext.getPreferenceKey(R.string.pref_key_search_engine), "") ?: ""
|
||||
|
||||
val isTelemetryEnabled: Boolean
|
||||
get() = preferences.getBoolean(appContext.getPreferenceKey(R.string.pref_key_telemetry), true)
|
||||
|
||||
fun setDefaultSearchEngineByName(name: String) {
|
||||
preferences.edit()
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<androidx.preference.SwitchPreference
|
||||
android:key="@string/pref_key_make_default_browser"
|
||||
android:key="@string/pref_key_telemetry"
|
||||
android:title="@string/preferences_telemetry" />
|
||||
<androidx.preference.SwitchPreference
|
||||
android:key="@string/pref_key_make_default_browser"
|
||||
android:key="@string/pref_key_crash_reporter"
|
||||
android:title="@string/preferences_crash_reporter" />
|
||||
<androidx.preference.SwitchPreference
|
||||
android:key="@string/pref_key_make_default_browser"
|
||||
android:key="@string/pref_key_mozilla_location_service"
|
||||
android:title="@string/preferences_mozilla_location_service" />
|
||||
<androidx.preference.SwitchPreference
|
||||
android:key="@string/pref_key_make_default_browser"
|
||||
android:key="@string/pref_key_fenix_health_report"
|
||||
android:title="@string/preferences_fenix_health_report" />
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue