2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/22592 - Refactor hideOnboardingIfNeeded() calls when the home menu items are tapped

This commit is contained in:
Gabriel Luong 2021-11-25 10:41:55 -05:00 committed by mergify[bot]
parent d9b4393201
commit 7b54536a7e

View File

@ -905,9 +905,12 @@ class HomeFragment : Fragment() {
this.viewLifecycleOwner,
context,
onItemTapped = {
if (it !is HomeMenu.Item.DesktopMode) {
hideOnboardingIfNeeded()
}
when (it) {
HomeMenu.Item.Settings -> {
hideOnboardingIfNeeded()
nav(
R.id.homeFragment,
HomeFragmentDirections.actionGlobalSettingsFragment()
@ -916,14 +919,12 @@ class HomeFragment : Fragment() {
}
HomeMenu.Item.CustomizeHome -> {
context.metrics.track(Event.HomeScreenCustomizedHomeClicked)
hideOnboardingIfNeeded()
nav(
R.id.homeFragment,
HomeFragmentDirections.actionGlobalHomeSettingsFragment()
)
}
is HomeMenu.Item.SyncAccount -> {
hideOnboardingIfNeeded()
val directions = when (it.accountState) {
AccountState.AUTHENTICATED ->
BrowserFragmentDirections.actionGlobalAccountSettingsFragment()
@ -938,30 +939,24 @@ class HomeFragment : Fragment() {
)
}
HomeMenu.Item.Bookmarks -> {
hideOnboardingIfNeeded()
nav(
R.id.homeFragment,
HomeFragmentDirections.actionGlobalBookmarkFragment(BookmarkRoot.Mobile.id)
)
}
HomeMenu.Item.History -> {
hideOnboardingIfNeeded()
nav(
R.id.homeFragment,
HomeFragmentDirections.actionGlobalHistoryFragment()
)
}
HomeMenu.Item.Downloads -> {
hideOnboardingIfNeeded()
nav(
R.id.homeFragment,
HomeFragmentDirections.actionGlobalDownloadsFragment()
)
}
HomeMenu.Item.Help -> {
hideOnboardingIfNeeded()
(activity as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getSumoURLForTopic(context, HELP),
newTab = true,
@ -969,7 +964,6 @@ class HomeFragment : Fragment() {
)
}
HomeMenu.Item.WhatsNew -> {
hideOnboardingIfNeeded()
WhatsNew.userViewedWhatsNew(context)
context.metrics.track(Event.WhatsNewTapped)
(activity as HomeActivity).openToBrowserAndLoad(
@ -994,7 +988,6 @@ class HomeFragment : Fragment() {
)
}
HomeMenu.Item.ReconnectSync -> {
hideOnboardingIfNeeded()
nav(
R.id.homeFragment,
HomeFragmentDirections.actionGlobalAccountProblemFragment()