Commit d068b9f3 authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Bug 40016: Modify Default toolbar menu

parent ca8ddd3c
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -178,21 +178,18 @@ class DefaultToolbarMenu(
        val shouldDeleteDataOnQuit = context.components.settings
            .shouldDeleteBrowsingDataOnQuit &&
            !context.components.settings.shouldDisableNormalMode
        val syncedTabsInTabsTray = context.components.settings
            .syncedTabsInTabsTray

        val menuItems = listOfNotNull(
            downloadsItem,
            historyItem,
            // historyItem,
            bookmarksItem,
            if (syncedTabsInTabsTray) null else syncedTabs,
            settings,
            if (shouldDeleteDataOnQuit) deleteDataOnQuit else null,
            BrowserMenuDivider(),
            findInPage,
            addToTopSites,
            addToHomescreen.apply { visible = ::canAddToHomescreen },
            installToHomescreen.apply { visible = ::canInstall },
            // addToHomescreen.apply { visible = ::canAddToHomescreen },
            // installToHomescreen.apply { visible = ::canInstall },
            if (shouldShowSaveToCollection) saveToCollection else null,
            desktopMode,
            openInApp.apply { visible = ::shouldShowOpenInApp },
+1 −2
Original line number Diff line number Diff line
@@ -104,7 +104,6 @@ import org.mozilla.fenix.home.sessioncontrol.viewholders.CollectionViewHolder
import org.mozilla.fenix.home.sessioncontrol.viewholders.topsites.DefaultTopSitesView
import org.mozilla.fenix.onboarding.FenixOnboarding
import org.mozilla.fenix.settings.SupportUtils
import org.mozilla.fenix.settings.SupportUtils.SumoTopic.HELP
import org.mozilla.fenix.settings.deletebrowsingdata.deleteAndQuit
import org.mozilla.fenix.theme.ThemeManager
import org.mozilla.fenix.utils.FragmentPreDrawManager
@@ -802,7 +801,7 @@ class HomeFragment : Fragment() {
                    HomeMenu.Item.Help -> {
                        hideOnboardingIfNeeded()
                        (activity as HomeActivity).openToBrowserAndLoad(
                            searchTermOrURL = SupportUtils.getSumoURLForTopic(context, HELP),
                            searchTermOrURL = SupportUtils.getTorHelpPageUrl(),
                            newTab = true,
                            from = BrowserDirection.FromHome
                        )
+1 −4
Original line number Diff line number Diff line
@@ -240,10 +240,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
            }
            resources.getString(R.string.pref_key_help) -> {
                (activity as HomeActivity).openToBrowserAndLoad(
                    searchTermOrURL = SupportUtils.getSumoURLForTopic(
                        requireContext(),
                        SupportUtils.SumoTopic.HELP
                    ),
                    searchTermOrURL = SupportUtils.getTorHelpPageUrl(),
                    newTab = true,
                    from = BrowserDirection.FromSettings
                )
+14 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ import java.io.UnsupportedEncodingException
import java.net.URLEncoder
import java.util.Locale

@Suppress("TooManyFunctions")
object SupportUtils {
    const val RATE_APP_URL = "market://details?id=" + BuildConfig.APPLICATION_ID
    const val POCKET_TRENDING_URL = "https://getpocket.com/fenix-top-articles"
@@ -26,6 +27,8 @@ object SupportUtils {
    const val FIREFOX_BETA_PLAY_STORE_URL = "market://details?id=org.mozilla.firefox_beta"
    const val FIREFOX_NIGHTLY_PLAY_STORE_URL = "market://details?id=org.mozilla.fenix"
    const val GOOGLE_URL = "https://www.google.com/"
    const val TB_MANUAL_URL = "https://tb-manual.torproject.org/mobile-tor"
    const val TOR_RELEASES = "https://www.torproject.org/releases/"

    enum class SumoTopic(internal val topicStr: String) {
        FENIX_MOVING("sync-delist"),
@@ -77,13 +80,23 @@ object SupportUtils {
        return "https://support.mozilla.org/kb/access-mozilla-services-firefox-account"
    }

    fun getTorHelpPageUrl(): String {
        return TB_MANUAL_URL
    }

    fun getTorReleasePageUrl(): String {
        return TOR_RELEASES
    }

    fun getMozillaPageUrl(page: MozillaPage, locale: Locale = Locale.getDefault()): String {
        val path = page.path
        val langTag = getLanguageTag(locale)
        return "https://www.mozilla.org/$langTag/$path"
    }

    fun getWhatsNewUrl(context: Context) = getSumoURLForTopic(context, SumoTopic.WHATS_NEW)
    fun getWhatsNewUrl(@Suppress("UNUSED_PARAMETER") context: Context): String {
        return getTorReleasePageUrl()
    }

    fun createCustomTabIntent(context: Context, url: String): Intent = CustomTabsIntent.Builder()
        .setInstantAppsEnabled(false)
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ class AboutFragment : Fragment(), AboutPageListener {
            AboutPageItem(
                AboutItem.ExternalLink(
                    SUPPORT,
                    SupportUtils.getSumoURLForTopic(context, SupportUtils.SumoTopic.HELP)
                    SupportUtils.getTorHelpPageUrl()
                ), getString(R.string.about_support)
            ),
            AboutPageItem(
Loading