Verified Commit 0c8b1c85 authored by Matthew Finkel's avatar Matthew Finkel Committed by Pier Angelo Vendrame
Browse files

TB 34403 [android]: Disable Normal mode by default.

Originally, fenix#34403.
parent aaa6e143
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -939,11 +939,16 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
    internal fun getModeFromIntentOrLastKnown(intent: Intent?): BrowsingMode {
        intent?.toSafeIntent()?.let {
            if (it.hasExtra(PRIVATE_BROWSING_MODE)) {
                val startPrivateMode = it.getBooleanExtra(PRIVATE_BROWSING_MODE, false)
                val startPrivateMode = settings().shouldDisableNormalMode ||
                    it.getBooleanExtra(PRIVATE_BROWSING_MODE, settings().openLinksInAPrivateTab)
                return BrowsingMode.fromBoolean(isPrivate = startPrivateMode)
            }
        }
        return settings().lastKnownMode
        return when {
            settings().shouldDisableNormalMode -> BrowsingMode.Private
            settings().openLinksInAPrivateTab -> BrowsingMode.Private
            else -> settings().lastKnownMode
        }
    }

    /**
+11 −7
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ class Core(
    }

    val applicationSearchEngines: List<SearchEngine> by lazyMonitored {
        listOf(
        listOfNotNull(
            createApplicationSearchEngine(
                id = BOOKMARKS_SEARCH_ENGINE_ID,
                name = context.getString(R.string.library_bookmarks),
@@ -254,12 +254,16 @@ class Core(
                url = "",
                icon = getDrawable(context, R.drawable.ic_tabs_search)?.toBitmap()!!,
            ),
            if (!context.settings().shouldDisableNormalMode) {
                createApplicationSearchEngine(
                    id = HISTORY_SEARCH_ENGINE_ID,
                    name = context.getString(R.string.library_history),
                    url = "",
                    icon = getDrawable(context, R.drawable.ic_history_search)?.toBitmap()!!,
            ),
                )
            } else {
                null
            },
        )
    }

+1 −1
Original line number Diff line number Diff line
@@ -411,7 +411,7 @@ open class DefaultToolbarMenu(
                newTabItem,
                BrowserMenuDivider(),
                bookmarksItem,
                historyItem,
                if (context.settings().shouldDisableNormalMode) null else historyItem,
                downloadsItem,
                passwordsItem,
                extensionsItem,
+3 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import androidx.compose.ui.viewinterop.AndroidView
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import androidx.core.content.ContextCompat.getColor
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
@@ -1006,6 +1007,8 @@ class HomeFragment : Fragment() {
            Homepage.privateModeIconTapped.record(mozilla.telemetry.glean.private.NoExtras())
        }

        binding.privateBrowsingButton.isGone = view.context.settings().shouldDisableNormalMode

        consumeFrom(requireComponents.core.store) {
            tabCounterView?.update(it)
            showCollectionsPlaceholder(it)
+4 −0
Original line number Diff line number Diff line
@@ -187,6 +187,10 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
                } else {
                    inflater.inflate(R.menu.bookmarks_select_multi, menu)

                    menu.findItem(R.id.open_bookmarks_in_new_tabs_multi_select)?.apply {
                        isVisible = !requireContext().settings().shouldDisableNormalMode
                    }

                    menu.findItem(R.id.delete_bookmarks_multi_select).title =
                        SpannableString(getString(R.string.bookmark_menu_delete_button)).apply {
                            setTextColor(requireContext(), R.attr.textCritical)
Loading