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),
|
||||
FromTrackingProtection(R.id.trackingProtectionFragment),
|
||||
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.TrackingProtectionFragmentDirections
|
||||
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.ThemeManager
|
||||
import org.mozilla.fenix.utils.BrowsersCache
|
||||
|
@ -386,6 +389,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
|
|||
DefaultBrowserSettingsFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||
BrowserDirection.FromSavedLoginsFragment ->
|
||||
SavedLoginsAuthFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||
BrowserDirection.FromAddNewDeviceFragment ->
|
||||
AddNewDeviceFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||
BrowserDirection.FromAddSearchEngineFragment ->
|
||||
AddSearchEngineFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||
BrowserDirection.FromEditCustomSearchEngineFragment ->
|
||||
EditCustomSearchEngineFragmentDirections.actionGlobalBrowser(customTabSessionId)
|
||||
}
|
||||
|
||||
private fun load(
|
||||
|
|
|
@ -235,8 +235,8 @@ class HomeFragment : Fragment() {
|
|||
showDeleteCollectionPrompt = ::showDeleteCollectionPrompt,
|
||||
openSettingsScreen = ::openSettingsScreen,
|
||||
openSearchScreen = ::navigateToSearch,
|
||||
openWhatsNewLink = { openCustomTab(SupportUtils.getWhatsNewUrl(activity)) },
|
||||
openPrivacyNotice = { openCustomTab(SupportUtils.getMozillaPageUrl(PRIVATE_NOTICE)) },
|
||||
openWhatsNewLink = { openInNormalTab(SupportUtils.getWhatsNewUrl(activity)) },
|
||||
openPrivacyNotice = { openInNormalTab(SupportUtils.getMozillaPageUrl(PRIVATE_NOTICE)) },
|
||||
showTabTray = ::openTabTray
|
||||
)
|
||||
)
|
||||
|
@ -656,11 +656,12 @@ class HomeFragment : Fragment() {
|
|||
nav(R.id.homeFragment, directions)
|
||||
}
|
||||
|
||||
private fun openCustomTab(url: String) {
|
||||
context?.let { context ->
|
||||
val intent = SupportUtils.createCustomTabIntent(context, url)
|
||||
startActivity(intent)
|
||||
}
|
||||
private fun openInNormalTab(url: String) {
|
||||
(activity as HomeActivity).openToBrowserAndLoad(
|
||||
searchTermOrURL = url,
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromHome
|
||||
)
|
||||
}
|
||||
|
||||
@SuppressWarnings("ComplexMethod", "LongMethod")
|
||||
|
|
|
@ -17,7 +17,9 @@ import androidx.recyclerview.widget.DividerItemDecoration
|
|||
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
|
||||
import kotlinx.android.synthetic.main.fragment_about.*
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import org.mozilla.fenix.BrowserDirection
|
||||
import org.mozilla.fenix.BuildConfig
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.crashes.CrashListActivity
|
||||
|
@ -180,11 +182,12 @@ class AboutFragment : Fragment(), AboutPageListener {
|
|||
)
|
||||
}
|
||||
|
||||
private fun openLinkInCustomTab(url: String) {
|
||||
context?.let { context ->
|
||||
val intent = SupportUtils.createCustomTabIntent(context, url)
|
||||
startActivity(intent)
|
||||
}
|
||||
private fun openLinkInNormalTab(url: String) {
|
||||
(activity as HomeActivity).openToBrowserAndLoad(
|
||||
searchTermOrURL = url,
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromAbout
|
||||
)
|
||||
}
|
||||
|
||||
private fun openLibrariesPage() {
|
||||
|
@ -214,7 +217,7 @@ class AboutFragment : Fragment(), AboutPageListener {
|
|||
}
|
||||
}
|
||||
|
||||
openLinkInCustomTab(item.url)
|
||||
openLinkInNormalTab(item.url)
|
||||
}
|
||||
is AboutItem.Libraries -> {
|
||||
requireComponents.analytics.metrics.track(Event.LibrariesThatWeUseTapped)
|
||||
|
|
|
@ -28,6 +28,7 @@ import kotlinx.coroutines.launch
|
|||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
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.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.setOnClickListener {
|
||||
requireContext().let { context ->
|
||||
val intent = SupportUtils.createCustomTabIntent(
|
||||
context,
|
||||
SupportUtils.getSumoURLForTopic(
|
||||
context,
|
||||
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES
|
||||
)
|
||||
)
|
||||
startActivity(intent)
|
||||
}
|
||||
(activity as HomeActivity).openToBrowserAndLoad(
|
||||
searchTermOrURL = SupportUtils.getSumoURLForTopic(
|
||||
requireContext(),
|
||||
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES
|
||||
),
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromAddSearchEngineFragment
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import kotlinx.coroutines.Dispatchers.Main
|
|||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
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.components.FenixSnackbar
|
||||
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.setOnClickListener {
|
||||
requireContext().let { context ->
|
||||
val intent = SupportUtils.createCustomTabIntent(
|
||||
context,
|
||||
SupportUtils.getSumoURLForTopic(
|
||||
context,
|
||||
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES
|
||||
)
|
||||
)
|
||||
startActivity(intent)
|
||||
}
|
||||
(activity as HomeActivity).openToBrowserAndLoad(
|
||||
searchTermOrURL = SupportUtils.getSumoURLForTopic(
|
||||
requireContext(),
|
||||
SupportUtils.SumoTopic.CUSTOM_SEARCH_ENGINES
|
||||
),
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromEditCustomSearchEngineFragment
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ import android.view.View
|
|||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.Fragment
|
||||
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.ext.showToolbar
|
||||
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?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
learn_button.setOnClickListener {
|
||||
val intent = SupportUtils.createCustomTabIntent(
|
||||
requireContext(),
|
||||
SupportUtils.getSumoURLForTopic(requireContext(), SupportUtils.SumoTopic.SEND_TABS)
|
||||
(activity as HomeActivity).openToBrowserAndLoad(
|
||||
searchTermOrURL = SupportUtils.getSumoURLForTopic(
|
||||
requireContext(),
|
||||
SupportUtils.SumoTopic.SEND_TABS
|
||||
),
|
||||
newTab = true,
|
||||
from = BrowserDirection.FromAddNewDeviceFragment
|
||||
)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
connect_button.setOnClickListener {
|
||||
|
|
Loading…
Reference in New Issue