|
|
|
@ -22,35 +22,35 @@ import kotlinx.coroutines.launch
|
|
|
|
|
import mozilla.components.concept.sync.AccountObserver
|
|
|
|
|
import mozilla.components.concept.sync.OAuthAccount
|
|
|
|
|
import mozilla.components.concept.sync.Profile
|
|
|
|
|
import kotlin.coroutines.CoroutineContext
|
|
|
|
|
import mozilla.components.service.fxa.FxaUnauthorizedException
|
|
|
|
|
import org.mozilla.fenix.FenixApplication
|
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
|
|
import org.mozilla.fenix.BrowserDirection
|
|
|
|
|
import org.mozilla.fenix.Config
|
|
|
|
|
import org.mozilla.fenix.FenixApplication
|
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.ext.getPreferenceKey
|
|
|
|
|
import org.mozilla.fenix.ext.requireComponents
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_leakcanary
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_about
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_accessibility
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_account
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_account_category
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_data_choices
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_feedback
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_help
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_language
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_leakcanary
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_make_default_browser
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_rate
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_remote_debugging
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_site_permissions
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_accessibility
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_language
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_data_choices
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_about
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_search_engine_settings
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_sign_in
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_site_permissions
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_theme
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_account
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_account_category
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_search_engine_settings
|
|
|
|
|
import org.mozilla.fenix.R.string.pref_key_tracking_protection_settings
|
|
|
|
|
import org.mozilla.fenix.components.metrics.Event
|
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
|
import org.mozilla.fenix.ext.getPreferenceKey
|
|
|
|
|
import org.mozilla.fenix.ext.requireComponents
|
|
|
|
|
import org.mozilla.fenix.utils.ItsNotBrokenSnack
|
|
|
|
|
import kotlin.coroutines.CoroutineContext
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("TooManyFunctions")
|
|
|
|
|
class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObserver {
|
|
|
|
@ -207,18 +207,18 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
|
|
|
|
|
getClickListenerForMakeDefaultBrowser()
|
|
|
|
|
|
|
|
|
|
if (!Config.channel.isReleased) {
|
|
|
|
|
preferenceLeakCanary?.onPreferenceChangeListener =
|
|
|
|
|
Preference.OnPreferenceChangeListener { _, newValue ->
|
|
|
|
|
(context?.applicationContext as FenixApplication).toggleLeakCanary(newValue as Boolean)
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
preferenceRemoteDebugging?.onPreferenceChangeListener =
|
|
|
|
|
Preference.OnPreferenceChangeListener { _, newValue ->
|
|
|
|
|
requireComponents.core.engine.settings.remoteDebuggingEnabled = newValue as Boolean
|
|
|
|
|
preferenceLeakCanary?.setOnPreferenceChangeListener { _, newValue ->
|
|
|
|
|
(context?.applicationContext as FenixApplication).toggleLeakCanary(newValue as Boolean)
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
preferenceRemoteDebugging?.setOnPreferenceChangeListener { preference, newValue ->
|
|
|
|
|
org.mozilla.fenix.utils.Settings.getInstance(preference.context).preferences.edit()
|
|
|
|
|
.putBoolean(preference.key, newValue as Boolean).apply()
|
|
|
|
|
requireComponents.core.engine.settings.remoteDebuggingEnabled = newValue
|
|
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private val defaultClickListener = OnPreferenceClickListener { preference ->
|
|
|
|
|