[tbb-commits] [Git][tpo/applications/firefox-android][firefox-android-115.2.1-13.5-1] fixup! Enable the connect assist experiments on alpha

Dan Ballard (@dan) git at gitlab.torproject.org
Thu May 9 21:24:53 UTC 2024



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
fixup! Enable the connect assist experiments on alpha

- - - - -


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:

=====================================
fenix/app/src/main/java/org/mozilla/fenix/HomeActivity.kt
=====================================
@@ -1186,19 +1186,15 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity, TorIn
     }
 
     open fun navigateToHome() {
-        if (settings().useNewBootstrap) {
-            if (settings().useNewBootstrapNativeUi) {
-                navHost.navController.navigate(NavGraphDirections.actionStartupTorConnectionAssist())
-            } else {
-                navHost.navController.navigate(NavGraphDirections.actionStartupHome())
-                openToBrowserAndLoad(
-                    searchTermOrURL = "about:torconnect",
-                    newTab = true,
-                    from = BrowserDirection.FromHome,
-                )
-            }
+        if (!settings().useHtmlConnectionUi) {
+            navHost.navController.navigate(NavGraphDirections.actionStartupTorConnectionAssist())
         } else {
-            navHost.navController.navigate(NavGraphDirections.actionStartupTorbootstrap())
+            navHost.navController.navigate(NavGraphDirections.actionStartupHome())
+            openToBrowserAndLoad(
+                searchTermOrURL = "about:torconnect",
+                newTab = true,
+                from = BrowserDirection.FromHome,
+            )
         }
     }
 


=====================================
fenix/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt
=====================================
@@ -1217,12 +1217,7 @@ abstract class BaseBrowserFragment :
     private fun handleBetaHtmlTorConnect() {
         val currentTab = getCurrentTab() ?: return
         if (currentTab.content.url == "about:torconnect") {
-            if (!requireActivity().settings().useNewBootstrap) {
-                requireContext().components.useCases.tabsUseCases.removeTab(currentTab.id)
-                (requireActivity() as HomeActivity).navHost.navController.navigate(
-                    NavGraphDirections.actionStartupTorbootstrap(),
-                )
-            } else if (!requireActivity().settings().useNewBootstrapHtmlUi) {
+            if (!requireActivity().settings().useHtmlConnectionUi) {
                 requireContext().components.useCases.tabsUseCases.removeTab(currentTab.id)
                 (requireActivity() as HomeActivity).navigateToHome()
             } else {


=====================================
fenix/app/src/main/java/org/mozilla/fenix/components/Components.kt
=====================================
@@ -202,7 +202,7 @@ class Components(private val context: Context) {
             ),
         )
     }
-    val torController by lazyMonitored { if (settings.useNewBootstrap) TorControllerGV(context) else TorControllerTAS(context) }
+    val torController by lazyMonitored { TorControllerGV(context) }
 }
 
 /**


=====================================
fenix/app/src/main/java/org/mozilla/fenix/components/Core.kt
=====================================
@@ -145,7 +145,6 @@ class Core(
                 .shouldShowCookieBannerReEngagementDialog(),
             torSecurityLevel = context.settings().torSecurityLevel().intRepresentation,
             spoofEnglish = context.settings().spoofEnglish,
-            useNewBootstrap = context.settings().useNewBootstrap,
         )
 
         GeckoEngine(


=====================================
fenix/app/src/main/java/org/mozilla/fenix/settings/SettingsFragment.kt
=====================================
@@ -40,6 +40,7 @@ import mozilla.components.concept.sync.Profile
 import mozilla.components.service.glean.private.NoExtras
 import mozilla.components.support.ktx.android.view.showKeyboard
 import org.mozilla.fenix.BrowserDirection
+import org.mozilla.fenix.BuildConfig
 import org.mozilla.fenix.Config
 import org.mozilla.fenix.FeatureFlags
 import org.mozilla.fenix.GleanMetrics.Addons
@@ -738,13 +739,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
             }
         }
 
-        requirePreference<Preference>(R.string.pref_key_use_new_bootstrap).apply {
-            setOnPreferenceClickListener {
-                val directions =
-                    SettingsFragmentDirections.actionSettingsFragmentToBetaConnectionFeaturesFragment()
-                requireView().findNavController().navigate(directions)
-                true
-            }
+        requirePreference<Preference>(R.string.pref_key_use_html_connection_ui).apply {
+            onPreferenceChangeListener = object : SharedPreferenceUpdater() {}
+            isVisible = BuildConfig.DEBUG
         }
 
         requirePreference<Preference>(R.string.pref_key_tor_logs).apply {


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/TorBetaConnectionFeaturesFragment.kt deleted
=====================================
@@ -1,66 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.fenix.tor
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.core.view.children
-import androidx.fragment.app.Fragment
-import org.mozilla.fenix.databinding.TorNetworkSettingsBetaConnectionFeaturesBinding
-import org.mozilla.fenix.ext.components
-import org.mozilla.fenix.ext.settings
-
-/**
- * Lets the user customize beta connection features mode.
- */
-class TorBetaConnectionFeaturesFragment : Fragment() {
-    override fun onCreateView(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-        savedInstanceState: Bundle?,
-    ): View {
-        val binding = TorNetworkSettingsBetaConnectionFeaturesBinding.inflate(inflater)
-
-        binding.enableBetaConnectionFeaturesSwitch.run {
-            isChecked = context.settings().useNewBootstrap
-            setConnectionAssistUI(binding, isChecked)
-
-            setOnCheckedChangeListener { _, isConnectionAssistEnabled ->
-                context.settings().useNewBootstrap = isConnectionAssistEnabled
-                setConnectionAssistUI(binding, isConnectionAssistEnabled)
-                updateEngineConnectionAssistMode()
-            }
-        }
-
-        // Since the beta connection features modes are in a RadioGroup we only need one listener to know of all their changes.
-        binding.useNewBootstrapWithNativeUiRadioButton.setOnCheckedChangeListener { _, _ ->
-            updateEngineConnectionAssistMode()
-        }
-
-        return binding.root
-    }
-
-    private fun setConnectionAssistUI(
-        binding: TorNetworkSettingsBetaConnectionFeaturesBinding,
-        isBetaConnectionAssistEnabled: Boolean,
-    ) {
-        if (!isBetaConnectionAssistEnabled) {
-            binding.enableBetaConnectionFeaturesModes.apply {
-                clearCheck()
-                children.forEach { it.isEnabled = false }
-            }
-        } else {
-            binding.enableBetaConnectionFeaturesModes.children.forEach { it.isEnabled = true }
-        }
-    }
-
-    private fun updateEngineConnectionAssistMode() {
-        requireContext().components.core.engine.settings.useNewBootstrap =
-            requireContext().settings().useNewBootstrap
-    }
-
-}


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/TorBootstrapFragment.kt
=====================================
@@ -164,9 +164,7 @@ class TorBootstrapFragment : Fragment() {
         // triggered to cause an automatic update on warm start (no tab selection occurs). So we
         // update it manually here.
         requireComponents.useCases.sessionUseCases.updateLastAccess()
-        if (requireContext().settings().useNewBootstrap){
-            (requireActivity() as HomeActivity).navigateToHome()
-        }
+        (requireActivity() as HomeActivity).navigateToHome()
     }
 
     private fun handleTorBootstrapConnect() {


=====================================
fenix/app/src/main/java/org/mozilla/fenix/tor/TorConnectionAssistViewModel.kt
=====================================
@@ -21,7 +21,7 @@ class TorConnectionAssistViewModel(
     private val TAG = "torConnectionAssistVM"
     private val components = getApplication<Application>().components
 
-    private val _torController: TorControllerGV = components.torController as TorControllerGV
+    private val _torController: TorControllerGV = components.torController
 
     private val _torConnectScreen = MutableStateFlow(ConnectAssistUiState.Splash)
     internal val torConnectScreen: StateFlow<ConnectAssistUiState> = _torConnectScreen


=====================================
fenix/app/src/main/java/org/mozilla/fenix/utils/Settings.kt
=====================================
@@ -1855,18 +1855,8 @@ class Settings(private val appContext: Context) : PreferencesHolder {
      */
     var enableUnifiedSearchSettingsUI: Boolean = showUnifiedSearchFeature && FeatureFlags.unifiedSearchSettings
 
-    var useNewBootstrap by booleanPreference(
-        appContext.getPreferenceKey(R.string.pref_key_use_new_bootstrap),
-        default = true,
-    )
-
-    var useNewBootstrapNativeUi by booleanPreference(
-        appContext.getPreferenceKey(R.string.pref_key_use_new_bootstrap_with_android_native),
-        default = true,
-    )
-
-    var useNewBootstrapHtmlUi by booleanPreference(
-        appContext.getPreferenceKey(R.string.pref_key_use_new_bootstrap_with_html),
-        default = false
+    var useHtmlConnectionUi by booleanPreference(
+        appContext.getPreferenceKey(R.string.pref_key_use_html_connection_ui),
+        default = false,
     )
 }


=====================================
fenix/app/src/main/res/layout/tor_network_settings_beta_connection_features.xml deleted
=====================================
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-
-    <TextView
-        android:id="@+id/enable_beta_connection_features_title"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="16dp"
-        android:layout_marginTop="16dp"
-        android:layout_marginBottom="2dp"
-        android:clickable="false"
-        android:text="Enable beta connection features"
-        android:textAppearance="@style/ListItemTextStyle"
-        android:textSize="16sp"
-        app:layout_constraintBottom_toTopOf="@id/enable_beta_connection_features_summary"
-        app:layout_constraintEnd_toStartOf="@id/enable_beta_connection_features_switch"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:lineHeight="24.sp" />
-
-    <TextView
-        android:id="@+id/enable_beta_connection_features_summary"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:text="Help us test our new connection assist features which focuses on a streamlined connection with better integration with bridges"
-        android:textColor="?attr/textSecondary"
-        android:textColorLink="?attr/textSecondary"
-        android:textSize="12sp"
-        app:layout_constraintBottom_toTopOf="@id/enable_beta_connection_features_modes"
-        app:layout_constraintEnd_toEndOf="@id/enable_beta_connection_features_title"
-        app:layout_constraintStart_toStartOf="@id/enable_beta_connection_features_title"
-        app:layout_constraintTop_toBottomOf="@id/enable_beta_connection_features_title"
-        app:lineHeight="16.sp" />
-
-    <androidx.appcompat.widget.SwitchCompat
-        android:id="@+id/enable_beta_connection_features_switch"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:minHeight="48dp"
-        android:paddingStart="18dp"
-        android:paddingEnd="18dp"
-        android:textColor="@color/state_list_text_color"
-        android:textOff="@string/studies_off"
-        android:textOn="@string/studies_on"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="@id/enable_beta_connection_features_title" />
-
-    <RadioGroup
-        android:id="@+id/enable_beta_connection_features_modes"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="10dp"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/enable_beta_connection_features_summary">
-
-        <org.mozilla.fenix.settings.PreferenceBackedRadioButton
-            android:id="@+id/use_new_bootstrap_with_native_ui_radio_button"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:background="?android:attr/selectableItemBackground"
-            android:button="@null"
-            android:drawablePadding="@dimen/radio_button_preference_drawable_padding"
-            android:paddingStart="@dimen/radio_button_preference_horizontal"
-            android:paddingTop="@dimen/radio_button_preference_vertical"
-            android:paddingEnd="@dimen/radio_button_preference_horizontal"
-            android:paddingBottom="@dimen/radio_button_preference_vertical"
-            android:text="Native Android UI"
-            android:textAppearance="?android:attr/textAppearanceListItem"
-            android:textSize="16sp"
-            app:drawableStartCompat="?android:attr/listChoiceIndicatorSingle"
-            app:preferenceKey="@string/pref_key_use_new_bootstrap_with_android_native"
-            app:preferenceKeyDefaultValue="true" />
-
-        <org.mozilla.fenix.settings.PreferenceBackedRadioButton
-            android:id="@+id/use_new_bootstrap_with_html_ui_radio_button"
-            android:layout_width="match_parent"
-            android:layout_height="48dp"
-            android:background="?android:attr/selectableItemBackground"
-            android:button="@null"
-            android:drawablePadding="@dimen/radio_button_preference_drawable_padding"
-            android:paddingStart="@dimen/radio_button_preference_horizontal"
-            android:paddingTop="@dimen/radio_button_preference_vertical"
-            android:paddingEnd="@dimen/radio_button_preference_horizontal"
-            android:paddingBottom="@dimen/radio_button_preference_vertical"
-            android:text="HTML UI"
-            android:textAppearance="?android:attr/textAppearanceListItem"
-            android:textSize="16sp"
-            app:drawableStartCompat="?android:attr/listChoiceIndicatorSingle"
-            app:preferenceKey="@string/pref_key_use_new_bootstrap_with_html"
-            app:preferenceKeyDefaultValue="false" />
-    </RadioGroup>
-
-</androidx.constraintlayout.widget.ConstraintLayout>


=====================================
fenix/app/src/main/res/navigation/nav_graph.xml
=====================================
@@ -977,11 +977,6 @@
         android:id="@+id/torBridgeConfigFragment"
         android:name="org.mozilla.fenix.settings.TorBridgeConfigFragment"
         android:label="@string/preferences_tor_network_settings_bridge_config" />
-    <fragment
-        android:id="@+id/torBetaConnectionFeaturesFragment"
-        android:name="org.mozilla.fenix.tor.TorBetaConnectionFeaturesFragment"
-        android:label="Enable beta connection features"
-        tools:layout="@layout/tor_network_settings_beta_connection_features" />
     <fragment
         android:id="@+id/torLogsFragment"
         android:name="org.mozilla.fenix.tor.TorLogsComposeFragment"


=====================================
fenix/app/src/main/res/values/preference_keys.xml
=====================================
@@ -378,10 +378,8 @@
 
     <string name="pref_key_tor_network_settings_explanation" translatable="false">pref_key_tor_network_settings_explanation</string>
     <string name="pref_key_tor_network_settings_bridge_config" translatable="false">pref_key_tor_network_settings_bridge_config</string>
-    <string name="pref_key_use_new_bootstrap" translatable="false">pref_key_use_new_bootstrap</string>
     <string name="pref_key_tor_logs" translatable="false">pref_key_tor_logs</string>
-    <string name="pref_key_use_new_bootstrap_with_android_native" translatable="false">pref_key_use_new_bootstrap_with_android_native</string>
-    <string name="pref_key_use_new_bootstrap_with_html" translatable="false">pref_key_use_new_bootstrap_with_html</string>
+    <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   -->
     <string name="pref_key_tor_network_settings_bridge_config_explanation" translatable="false">pref_key_tor_network_settings_bridge_config_explanation</string>
     <string name="pref_key_tor_network_settings_bridge_config_toggle" translatable="false">pref_key_tor_network_settings_bridge_config_toggle</string>
     <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>


=====================================
fenix/app/src/main/res/xml/preferences.xml
=====================================
@@ -176,10 +176,12 @@
             android:title="@string/tor_bootstrap_quick_start_label"
             app:iconSpaceReserved="false" />
 
-        <Preference
-            android:key="@string/pref_key_use_new_bootstrap"
-            app:iconSpaceReserved="false"
-            android:title="Enable beta connection features" />
+        <SwitchPreference
+            android:defaultValue="false"
+            android:key="@string/pref_key_use_html_connection_ui"
+            android:summary="Recommended only for debugging"
+            android:title="Enable HTML connection UI"
+            app:iconSpaceReserved="false" />
 
         <Preference
             android:key="@string/pref_key_tor_logs"



View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/50c4fb9dea01d0649591430469d23e6d47cb4b9f

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/firefox-android/-/commit/50c4fb9dea01d0649591430469d23e6d47cb4b9f
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240509/db7ec182/attachment-0001.htm>


More information about the tbb-commits mailing list