GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 18e42ca7 authored by Matthew Finkel's avatar Matthew Finkel

Bug 40016 - Modify Default toolbar menu

parent ce7988e1
......@@ -177,14 +177,11 @@ 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(),
......
......@@ -103,7 +103,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
......@@ -806,7 +805,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
)
......
......@@ -231,10 +231,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
)
......
......@@ -11,7 +11,6 @@ import androidx.core.net.toUri
import mozilla.components.support.ktx.android.content.appVersionName
import mozilla.components.support.ktx.android.content.getColorFromAttr
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.IntentReceiverActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.settings.account.AuthIntentReceiverActivity
......@@ -19,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"
......@@ -27,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"),
......@@ -78,16 +80,22 @@ 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) = if (Config.channel.isFennec) {
getGenericSumoURLForTopic(SumoTopic.UPGRADE_FAQ)
} else {
getSumoURLForTopic(context, SumoTopic.WHATS_NEW)
fun getWhatsNewUrl(@Suppress("UNUSED_PARAMETER") context: Context): String {
return getTorReleasePageUrl()
}
fun createCustomTabIntent(context: Context, url: String): Intent = CustomTabsIntent.Builder()
......
......@@ -129,7 +129,7 @@ class AboutFragment : Fragment(), AboutPageListener {
AboutPageItem(
AboutItem.ExternalLink(
SUPPORT,
SupportUtils.getSumoURLForTopic(context, SupportUtils.SumoTopic.HELP)
SupportUtils.getTorHelpPageUrl()
), getString(R.string.about_support)
),
AboutPageItem(
......
......@@ -55,6 +55,18 @@ class SupportUtilsTest {
)
}
@Test
fun getTorPageUrl() {
assertEquals(
"https://tb-manual.torproject.org/mobile-tor",
SupportUtils.getTorHelpPageUrl()
)
assertEquals(
"https://www.torproject.org/releases/",
SupportUtils.getTorReleasePageUrl()
)
}
private fun mockContext(versionName: String): Context {
val context: Context = mockk()
val packageManager: PackageManager = mockk()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment