Dan Ballard pushed to branch firefox-android-115.2.1-13.5-1 at The Tor Project / Applications / firefox-android
Commits:
-
50c4fb9d
by clairehurst at 2024-05-09T14:51:05-06:00
13 changed files:
- fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
- fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt
- fenix/app/src/main/java/org/mozilla/fenix/components/Components.kt
- fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt
- fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt
- − fenix/app/src/main/java/org/mozilla/fenix/tor/TorBetaConnectionFeaturesFragment.kt
- fenix/app/src/main/java/org/mozilla/fenix/tor/TorBootstrapFragment.kt
- fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt
- fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
- − fenix/app/src/main/res/layout/tor_network_settings_beta_connection_features.xml
- fenix/app/src/main/res/navigation/nav_graph.xml
- fenix/app/src/main/res/values/preference_keys.xml
- fenix/app/src/main/res/xml/preferences.xml
Changes:
... | ... | @@ -1186,19 +1186,15 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, TorIn |
1186 | 1186 | }
|
1187 | 1187 | |
1188 | 1188 | open fun navigateToHome() {
|
1189 | - if (settings().useNewBootstrap) {
|
|
1190 | - if (settings().useNewBootstrapNativeUi) {
|
|
1191 | - navHost.navController.navigate(NavGraphDirections.actionStartupTorConnectionAssist())
|
|
1192 | - } else {
|
|
1193 | - navHost.navController.navigate(NavGraphDirections.actionStartupHome())
|
|
1194 | - openToBrowserAndLoad(
|
|
1195 | - searchTermOrURL = "about:torconnect",
|
|
1196 | - newTab = true,
|
|
1197 | - from = BrowserDirection.FromHome,
|
|
1198 | - )
|
|
1199 | - }
|
|
1189 | + if (!settings().useHtmlConnectionUi) {
|
|
1190 | + navHost.navController.navigate(NavGraphDirections.actionStartupTorConnectionAssist())
|
|
1200 | 1191 | } else {
|
1201 | - navHost.navController.navigate(NavGraphDirections.actionStartupTorbootstrap())
|
|
1192 | + navHost.navController.navigate(NavGraphDirections.actionStartupHome())
|
|
1193 | + openToBrowserAndLoad(
|
|
1194 | + searchTermOrURL = "about:torconnect",
|
|
1195 | + newTab = true,
|
|
1196 | + from = BrowserDirection.FromHome,
|
|
1197 | + )
|
|
1202 | 1198 | }
|
1203 | 1199 | }
|
1204 | 1200 |
... | ... | @@ -1217,12 +1217,7 @@ abstract class BaseBrowserFragment : |
1217 | 1217 | private fun handleBetaHtmlTorConnect() {
|
1218 | 1218 | val currentTab = getCurrentTab() ?: return
|
1219 | 1219 | if (currentTab.content.url == "about:torconnect") {
|
1220 | - if (!requireActivity().settings().useNewBootstrap) {
|
|
1221 | - requireContext().components.useCases.tabsUseCases.removeTab(currentTab.id)
|
|
1222 | - (requireActivity() as HomeActivity).navHost.navController.navigate(
|
|
1223 | - NavGraphDirections.actionStartupTorbootstrap(),
|
|
1224 | - )
|
|
1225 | - } else if (!requireActivity().settings().useNewBootstrapHtmlUi) {
|
|
1220 | + if (!requireActivity().settings().useHtmlConnectionUi) {
|
|
1226 | 1221 | requireContext().components.useCases.tabsUseCases.removeTab(currentTab.id)
|
1227 | 1222 | (requireActivity() as HomeActivity).navigateToHome()
|
1228 | 1223 | } else {
|
... | ... | @@ -202,7 +202,7 @@ class Components(private val context: Context) { |
202 | 202 | ),
|
203 | 203 | )
|
204 | 204 | }
|
205 | - val torController by lazyMonitored { if (settings.useNewBootstrap) TorControllerGV(context) else TorControllerTAS(context) }
|
|
205 | + val torController by lazyMonitored { TorControllerGV(context) }
|
|
206 | 206 | }
|
207 | 207 | |
208 | 208 | /**
|
... | ... | @@ -145,7 +145,6 @@ class Core( |
145 | 145 | .shouldShowCookieBannerReEngagementDialog(),
|
146 | 146 | torSecurityLevel = context.settings().torSecurityLevel().intRepresentation,
|
147 | 147 | spoofEnglish = context.settings().spoofEnglish,
|
148 | - useNewBootstrap = context.settings().useNewBootstrap,
|
|
149 | 148 | )
|
150 | 149 | |
151 | 150 | GeckoEngine(
|
... | ... | @@ -40,6 +40,7 @@ import mozilla.components.concept.sync.Profile |
40 | 40 | import mozilla.components.service.glean.private.NoExtras
|
41 | 41 | import mozilla.components.support.ktx.android.view.showKeyboard
|
42 | 42 | import org.mozilla.fenix.BrowserDirection
|
43 | +import org.mozilla.fenix.BuildConfig
|
|
43 | 44 | import org.mozilla.fenix.Config
|
44 | 45 | import org.mozilla.fenix.FeatureFlags
|
45 | 46 | import org.mozilla.fenix.GleanMetrics.Addons
|
... | ... | @@ -738,13 +739,9 @@ class SettingsFragment : PreferenceFragmentCompat() { |
738 | 739 | }
|
739 | 740 | }
|
740 | 741 | |
741 | - requirePreference<Preference>(R.string.pref_key_use_new_bootstrap).apply {
|
|
742 | - setOnPreferenceClickListener {
|
|
743 | - val directions =
|
|
744 | - SettingsFragmentDirections.actionSettingsFragmentToBetaConnectionFeaturesFragment()
|
|
745 | - requireView().findNavController().navigate(directions)
|
|
746 | - true
|
|
747 | - }
|
|
742 | + requirePreference<Preference>(R.string.pref_key_use_html_connection_ui).apply {
|
|
743 | + onPreferenceChangeListener = object : SharedPreferenceUpdater() {}
|
|
744 | + isVisible = BuildConfig.DEBUG
|
|
748 | 745 | }
|
749 | 746 | |
750 | 747 | requirePreference<Preference>(R.string.pref_key_tor_logs).apply {
|
1 | -/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2 | - * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3 | - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
4 | - |
|
5 | -package org.mozilla.fenix.tor
|
|
6 | - |
|
7 | -import android.os.Bundle
|
|
8 | -import android.view.LayoutInflater
|
|
9 | -import android.view.View
|
|
10 | -import android.view.ViewGroup
|
|
11 | -import androidx.core.view.children
|
|
12 | -import androidx.fragment.app.Fragment
|
|
13 | -import org.mozilla.fenix.databinding.TorNetworkSettingsBetaConnectionFeaturesBinding
|
|
14 | -import org.mozilla.fenix.ext.components
|
|
15 | -import org.mozilla.fenix.ext.settings
|
|
16 | - |
|
17 | -/**
|
|
18 | - * Lets the user customize beta connection features mode.
|
|
19 | - */
|
|
20 | -class TorBetaConnectionFeaturesFragment : Fragment() {
|
|
21 | - override fun onCreateView(
|
|
22 | - inflater: LayoutInflater,
|
|
23 | - container: ViewGroup?,
|
|
24 | - savedInstanceState: Bundle?,
|
|
25 | - ): View {
|
|
26 | - val binding = TorNetworkSettingsBetaConnectionFeaturesBinding.inflate(inflater)
|
|
27 | - |
|
28 | - binding.enableBetaConnectionFeaturesSwitch.run {
|
|
29 | - isChecked = context.settings().useNewBootstrap
|
|
30 | - setConnectionAssistUI(binding, isChecked)
|
|
31 | - |
|
32 | - setOnCheckedChangeListener { _, isConnectionAssistEnabled ->
|
|
33 | - context.settings().useNewBootstrap = isConnectionAssistEnabled
|
|
34 | - setConnectionAssistUI(binding, isConnectionAssistEnabled)
|
|
35 | - updateEngineConnectionAssistMode()
|
|
36 | - }
|
|
37 | - }
|
|
38 | - |
|
39 | - // Since the beta connection features modes are in a RadioGroup we only need one listener to know of all their changes.
|
|
40 | - binding.useNewBootstrapWithNativeUiRadioButton.setOnCheckedChangeListener { _, _ ->
|
|
41 | - updateEngineConnectionAssistMode()
|
|
42 | - }
|
|
43 | - |
|
44 | - return binding.root
|
|
45 | - }
|
|
46 | - |
|
47 | - private fun setConnectionAssistUI(
|
|
48 | - binding: TorNetworkSettingsBetaConnectionFeaturesBinding,
|
|
49 | - isBetaConnectionAssistEnabled: Boolean,
|
|
50 | - ) {
|
|
51 | - if (!isBetaConnectionAssistEnabled) {
|
|
52 | - binding.enableBetaConnectionFeaturesModes.apply {
|
|
53 | - clearCheck()
|
|
54 | - children.forEach { it.isEnabled = false }
|
|
55 | - }
|
|
56 | - } else {
|
|
57 | - binding.enableBetaConnectionFeaturesModes.children.forEach { it.isEnabled = true }
|
|
58 | - }
|
|
59 | - }
|
|
60 | - |
|
61 | - private fun updateEngineConnectionAssistMode() {
|
|
62 | - requireContext().components.core.engine.settings.useNewBootstrap =
|
|
63 | - requireContext().settings().useNewBootstrap
|
|
64 | - }
|
|
65 | - |
|
66 | -} |
... | ... | @@ -164,9 +164,7 @@ class TorBootstrapFragment : Fragment() { |
164 | 164 | // triggered to cause an automatic update on warm start (no tab selection occurs). So we
|
165 | 165 | // update it manually here.
|
166 | 166 | requireComponents.useCases.sessionUseCases.updateLastAccess()
|
167 | - if (requireContext().settings().useNewBootstrap){
|
|
168 | - (requireActivity() as HomeActivity).navigateToHome()
|
|
169 | - }
|
|
167 | + (requireActivity() as HomeActivity).navigateToHome()
|
|
170 | 168 | }
|
171 | 169 | |
172 | 170 | private fun handleTorBootstrapConnect() {
|
... | ... | @@ -21,7 +21,7 @@ class TorConnectionAssistViewModel( |
21 | 21 | private val TAG = "torConnectionAssistVM"
|
22 | 22 | private val components = getApplication<Application>().components
|
23 | 23 | |
24 | - private val _torController: TorControllerGV = components.torController as TorControllerGV
|
|
24 | + private val _torController: TorControllerGV = components.torController
|
|
25 | 25 | |
26 | 26 | private val _torConnectScreen = MutableStateFlow(ConnectAssistUiState.Splash)
|
27 | 27 | internal val torConnectScreen: StateFlow<ConnectAssistUiState> = _torConnectScreen
|
... | ... | @@ -1855,18 +1855,8 @@ class Settings(private val appContext: Context) : PreferencesHolder { |
1855 | 1855 | */
|
1856 | 1856 | var enableUnifiedSearchSettingsUI: Boolean = showUnifiedSearchFeature && FeatureFlags.unifiedSearchSettings
|
1857 | 1857 | |
1858 | - var useNewBootstrap by booleanPreference(
|
|
1859 | - appContext.getPreferenceKey(R.string.pref_key_use_new_bootstrap),
|
|
1860 | - default = true,
|
|
1861 | - )
|
|
1862 | - |
|
1863 | - var useNewBootstrapNativeUi by booleanPreference(
|
|
1864 | - appContext.getPreferenceKey(R.string.pref_key_use_new_bootstrap_with_android_native),
|
|
1865 | - default = true,
|
|
1866 | - )
|
|
1867 | - |
|
1868 | - var useNewBootstrapHtmlUi by booleanPreference(
|
|
1869 | - appContext.getPreferenceKey(R.string.pref_key_use_new_bootstrap_with_html),
|
|
1870 | - default = false
|
|
1858 | + var useHtmlConnectionUi by booleanPreference(
|
|
1859 | + appContext.getPreferenceKey(R.string.pref_key_use_html_connection_ui),
|
|
1860 | + default = false,
|
|
1871 | 1861 | )
|
1872 | 1862 | } |
1 | -<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
2 | - - License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3 | - - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
4 | -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
5 | - xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
6 | - android:layout_width="match_parent"
|
|
7 | - android:layout_height="wrap_content">
|
|
8 | - |
|
9 | - <TextView
|
|
10 | - android:id="@+id/enable_beta_connection_features_title"
|
|
11 | - android:layout_width="0dp"
|
|
12 | - android:layout_height="wrap_content"
|
|
13 | - android:layout_marginStart="16dp"
|
|
14 | - android:layout_marginTop="16dp"
|
|
15 | - android:layout_marginBottom="2dp"
|
|
16 | - android:clickable="false"
|
|
17 | - android:text="Enable beta connection features"
|
|
18 | - android:textAppearance="@style/ListItemTextStyle"
|
|
19 | - android:textSize="16sp"
|
|
20 | - app:layout_constraintBottom_toTopOf="@id/enable_beta_connection_features_summary"
|
|
21 | - app:layout_constraintEnd_toStartOf="@id/enable_beta_connection_features_switch"
|
|
22 | - app:layout_constraintStart_toStartOf="parent"
|
|
23 | - app:layout_constraintTop_toTopOf="parent"
|
|
24 | - app:lineHeight="24.sp" />
|
|
25 | - |
|
26 | - <TextView
|
|
27 | - android:id="@+id/enable_beta_connection_features_summary"
|
|
28 | - android:layout_width="0dp"
|
|
29 | - android:layout_height="wrap_content"
|
|
30 | - android:text="Help us test our new connection assist features which focuses on a streamlined connection with better integration with bridges"
|
|
31 | - android:textColor="?attr/textSecondary"
|
|
32 | - android:textColorLink="?attr/textSecondary"
|
|
33 | - android:textSize="12sp"
|
|
34 | - app:layout_constraintBottom_toTopOf="@id/enable_beta_connection_features_modes"
|
|
35 | - app:layout_constraintEnd_toEndOf="@id/enable_beta_connection_features_title"
|
|
36 | - app:layout_constraintStart_toStartOf="@id/enable_beta_connection_features_title"
|
|
37 | - app:layout_constraintTop_toBottomOf="@id/enable_beta_connection_features_title"
|
|
38 | - app:lineHeight="16.sp" />
|
|
39 | - |
|
40 | - <androidx.appcompat.widget.SwitchCompat
|
|
41 | - android:id="@+id/enable_beta_connection_features_switch"
|
|
42 | - android:layout_width="wrap_content"
|
|
43 | - android:layout_height="wrap_content"
|
|
44 | - android:minHeight="48dp"
|
|
45 | - android:paddingStart="18dp"
|
|
46 | - android:paddingEnd="18dp"
|
|
47 | - android:textColor="@color/state_list_text_color"
|
|
48 | - android:textOff="@string/studies_off"
|
|
49 | - android:textOn="@string/studies_on"
|
|
50 | - app:layout_constraintEnd_toEndOf="parent"
|
|
51 | - app:layout_constraintTop_toTopOf="@id/enable_beta_connection_features_title" />
|
|
52 | - |
|
53 | - <RadioGroup
|
|
54 | - android:id="@+id/enable_beta_connection_features_modes"
|
|
55 | - android:layout_width="match_parent"
|
|
56 | - android:layout_height="wrap_content"
|
|
57 | - android:layout_marginTop="10dp"
|
|
58 | - app:layout_constraintEnd_toEndOf="parent"
|
|
59 | - app:layout_constraintStart_toStartOf="parent"
|
|
60 | - app:layout_constraintTop_toBottomOf="@id/enable_beta_connection_features_summary">
|
|
61 | - |
|
62 | - <org.mozilla.fenix.settings.PreferenceBackedRadioButton
|
|
63 | - android:id="@+id/use_new_bootstrap_with_native_ui_radio_button"
|
|
64 | - android:layout_width="match_parent"
|
|
65 | - android:layout_height="wrap_content"
|
|
66 | - android:background="?android:attr/selectableItemBackground"
|
|
67 | - android:button="@null"
|
|
68 | - android:drawablePadding="@dimen/radio_button_preference_drawable_padding"
|
|
69 | - android:paddingStart="@dimen/radio_button_preference_horizontal"
|
|
70 | - android:paddingTop="@dimen/radio_button_preference_vertical"
|
|
71 | - android:paddingEnd="@dimen/radio_button_preference_horizontal"
|
|
72 | - android:paddingBottom="@dimen/radio_button_preference_vertical"
|
|
73 | - android:text="Native Android UI"
|
|
74 | - android:textAppearance="?android:attr/textAppearanceListItem"
|
|
75 | - android:textSize="16sp"
|
|
76 | - app:drawableStartCompat="?android:attr/listChoiceIndicatorSingle"
|
|
77 | - app:preferenceKey="@string/pref_key_use_new_bootstrap_with_android_native"
|
|
78 | - app:preferenceKeyDefaultValue="true" />
|
|
79 | - |
|
80 | - <org.mozilla.fenix.settings.PreferenceBackedRadioButton
|
|
81 | - android:id="@+id/use_new_bootstrap_with_html_ui_radio_button"
|
|
82 | - android:layout_width="match_parent"
|
|
83 | - android:layout_height="48dp"
|
|
84 | - android:background="?android:attr/selectableItemBackground"
|
|
85 | - android:button="@null"
|
|
86 | - android:drawablePadding="@dimen/radio_button_preference_drawable_padding"
|
|
87 | - android:paddingStart="@dimen/radio_button_preference_horizontal"
|
|
88 | - android:paddingTop="@dimen/radio_button_preference_vertical"
|
|
89 | - android:paddingEnd="@dimen/radio_button_preference_horizontal"
|
|
90 | - android:paddingBottom="@dimen/radio_button_preference_vertical"
|
|
91 | - android:text="HTML UI"
|
|
92 | - android:textAppearance="?android:attr/textAppearanceListItem"
|
|
93 | - android:textSize="16sp"
|
|
94 | - app:drawableStartCompat="?android:attr/listChoiceIndicatorSingle"
|
|
95 | - app:preferenceKey="@string/pref_key_use_new_bootstrap_with_html"
|
|
96 | - app:preferenceKeyDefaultValue="false" />
|
|
97 | - </RadioGroup>
|
|
98 | - |
|
99 | -</androidx.constraintlayout.widget.ConstraintLayout> |
... | ... | @@ -977,11 +977,6 @@ |
977 | 977 | android:id="@+id/torBridgeConfigFragment"
|
978 | 978 | android:name="org.mozilla.fenix.settings.TorBridgeConfigFragment"
|
979 | 979 | android:label="@string/preferences_tor_network_settings_bridge_config" />
|
980 | - <fragment
|
|
981 | - android:id="@+id/torBetaConnectionFeaturesFragment"
|
|
982 | - android:name="org.mozilla.fenix.tor.TorBetaConnectionFeaturesFragment"
|
|
983 | - android:label="Enable beta connection features"
|
|
984 | - tools:layout="@layout/tor_network_settings_beta_connection_features" />
|
|
985 | 980 | <fragment
|
986 | 981 | android:id="@+id/torLogsFragment"
|
987 | 982 | android:name="org.mozilla.fenix.tor.TorLogsComposeFragment"
|
... | ... | @@ -378,10 +378,8 @@ |
378 | 378 | |
379 | 379 | <string name="pref_key_tor_network_settings_explanation" translatable="false">pref_key_tor_network_settings_explanation</string>
|
380 | 380 | <string name="pref_key_tor_network_settings_bridge_config" translatable="false">pref_key_tor_network_settings_bridge_config</string>
|
381 | - <string name="pref_key_use_new_bootstrap" translatable="false">pref_key_use_new_bootstrap</string>
|
|
382 | 381 | <string name="pref_key_tor_logs" translatable="false">pref_key_tor_logs</string>
|
383 | - <string name="pref_key_use_new_bootstrap_with_android_native" translatable="false">pref_key_use_new_bootstrap_with_android_native</string>
|
|
384 | - <string name="pref_key_use_new_bootstrap_with_html" translatable="false">pref_key_use_new_bootstrap_with_html</string>
|
|
382 | + <string name="pref_key_use_html_connection_ui" translatable="false">pref_key_use_html_connection_ui</string> <!-- Changing the pref_key should reset it to off for users that had it enabled -->
|
|
385 | 383 | <string name="pref_key_tor_network_settings_bridge_config_explanation" translatable="false">pref_key_tor_network_settings_bridge_config_explanation</string>
|
386 | 384 | <string name="pref_key_tor_network_settings_bridge_config_toggle" translatable="false">pref_key_tor_network_settings_bridge_config_toggle</string>
|
387 | 385 | <string name="pref_key_tor_network_settings_bridge_config_builtin_bridge_obfs4" translatable="false">pref_key_tor_network_settings_bridge_config_builtin_bridge_obfs4</string>
|
... | ... | @@ -176,10 +176,12 @@ |
176 | 176 | android:title="@string/tor_bootstrap_quick_start_label"
|
177 | 177 | app:iconSpaceReserved="false" />
|
178 | 178 | |
179 | - <Preference
|
|
180 | - android:key="@string/pref_key_use_new_bootstrap"
|
|
181 | - app:iconSpaceReserved="false"
|
|
182 | - android:title="Enable beta connection features" />
|
|
179 | + <SwitchPreference
|
|
180 | + android:defaultValue="false"
|
|
181 | + android:key="@string/pref_key_use_html_connection_ui"
|
|
182 | + android:summary="Recommended only for debugging"
|
|
183 | + android:title="Enable HTML connection UI"
|
|
184 | + app:iconSpaceReserved="false" />
|
|
183 | 185 | |
184 | 186 | <Preference
|
185 | 187 | android:key="@string/pref_key_tor_logs"
|