diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt index 713236163b07..a19fa5e9350e 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt @@ -14,6 +14,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.MainScope +import kotlinx.coroutines.delay import kotlinx.coroutines.launch import mozilla.components.browser.session.Session import mozilla.components.browser.session.SessionManager @@ -316,19 +317,18 @@ class DefaultBrowserToolbarController( } private fun animateTabAndNavigateHome() { - navController.navigate(BrowserFragmentDirections.actionBrowserFragmentToTabsTrayFragment()) -// scope.launch { -// browserAnimator.beginAnimateOut() -// // Delay for a short amount of time so the browser has time to start animating out -// // before we transition the fragment. This makes the animation feel smoother -// delay(ANIMATION_DELAY) -// if (!navController.popBackStack(R.id.homeFragment, false)) { -// navController.nav( -// R.id.browserFragment, -// BrowserFragmentDirections.actionGlobalHome() -// ) -// } -// } + scope.launch { + browserAnimator.beginAnimateOut() + // Delay for a short amount of time so the browser has time to start animating out + // before we transition the fragment. This makes the animation feel smoother + delay(ANIMATION_DELAY) + if (!navController.popBackStack(R.id.homeFragment, false)) { + navController.nav( + R.id.browserFragment, + BrowserFragmentDirections.actionGlobalHome() + ) + } + } } private fun reportSiteIssue(reportUrl: String, private: Boolean) {