Dan Ballard pushed to branch tor-browser-128.7.0esr-14.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
4f30e0a4
by clairehurst at 2025-02-11T11:37:13-07:00
-
6877b274
by clairehurst at 2025-02-11T12:06:17-07:00
-
d95f26e0
by clairehurst at 2025-02-11T12:06:18-07:00
-
881f522b
by clairehurst at 2025-02-11T12:06:18-07:00
12 changed files:
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt
- − mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/QuickStartPreference.kt
- + mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/QuickstartViewModel.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistFragment.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorController.kt
- mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tor/TorControllerGV.kt
- mobile/android/fenix/app/src/main/res/xml/preferences.xml
- mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorIntegrationAndroid.java
- mobile/android/geckoview/src/main/java/org/mozilla/geckoview/TorSettings.java
- mobile/android/geckoview/src/main/java/org/mozilla/geckoview/androidlegacysettings/TorLegacyAndroidSettings.java
- toolkit/modules/TorAndroidIntegration.sys.mjs
Changes:
... | ... | @@ -13,7 +13,6 @@ import android.os.Build |
13 | 13 | import android.os.Bundle
|
14 | 14 | import android.os.Handler
|
15 | 15 | import android.os.Looper
|
16 | -import android.util.Log
|
|
17 | 16 | import android.view.LayoutInflater
|
18 | 17 | import android.view.WindowManager
|
19 | 18 | import android.widget.Toast
|
... | ... | @@ -65,16 +64,12 @@ import org.mozilla.fenix.ext.openSetDefaultBrowserOption |
65 | 64 | import org.mozilla.fenix.ext.requireComponents
|
66 | 65 | import org.mozilla.fenix.ext.settings
|
67 | 66 | import org.mozilla.fenix.ext.showToolbar
|
68 | -import org.mozilla.fenix.gecko.GeckoProvider
|
|
69 | 67 | import org.mozilla.fenix.nimbus.FxNimbus
|
70 | 68 | import org.mozilla.fenix.perf.ProfilerViewModel
|
71 | 69 | import org.mozilla.fenix.settings.account.AccountUiView
|
72 | -import org.mozilla.fenix.tor.QuickStartPreference
|
|
73 | 70 | import org.mozilla.fenix.tor.SecurityLevel
|
74 | -import org.mozilla.fenix.tor.TorBridgeTransportConfig
|
|
75 | -import org.mozilla.fenix.tor.TorEvents
|
|
71 | +import org.mozilla.fenix.tor.QuickstartViewModel
|
|
76 | 72 | import org.mozilla.fenix.utils.Settings
|
77 | -import org.mozilla.geckoview.BuildConfig
|
|
78 | 73 | import kotlin.system.exitProcess
|
79 | 74 | import org.mozilla.fenix.GleanMetrics.Settings as SettingsMetrics
|
80 | 75 | |
... | ... | @@ -86,6 +81,8 @@ class SettingsFragment : PreferenceFragmentCompat(), UserInteractionHandler { |
86 | 81 | private lateinit var addonFilePicker: AddonFilePicker
|
87 | 82 | private val profilerViewModel: ProfilerViewModel by activityViewModels()
|
88 | 83 | |
84 | + private val quickstartViewModel: QuickstartViewModel by activityViewModels()
|
|
85 | + |
|
89 | 86 | @VisibleForTesting
|
90 | 87 | internal val accountObserver = object : AccountObserver {
|
91 | 88 | private fun updateAccountUi(profile: Profile? = null) {
|
... | ... | @@ -776,10 +773,12 @@ class SettingsFragment : PreferenceFragmentCompat(), UserInteractionHandler { |
776 | 773 | }
|
777 | 774 | }
|
778 | 775 | |
779 | - requirePreference<QuickStartPreference>(R.string.pref_key_quick_start).apply {
|
|
776 | + requirePreference<SwitchPreference>(R.string.pref_key_quick_start).apply {
|
|
777 | + isChecked = quickstartViewModel.quickstart().value == true
|
|
780 | 778 | setOnPreferenceClickListener {
|
781 | - context.components.torController.quickstart = !context.components.torController.quickstart
|
|
782 | - updateSwitch()
|
|
779 | + quickstartViewModel.quickstartSet(
|
|
780 | + isChecked,
|
|
781 | + )
|
|
783 | 782 | true
|
784 | 783 | }
|
785 | 784 | }
|
1 | -package org.mozilla.fenix.tor
|
|
2 | - |
|
3 | -import android.content.Context
|
|
4 | -import android.util.AttributeSet
|
|
5 | -import androidx.preference.PreferenceViewHolder
|
|
6 | -import androidx.preference.SwitchPreference
|
|
7 | -import com.google.android.material.switchmaterial.SwitchMaterial
|
|
8 | -import org.mozilla.fenix.R
|
|
9 | -import org.mozilla.fenix.ext.components
|
|
10 | - |
|
11 | -class QuickStartPreference @JvmOverloads constructor(
|
|
12 | - context: Context,
|
|
13 | - attrs: AttributeSet? = null,
|
|
14 | -) : SwitchPreference(context, attrs) {
|
|
15 | - |
|
16 | - private var switchView: SwitchMaterial? = null
|
|
17 | - |
|
18 | - init {
|
|
19 | - widgetLayoutResource = R.layout.preference_quick_start
|
|
20 | - }
|
|
21 | - |
|
22 | - override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
|
23 | - super.onBindViewHolder(holder)
|
|
24 | - switchView = holder.findViewById(R.id.switch_widget) as SwitchMaterial
|
|
25 | - |
|
26 | - updateSwitch()
|
|
27 | - }
|
|
28 | - |
|
29 | - fun updateSwitch() {
|
|
30 | - switchView?.isChecked = context.components.torController.quickstart
|
|
31 | - }
|
|
32 | -} |
1 | +package org.mozilla.fenix.tor
|
|
2 | + |
|
3 | +import android.app.Application
|
|
4 | +import androidx.lifecycle.AndroidViewModel
|
|
5 | +import androidx.lifecycle.LiveData
|
|
6 | +import androidx.lifecycle.MutableLiveData
|
|
7 | +import mozilla.components.browser.engine.gecko.GeckoEngine
|
|
8 | +import org.mozilla.fenix.ext.components
|
|
9 | + |
|
10 | +class QuickstartViewModel(
|
|
11 | + application: Application,
|
|
12 | +) : AndroidViewModel(application) {
|
|
13 | + |
|
14 | + private val torIntegrationAndroid =
|
|
15 | + (getApplication<Application>().components.core.engine as GeckoEngine).getTorIntegrationController()
|
|
16 | + |
|
17 | + /**
|
|
18 | + * NOTE: Whilst the initial value for _quickstart is fetched from
|
|
19 | + * TorIntegrationAndroid.quickstartGet (which is surfaced from TorConnect.quickstart), and we
|
|
20 | + * pass on any changes in value up to TorConnect.quickstart (via quickstartSet()), we do not
|
|
21 | + * listen for any changes to the TorConnect.quickstart value via "QuickstartChange" because we
|
|
22 | + * do not expect anything outside of TorConnectViewModel to change its value, so we expect its
|
|
23 | + * value to remain in sync with our local value.
|
|
24 | + */
|
|
25 | + init {
|
|
26 | + torIntegrationAndroid.quickstartGet {
|
|
27 | + _quickstart.value = it
|
|
28 | + }
|
|
29 | + }
|
|
30 | + |
|
31 | + private val _quickstart = MutableLiveData<Boolean>()
|
|
32 | + fun quickstart(): LiveData<Boolean> {
|
|
33 | + return _quickstart
|
|
34 | + }
|
|
35 | + |
|
36 | + fun quickstartSet(value: Boolean) {
|
|
37 | + torIntegrationAndroid.quickstartSet(value)
|
|
38 | + _quickstart.value = value
|
|
39 | + }
|
|
40 | + |
|
41 | +} |
... | ... | @@ -20,6 +20,7 @@ import android.view.ViewGroup |
20 | 20 | import androidx.appcompat.content.res.AppCompatResources
|
21 | 21 | import androidx.fragment.app.Fragment
|
22 | 22 | import androidx.fragment.app.activityViewModels
|
23 | +import androidx.fragment.app.viewModels
|
|
23 | 24 | import androidx.lifecycle.Lifecycle
|
24 | 25 | import androidx.lifecycle.lifecycleScope
|
25 | 26 | import androidx.lifecycle.repeatOnLifecycle
|
... | ... | @@ -38,6 +39,8 @@ class TorConnectionAssistFragment : Fragment(), UserInteractionHandler { |
38 | 39 | private var _binding: FragmentTorConnectionAssistBinding? = null
|
39 | 40 | private val binding get() = _binding!!
|
40 | 41 | |
42 | + private val quickstartViewModel: QuickstartViewModel by activityViewModels()
|
|
43 | + |
|
41 | 44 | override fun onCreateView(
|
42 | 45 | inflater: LayoutInflater,
|
43 | 46 | container: ViewGroup?,
|
... | ... | @@ -78,10 +81,10 @@ class TorConnectionAssistFragment : Fragment(), UserInteractionHandler { |
78 | 81 | setProgressBarCompat(progress)
|
79 | 82 | }
|
80 | 83 | |
81 | - viewModel.quickstartToggle().observe(
|
|
84 | + quickstartViewModel.quickstart().observe(
|
|
82 | 85 | viewLifecycleOwner,
|
83 | 86 | ) {
|
84 | - binding.quickstartSwitch.isChecked = it == true
|
|
87 | + binding.quickstartSwitch.isChecked = it
|
|
85 | 88 | }
|
86 | 89 | |
87 | 90 | viewModel.shouldOpenHome().observe(
|
... | ... | @@ -185,9 +188,8 @@ class TorConnectionAssistFragment : Fragment(), UserInteractionHandler { |
185 | 188 | private fun setQuickStart(screen: ConnectAssistUiState) {
|
186 | 189 | binding.quickstartSwitch.visibility =
|
187 | 190 | if (screen.quickstartSwitchVisible) View.VISIBLE else View.GONE
|
188 | - binding.quickstartSwitch.isChecked = viewModel.quickstartToggle().value == true
|
|
189 | 191 | binding.quickstartSwitch.setOnCheckedChangeListener { _, isChecked ->
|
190 | - viewModel.handleQuickstartChecked(isChecked)
|
|
192 | + quickstartViewModel.quickstartSet(isChecked)
|
|
191 | 193 | }
|
192 | 194 | }
|
193 | 195 |
... | ... | @@ -27,13 +27,6 @@ class TorConnectionAssistViewModel( |
27 | 27 | private val _torConnectScreen = MutableStateFlow(ConnectAssistUiState.Splash)
|
28 | 28 | internal val torConnectScreen: StateFlow<ConnectAssistUiState> = _torConnectScreen
|
29 | 29 | |
30 | - private val _quickStartToggle = MutableLiveData<Boolean>() // don't initialize with quickstart off the bat
|
|
31 | - fun quickstartToggle(): LiveData<Boolean?> {
|
|
32 | - _quickStartToggle.value = _torController.quickstart // quickstart isn't ready until torSettings is ready
|
|
33 | - return _quickStartToggle
|
|
34 | - }
|
|
35 | - |
|
36 | - |
|
37 | 30 | private val _shouldOpenHome = MutableLiveData(false)
|
38 | 31 | fun shouldOpenHome(): LiveData<Boolean> {
|
39 | 32 | return _shouldOpenHome
|
... | ... | @@ -66,11 +59,6 @@ class TorConnectionAssistViewModel( |
66 | 59 | }
|
67 | 60 | }
|
68 | 61 | |
69 | - fun handleQuickstartChecked(checked: Boolean) {
|
|
70 | - _torController.quickstart = checked
|
|
71 | - _quickStartToggle.value = checked
|
|
72 | - }
|
|
73 | - |
|
74 | 62 | fun handleButton1Pressed(
|
75 | 63 | screen: ConnectAssistUiState,
|
76 | 64 | lifecycleScope: LifecycleCoroutineScope?,
|
... | ... | @@ -40,7 +40,6 @@ interface TorController: TorEvents { |
40 | 40 | var bridgesEnabled: Boolean
|
41 | 41 | var bridgeTransport: TorBridgeTransportConfig
|
42 | 42 | var userProvidedBridges: String?
|
43 | - var quickstart: Boolean
|
|
44 | 43 | |
45 | 44 | fun start()
|
46 | 45 | fun stop()
|
... | ... | @@ -73,17 +73,6 @@ class TorControllerGV( |
73 | 73 | override val isBootstrapped get() = isTorBootstrapped
|
74 | 74 | override val isConnected get() = (_lastKnownStatus.value.isStarted() && !isTorRestarting)
|
75 | 75 | |
76 | - override var quickstart: Boolean
|
|
77 | - get() {
|
|
78 | - return getTorSettings()?.quickstart ?: false
|
|
79 | - }
|
|
80 | - set(value) {
|
|
81 | - getTorSettings()?.let {
|
|
82 | - it.quickstart = value
|
|
83 | - getTorIntegration().setSettings(it)
|
|
84 | - }
|
|
85 | - }
|
|
86 | - |
|
87 | 76 | private fun getTorIntegration(): TorIntegrationAndroid {
|
88 | 77 | return (context.components.core.engine as GeckoEngine).getTorIntegrationController()
|
89 | 78 | }
|
... | ... | @@ -176,7 +176,7 @@ |
176 | 176 | android:title="@string/preferences_tor_network_settings_bridge_config"
|
177 | 177 | android:summary="@string/preferences_tor_network_settings_bridge_config_description" />
|
178 | 178 | |
179 | - <org.mozilla.fenix.tor.QuickStartPreference
|
|
179 | + <SwitchPreference
|
|
180 | 180 | android:key="@string/pref_key_quick_start"
|
181 | 181 | android:summary="@string/connection_assist_always_connect_automatically_toggle_description"
|
182 | 182 | android:title="@string/tor_bootstrap_quick_start_label"
|
... | ... | @@ -52,6 +52,8 @@ public class TorIntegrationAndroid implements BundleEventListener { |
52 | 52 | private static final String EVENT_BOOTSTRAP_BEGIN_AUTO = "GeckoView:Tor:BootstrapBeginAuto";
|
53 | 53 | private static final String EVENT_BOOTSTRAP_CANCEL = "GeckoView:Tor:BootstrapCancel";
|
54 | 54 | private static final String EVENT_BOOTSTRAP_GET_STATE = "GeckoView:Tor:BootstrapGetState";
|
55 | + private static final String EVENT_QUICKSTART_GET = "GeckoView:Tor:QuickstartGet";
|
|
56 | + private static final String EVENT_QUICKSTART_SET = "GeckoView:Tor:QuickstartSet";
|
|
55 | 57 | |
56 | 58 | private static final String CONTROL_PORT_FILE = "/control-ipc";
|
57 | 59 | private static final String SOCKS_FILE = "/socks-ipc";
|
... | ... | @@ -682,6 +684,23 @@ public class TorIntegrationAndroid implements BundleEventListener { |
682 | 684 | return EventDispatcher.getInstance().queryVoid(EVENT_SETTINGS_SET, bundle);
|
683 | 685 | }
|
684 | 686 | |
687 | + public interface QuickstartGetter {
|
|
688 | + void onValue(boolean enabled);
|
|
689 | + }
|
|
690 | + |
|
691 | + public void quickstartGet(QuickstartGetter quickstartGetter) {
|
|
692 | + EventDispatcher.getInstance().queryBoolean(EVENT_QUICKSTART_GET).then(enabled -> {
|
|
693 | + quickstartGetter.onValue(Boolean.TRUE.equals(enabled));
|
|
694 | + return new GeckoResult<Void>();
|
|
695 | + });
|
|
696 | + }
|
|
697 | + |
|
698 | + public @NonNull GeckoResult<Void> quickstartSet(boolean enabled) {
|
|
699 | + final GeckoBundle bundle = new GeckoBundle(1);
|
|
700 | + bundle.putBoolean("enabled", enabled);
|
|
701 | + return EventDispatcher.getInstance().queryVoid(EVENT_QUICKSTART_SET, bundle);
|
|
702 | + }
|
|
703 | + |
|
685 | 704 | public @NonNull GeckoResult<Void> beginBootstrap() {
|
686 | 705 | return EventDispatcher.getInstance().queryVoid(EVENT_BOOTSTRAP_BEGIN);
|
687 | 706 | }
|
... | ... | @@ -101,8 +101,6 @@ public class TorSettings { |
101 | 101 | |
102 | 102 | public boolean enabled = true;
|
103 | 103 | |
104 | - public boolean quickstart = false;
|
|
105 | - |
|
106 | 104 | // bridges section
|
107 | 105 | public boolean bridgesEnabled = false;
|
108 | 106 | public BridgeSource bridgesSource = BridgeSource.Invalid;
|
... | ... | @@ -125,7 +123,6 @@ public class TorSettings { |
125 | 123 | |
126 | 124 | public TorSettings(GeckoBundle bundle) {
|
127 | 125 | try {
|
128 | - GeckoBundle qs = bundle.getBundle("quickstart");
|
|
129 | 126 | GeckoBundle bridges = bundle.getBundle("bridges");
|
130 | 127 | GeckoBundle proxy = bundle.getBundle("proxy");
|
131 | 128 | GeckoBundle firewall = bundle.getBundle("firewall");
|
... | ... | @@ -135,8 +132,6 @@ public class TorSettings { |
135 | 132 | bridgesBuiltinType = BridgeBuiltinType.fromString(bridges.getString("builtin_type"));
|
136 | 133 | bridgeBridgeStrings = bridges.getStringArray("bridge_strings");
|
137 | 134 | |
138 | - quickstart = qs.getBoolean("enabled");
|
|
139 | - |
|
140 | 135 | firewallEnabled = firewall.getBoolean("enabled");
|
141 | 136 | firewallAllowedPorts = firewall.getIntArray("allowed_ports");
|
142 | 137 | |
... | ... | @@ -156,7 +151,6 @@ public class TorSettings { |
156 | 151 | public GeckoBundle asGeckoBundle() {
|
157 | 152 | GeckoBundle bundle = new GeckoBundle();
|
158 | 153 | |
159 | - GeckoBundle qs = new GeckoBundle();
|
|
160 | 154 | GeckoBundle bridges = new GeckoBundle();
|
161 | 155 | GeckoBundle proxy = new GeckoBundle();
|
162 | 156 | GeckoBundle firewall = new GeckoBundle();
|
... | ... | @@ -166,8 +160,6 @@ public class TorSettings { |
166 | 160 | bridges.putString("builtin_type", bridgesBuiltinType.toString());
|
167 | 161 | bridges.putStringArray("bridge_strings", bridgeBridgeStrings);
|
168 | 162 | |
169 | - qs.putBoolean("enabled", quickstart);
|
|
170 | - |
|
171 | 163 | firewall.putBoolean("enabled", firewallEnabled);
|
172 | 164 | firewall.putIntArray("allowed_ports", firewallAllowedPorts);
|
173 | 165 | |
... | ... | @@ -178,7 +170,6 @@ public class TorSettings { |
178 | 170 | proxy.putInt("port", proxyPort);
|
179 | 171 | proxy.putInt("type", proxyType.toInt());
|
180 | 172 | |
181 | - bundle.putBundle("quickstart", qs);
|
|
182 | 173 | bundle.putBundle("bridges", bridges);
|
183 | 174 | bundle.putBundle("proxy", proxy);
|
184 | 175 | bundle.putBundle("firewall", firewall);
|
... | ... | @@ -24,9 +24,6 @@ public class TorLegacyAndroidSettings { |
24 | 24 | // always true, tor is enabled in TB
|
25 | 25 | settings.enabled = true;
|
26 | 26 | |
27 | - // firefox-android disconnected quick start a while ago so it's untracked
|
|
28 | - settings.quickstart = false;
|
|
29 | - |
|
30 | 27 | settings.bridgesEnabled = Prefs.bridgesEnabled();
|
31 | 28 | |
32 | 29 | // tor-android-service CustomTorInstaller.java
|
... | ... | @@ -41,12 +41,19 @@ const ListenedEvents = Object.freeze({ |
41 | 41 | bootstrapBeginAuto: "GeckoView:Tor:BootstrapBeginAuto",
|
42 | 42 | bootstrapCancel: "GeckoView:Tor:BootstrapCancel",
|
43 | 43 | bootstrapGetState: "GeckoView:Tor:BootstrapGetState",
|
44 | + quickstartGet: "GeckoView:Tor:QuickstartGet",
|
|
45 | + quickstartSet: "GeckoView:Tor:QuickstartSet",
|
|
44 | 46 | });
|
45 | 47 | |
46 | 48 | class TorAndroidIntegrationImpl {
|
47 | 49 | #initialized = false;
|
48 | 50 | |
49 | - async init() {
|
|
51 | + /**
|
|
52 | + * Register our listeners.
|
|
53 | + * We want this function to block GeckoView initialization, so it should not be
|
|
54 | + * async. Any async task should be moved to #deferredInit, instead.
|
|
55 | + */
|
|
56 | + init() {
|
|
50 | 57 | if (this.#initialized) {
|
51 | 58 | logger.warn("Something tried to initilize us again.");
|
52 | 59 | return;
|
... | ... | @@ -74,6 +81,14 @@ class TorAndroidIntegrationImpl { |
74 | 81 | // by TorProviderBuilder.init.
|
75 | 82 | lazy.TorProviderBuilder.firstWindowLoaded();
|
76 | 83 | |
84 | + this.#deferredInit();
|
|
85 | + }
|
|
86 | + |
|
87 | + /**
|
|
88 | + * Perform our init tasks that should not block the initialization of
|
|
89 | + * GeckoView. This function will not be awaited, so errors can only be logged.
|
|
90 | + */
|
|
91 | + async #deferredInit() {
|
|
77 | 92 | try {
|
78 | 93 | await lazy.TorSettings.init();
|
79 | 94 | await lazy.TorConnect.init();
|
... | ... | @@ -82,24 +97,6 @@ class TorAndroidIntegrationImpl { |
82 | 97 | }
|
83 | 98 | }
|
84 | 99 | |
85 | - /**
|
|
86 | - * Combine the current TorSettings settings with the TorConnect settings.
|
|
87 | - *
|
|
88 | - * @returns {object} The TorSettings in an object, which also has a
|
|
89 | - * `quickstart.enabled` property.
|
|
90 | - */
|
|
91 | - // This is added for backward compatibility with TorSettings.getSettings prior
|
|
92 | - // to tor-browser#41921, when it used to control the quickstart setting.
|
|
93 | - // TODO: Have android separate out the request for TorConnect.quickstart. In
|
|
94 | - // principle, this would allow android tor connect UI to be loaded before
|
|
95 | - // TorSettings has initialized (the SettingsReady signal), similar to desktop.
|
|
96 | - // See tor-browser#43408.
|
|
97 | - #getAllSettings() {
|
|
98 | - const settings = lazy.TorSettings.getSettings();
|
|
99 | - settings.quickstart = { enabled: lazy.TorConnect.quickstart };
|
|
100 | - return settings;
|
|
101 | - }
|
|
102 | - |
|
103 | 100 | observe(subj, topic) {
|
104 | 101 | switch (topic) {
|
105 | 102 | // TODO: Replace with StageChange.
|
... | ... | @@ -142,7 +139,7 @@ class TorAndroidIntegrationImpl { |
142 | 139 | case lazy.TorSettingsTopics.Ready:
|
143 | 140 | lazy.EventDispatcher.instance.sendRequest({
|
144 | 141 | type: EmittedEvents.settingsReady,
|
145 | - settings: this.#getAllSettings(),
|
|
142 | + settings: lazy.TorSettings.getSettings(),
|
|
146 | 143 | });
|
147 | 144 | break;
|
148 | 145 | case lazy.TorSettingsTopics.SettingsChanged:
|
... | ... | @@ -151,20 +148,7 @@ class TorAndroidIntegrationImpl { |
151 | 148 | lazy.EventDispatcher.instance.sendRequest({
|
152 | 149 | type: EmittedEvents.settingsChanged,
|
153 | 150 | changes: subj.wrappedJSObject.changes ?? [],
|
154 | - settings: this.#getAllSettings(),
|
|
155 | - });
|
|
156 | - break;
|
|
157 | - case lazy.TorConnectTopics.QuickstartChange:
|
|
158 | - // We also include the TorSettings, and a `changes` Array similar to
|
|
159 | - // SettingsChanged signal. This is for backward compatibility with
|
|
160 | - // TorSettings.getSettings prior to tor-browser#41921, when it used to
|
|
161 | - // control the quickstart setting.
|
|
162 | - // TODO: Have android separate out the request for TorConnect.quickstart.
|
|
163 | - // See tor-browser#43408.
|
|
164 | - lazy.EventDispatcher.instance.sendRequest({
|
|
165 | - type: EmittedEvents.settingsChanged,
|
|
166 | - changes: ["quickstart.enabled"],
|
|
167 | - settings: this.#getAllSettings(),
|
|
151 | + settings: lazy.TorSettings.getSettings(),
|
|
168 | 152 | });
|
169 | 153 | break;
|
170 | 154 | }
|
... | ... | @@ -175,19 +159,9 @@ class TorAndroidIntegrationImpl { |
175 | 159 | try {
|
176 | 160 | switch (event) {
|
177 | 161 | case ListenedEvents.settingsGet:
|
178 | - callback?.onSuccess(this.#getAllSettings());
|
|
162 | + callback?.onSuccess(lazy.TorSettings.getSettings());
|
|
179 | 163 | return;
|
180 | 164 | case ListenedEvents.settingsSet:
|
181 | - // TODO: Set quickstart via a separate event. See tor-browser#43408.
|
|
182 | - // NOTE: Currently this may trigger GeckoView:Tor:SettingsChanged
|
|
183 | - // twice: once for quickstart.enabled, and again for the other
|
|
184 | - // settings.
|
|
185 | - if (
|
|
186 | - "quickstart" in data.settings &&
|
|
187 | - "enabled" in data.settings.quickstart
|
|
188 | - ) {
|
|
189 | - lazy.TorConnect.quickstart = data.settings.quickstart.enabled;
|
|
190 | - }
|
|
191 | 165 | // TODO: Handle setting throw? This can throw if data.settings is
|
192 | 166 | // incorrectly formatted, but more like it can throw when the settings
|
193 | 167 | // fail to be passed onto the TorProvider. tor-browser#43405.
|
... | ... | @@ -211,6 +185,12 @@ class TorAndroidIntegrationImpl { |
211 | 185 | return;
|
212 | 186 | // TODO: Expose TorConnect.startAgain() to allow users to begin
|
213 | 187 | // from the start again.
|
188 | + case ListenedEvents.quickstartGet:
|
|
189 | + callback?.onSuccess(lazy.TorConnect.quickstart);
|
|
190 | + return;
|
|
191 | + case ListenedEvents.quickstartSet:
|
|
192 | + lazy.TorConnect.quickstart = data.enabled;
|
|
193 | + break;
|
|
214 | 194 | }
|
215 | 195 | callback?.onSuccess();
|
216 | 196 | } catch (e) {
|