Skip to content

Commit

Permalink
For mozilla-mobile#4807 Navigate to settings after deleting browsing …
Browse files Browse the repository at this point in the history
…data.
  • Loading branch information
mcarare committed Feb 17, 2020
1 parent 2a42c30 commit ee9ffbd
Showing 1 changed file with 12 additions and 5 deletions.
Expand Up @@ -22,6 +22,7 @@ import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.showToolbar
import org.mozilla.fenix.home.HomeFragmentDirections

@SuppressWarnings("TooManyFunctions")
class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_data) {
Expand Down Expand Up @@ -218,11 +219,17 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
// and we want to prevent a crash by defaulting to pop home behavior
if (checkIfFragmentInBackStack(R.id.deleteBrowsingDataFragment)) {
// If Settings is in the backstack then we can continue with intended behavior
if (checkIfFragmentInBackStack(R.id.browserFragment)) findNavController().popBackStack(
R.id.homeFragment,
false
)
else findNavController().popBackStack()
if (checkIfFragmentInBackStack(R.id.browserFragment)){
findNavController().popBackStack(
R.id.homeFragment,
false
)
findNavController().navigate(
HomeFragmentDirections.actionHomeFragmentToSettingsFragment()
)
} else {
findNavController().popBackStack()
}
} else {
findNavController().popBackStack(
R.id.homeFragment,
Expand Down

0 comments on commit ee9ffbd

Please sign in to comment.