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

pull/600/head
Gabriel Luong 3 years ago committed by mergify[bot]
parent d9b4393201
commit 7b54536a7e

@ -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()

Loading…
Cancel
Save