Skip to content
Snippets Groups Projects
Commit 7c46e807 authored by clairehurst's avatar clairehurst Committed by Pier Angelo Vendrame
Browse files

fixup! TB 41878: [android] Add standalone Tor Bootstrap

#43329 [Android] Remove remaining traces of the old Bootstrap
parent 7753a2bc
Branches
Tags
1 merge request!1500TB 43415: Rebased onto 134.0a1
......@@ -184,8 +184,6 @@ import org.mozilla.fenix.snackbar.SnackbarBinding
import org.mozilla.fenix.tabstray.Page
import org.mozilla.fenix.tabstray.TabsTrayAccessPoint
import org.mozilla.fenix.theme.FirefoxTheme
import org.mozilla.fenix.tor.TorBootstrapFragmentDirections
import org.mozilla.fenix.tor.TorBootstrapStatus
import org.mozilla.fenix.utils.Settings.Companion.TOP_SITES_PROVIDER_MAX_THRESHOLD
import org.mozilla.fenix.utils.allowUndo
import org.mozilla.fenix.wallpapers.Wallpaper
......@@ -283,7 +281,6 @@ class HomeFragment : Fragment() {
private val searchSelectorMenuBinding = ViewBoundFeatureWrapper<SearchSelectorMenuBinding>()
private val homeScreenPopupManager = ViewBoundFeatureWrapper<HomeScreenPopupManager>()
private lateinit var torBootstrapStatus: TorBootstrapStatus
override fun onCreate(savedInstanceState: Bundle?) {
// DO NOT ADD ANYTHING ABOVE THIS getProfilerTime CALL!
......@@ -321,12 +318,6 @@ class HomeFragment : Fragment() {
val activity = activity as HomeActivity
val components = requireComponents
torBootstrapStatus = TorBootstrapStatus(
!BuildConfig.DISABLE_TOR,
components.torController,
::dispatchModeChanges
)
val currentWallpaperName = requireContext().settings().currentWallpaperName
applyWallpaper(
wallpaperName = currentWallpaperName,
......@@ -1353,7 +1344,6 @@ class HomeFragment : Fragment() {
override fun onStop() {
dismissRecommendPrivateBrowsingShortcut()
super.onStop()
torBootstrapStatus.unregisterTorListener()
}
override fun onStart() {
......@@ -1404,15 +1394,6 @@ class HomeFragment : Fragment() {
}
}
private fun dispatchModeChanges(isBootstrapping: Boolean) {
if (isBootstrapping) {
val directions =
TorBootstrapFragmentDirections
.actionStartupTorbootstrap()
findNavController().navigate(directions)
}
}
@VisibleForTesting
internal fun removeCollectionWithUndo(tabCollection: TabCollection) {
val snackbarMessage = getString(R.string.snackbar_collection_deleted)
......@@ -1435,7 +1416,6 @@ class HomeFragment : Fragment() {
override fun onResume() {
super.onResume()
torBootstrapStatus.registerTorListener()
if (browsingModeManager.mode == BrowsingMode.Private) {
activity?.window?.setBackgroundDrawableResource(R.drawable.private_home_background_gradient)
}
......
......
/* 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
@SuppressWarnings("LongParameterList", "TooManyFunctions")
class TorBootstrapStatus(
private val shouldStartTor: Boolean,
private val torController: TorController,
private val dispatchModeChanges: (isShouldBootstrap: Boolean) -> Unit
) : TorEvents {
init {
torController.registerTorListener(this)
}
fun isBootstrapping() = (shouldStartTor && !torController.isBootstrapped)
@SuppressWarnings("EmptyFunctionBlock")
override fun onTorConnecting() {
}
override fun onTorConnected() {
dispatchModeChanges(isBootstrapping())
}
override fun onTorStopped() {
dispatchModeChanges(isBootstrapping())
}
@SuppressWarnings("EmptyFunctionBlock")
override fun onTorStatusUpdate(entry: String?, status: String?, progress: Double?) {
}
fun unregisterTorListener() {
torController.unregisterTorListener(this)
}
fun registerTorListener() {
torController.registerTorListener(this)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment