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