Fixes #10064: Open help articles in normal tab instead of custom tab
parent
906d72c894
commit
9f265fd62f
|
@ -24,5 +24,8 @@ enum class BrowserDirection(@IdRes val fragmentId: Int) {
|
||||||
FromAbout(R.id.aboutFragment),
|
FromAbout(R.id.aboutFragment),
|
||||||
FromTrackingProtection(R.id.trackingProtectionFragment),
|
FromTrackingProtection(R.id.trackingProtectionFragment),
|
||||||
FromDefaultBrowserSettingsFragment(R.id.defaultBrowserSettingsFragment),
|
FromDefaultBrowserSettingsFragment(R.id.defaultBrowserSettingsFragment),
|
||||||
FromSavedLoginsFragment(R.id.savedLoginsFragment)
|
FromSavedLoginsFragment(R.id.savedLoginsFragment),
|
||||||
|
FromAddNewDeviceFragment(R.id.addNewDeviceFragment),
|
||||||
|
FromAddSearchEngineFragment(R.id.addSearchEngineFragment),
|
||||||
|
FromEditCustomSearchEngineFragment(R.id.editCustomSearchEngineFragment)
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,9 @@ import org.mozilla.fenix.settings.logins.SavedLoginsAuthFragmentDirections
|
||||||
import org.mozilla.fenix.settings.SettingsFragmentDirections
|
import org.mozilla.fenix.settings.SettingsFragmentDirections
|
||||||
import org.mozilla.fenix.settings.TrackingProtectionFragmentDirections
|
import org.mozilla.fenix.settings.TrackingProtectionFragmentDirections
|
||||||
import org.mozilla.fenix.settings.about.AboutFragmentDirections
|
import org.mozilla.fenix.settings.about.AboutFragmentDirections
|
||||||
|
import org.mozilla.fenix.settings.search.AddSearchEngineFragmentDirections
|
||||||
|
import org.mozilla.fenix.settings.search.EditCustomSearchEngineFragmentDirections
|
||||||
|
import org.mozilla.fenix.share.AddNewDeviceFragmentDirections
|
||||||
import org.mozilla.fenix.theme.DefaultThemeManager
|
import org.mozilla.fenix.theme.DefaultThemeManager
|
||||||
import org.mozilla.fenix.theme.ThemeManager
|
import org.mozilla.fenix.theme.ThemeManager
|
||||||
import org.mozilla.fenix.utils.BrowsersCache
|
import org.mozilla.fenix.utils.BrowsersCache
|
||||||
|
@ -386,6 +389,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
|
||||||
DefaultBrowserSettingsFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
DefaultBrowserSettingsFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||||
BrowserDirection.FromSavedLoginsFragment ->
|
BrowserDirection.FromSavedLoginsFragment ->
|
||||||
SavedLoginsAuthFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
SavedLoginsAuthFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||||
|
BrowserDirection.FromAddNewDeviceFragment ->
|
||||||
|
AddNewDeviceFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||||
|
BrowserDirection.FromAddSearchEngineFragment ->
|
||||||
|
AddSearchEngineFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||||
|
BrowserDirection.FromEditCustomSearchEngineFragment ->
|
||||||
|
EditCustomSearchEngineFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun load(
|
private fun load(
|
||||||
|
|
|
@ -235,8 +235,8 @@ class HomeFragment : Fragment() {
|
||||||
showDeleteCollectionPrompt = ::showDeleteCollectionPrompt,
|
showDeleteCollectionPrompt = ::showDeleteCollectionPrompt,
|
||||||
openSettingsScreen = ::openSettingsScreen,
|
openSettingsScreen = ::openSettingsScreen,
|
||||||
openSearchScreen = ::navigateToSearch,
|
openSearchScreen = ::navigateToSearch,
|
||||||
openWhatsNewLink = { openCustomTab(SupportUtils.getWhatsNewUrl(activity)) },
|
openWhatsNewLink = { openInNormalTab(SupportUtils.getWhatsNewUrl(activity)) },
|
||||||
openPrivacyNotice = { openCustomTab(SupportUtils.getMozillaPageUrl(PRIVATE_NOTICE)) },
|
openPrivacyNotice = { openInNormalTab(SupportUtils.getMozillaPageUrl(PRIVATE_NOTICE)) },
|
||||||
showTabTray = ::openTabTray
|
showTabTray = ::openTabTray
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -656,11 +656,12 @@ class HomeFragment : Fragment() {
|
||||||
nav(R.id.homeFragment, directions)
|
nav(R.id.homeFragment, directions)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openCustomTab(url: String) {
|
private fun openInNormalTab(url: String) {
|
||||||
context?.let { context ->
|
(activity as HomeActivity).openToBrowserAndLoad(
|
||||||
val intent = SupportUtils.createCustomTabIntent(context, url)
|
searchTermOrURL = url,
|
||||||
startActivity(intent)
|
newTab = true,
|
||||||
}
|
from = BrowserDirection.FromHome
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ComplexMethod", "LongMethod")
|
@SuppressWarnings("ComplexMethod", "LongMethod")
|
||||||
|
|
|
@ -17,7 +17,9 @@ import androidx.recyclerview.widget.DividerItemDecoration
|
||||||
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
|
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
|
||||||
import kotlinx.android.synthetic.main.fragment_about.*
|
import kotlinx.android.synthetic.main.fragment_about.*
|
||||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
|
import org.mozilla.fenix.BrowserDirection
|
||||||
import org.mozilla.fenix.BuildConfig
|
import org.mozilla.fenix.BuildConfig
|
||||||
|
import org.mozilla.fenix.HomeActivity
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.metrics.Event
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
import org.mozilla.fenix.crashes.CrashListActivity
|
import org.mozilla.fenix.crashes.CrashListActivity
|
||||||
|
@ -180,11 +182,12 @@ class AboutFragment : Fragment(), AboutPageListener {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openLinkInCustomTab(url: String) {
|
private fun openLinkInNormalTab(url: String) {
|
||||||
context?.let { context ->
|
(activity as HomeActivity).openToBrowserAndLoad(
|
||||||
val intent = SupportUtils.createCustomTabIntent(context, url)
|
searchTermOrURL = url,
|
||||||
startActivity(intent)
|
newTab = true,
|
||||||
}
|
from = BrowserDirection.FromAbout
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openLibrariesPage() {
|
private fun openLibrariesPage() {
|
||||||
|
@ -214,7 +217,7 @@ class AboutFragment : Fragment(), AboutPageListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openLinkInCustomTab(item.url)
|
openLinkInNormalTab(item.url)
|
||||||
}
|
}
|
||||||
is AboutItem.Libraries -> {
|
is AboutItem.Libraries -> {
|
||||||
requireComponents.analytics.metrics.track(Event.LibrariesThatWeUseTapped)
|
requireComponents.analytics.metrics.track(Event.LibrariesThatWeUseTapped)
|
||||||
|
|
|
@ -28,6 +28,7 @@ import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import mozilla.components.browser.search.SearchEngine
|
import mozilla.components.browser.search.SearchEngine
|
||||||
|
import org.mozilla.fenix.BrowserDirection
|
||||||
import org.mozilla.fenix.HomeActivity
|
import org.mozilla.fenix.HomeActivity
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.FenixSnackbar
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
|
@ -103,16 +104,14 @@ class AddSearchEngineFragment : Fragment(), CompoundButton.OnCheckedChangeListen
|
||||||
|
|
||||||
custom_search_engines_learn_more.increaseTapArea(DPS_TO_INCREASE)
|
custom_search_engines_learn_more.increaseTapArea(DPS_TO_INCREASE)
|
||||||
custom_search_engines_learn_more.setOnClickListener {
|
custom_search_engines_learn_more.setOnClickListener {
|
||||||
requireContext().let { context ->
|
(activity as HomeActivity).openToBrowserAndLoad(
|
||||||
val intent = SupportUtils.createCustomTabIntent(
|
searchTermOrURL = SupportUtils.getSumoURLForTopic(
|
||||||
context,
|
requireContext(),
|
||||||
SupportUtils.getSumoURLForTopic(
|
|
||||||
context,
|
|
||||||
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES
|
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES
|
||||||
|
),
|
||||||
|
newTab = true,
|
||||||
|
from = BrowserDirection.FromAddSearchEngineFragment
|
||||||
)
|
)
|
||||||
)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ import kotlinx.coroutines.Dispatchers.Main
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import mozilla.components.browser.search.SearchEngine
|
import mozilla.components.browser.search.SearchEngine
|
||||||
|
import org.mozilla.fenix.BrowserDirection
|
||||||
|
import org.mozilla.fenix.HomeActivity
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.FenixSnackbar
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
import org.mozilla.fenix.components.searchengine.CustomSearchEngineStore
|
import org.mozilla.fenix.components.searchengine.CustomSearchEngineStore
|
||||||
|
@ -55,16 +57,14 @@ class EditCustomSearchEngineFragment : Fragment(R.layout.fragment_add_search_eng
|
||||||
|
|
||||||
custom_search_engines_learn_more.increaseTapArea(DPS_TO_INCREASE)
|
custom_search_engines_learn_more.increaseTapArea(DPS_TO_INCREASE)
|
||||||
custom_search_engines_learn_more.setOnClickListener {
|
custom_search_engines_learn_more.setOnClickListener {
|
||||||
requireContext().let { context ->
|
(activity as HomeActivity).openToBrowserAndLoad(
|
||||||
val intent = SupportUtils.createCustomTabIntent(
|
searchTermOrURL = SupportUtils.getSumoURLForTopic(
|
||||||
context,
|
requireContext(),
|
||||||
SupportUtils.getSumoURLForTopic(
|
|
||||||
context,
|
|
||||||
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES
|
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES
|
||||||
|
),
|
||||||
|
newTab = true,
|
||||||
|
from = BrowserDirection.FromEditCustomSearchEngineFragment
|
||||||
)
|
)
|
||||||
)
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import android.view.View
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import kotlinx.android.synthetic.main.fragment_add_new_device.*
|
import kotlinx.android.synthetic.main.fragment_add_new_device.*
|
||||||
|
import org.mozilla.fenix.BrowserDirection
|
||||||
|
import org.mozilla.fenix.HomeActivity
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.ext.showToolbar
|
import org.mozilla.fenix.ext.showToolbar
|
||||||
import org.mozilla.fenix.settings.SupportUtils
|
import org.mozilla.fenix.settings.SupportUtils
|
||||||
|
@ -26,11 +28,14 @@ class AddNewDeviceFragment : Fragment(R.layout.fragment_add_new_device) {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
learn_button.setOnClickListener {
|
learn_button.setOnClickListener {
|
||||||
val intent = SupportUtils.createCustomTabIntent(
|
(activity as HomeActivity).openToBrowserAndLoad(
|
||||||
|
searchTermOrURL = SupportUtils.getSumoURLForTopic(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
SupportUtils.getSumoURLForTopic(requireContext(), SupportUtils.SumoTopic.SEND_TABS)
|
SupportUtils.SumoTopic.SEND_TABS
|
||||||
|
),
|
||||||
|
newTab = true,
|
||||||
|
from = BrowserDirection.FromAddNewDeviceFragment
|
||||||
)
|
)
|
||||||
startActivity(intent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connect_button.setOnClickListener {
|
connect_button.setOnClickListener {
|
||||||
|
|
Loading…
Reference in New Issue