Updated on 2026-08-14

This commit is contained in:
Tangem 2025-03-24 10:57:32 +03:00
parent 6f06bed703
commit 9900b6dd8d
3 changed files with 17 additions and 8 deletions

View file

@ -23,6 +23,7 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.fragment.app.FragmentManager.POP_BACK_STACK_INCLUSIVE
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
@ -330,6 +331,19 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
appRouterConfig.stack = stack
if (stack.size == 1) {
supportFragmentManager.run {
val activeChildName = stack.first().path
(0 until backStackEntryCount)
.mapNotNull { getBackStackEntryAt(it).name }
.filter { it != activeChildName }
.forEach {
popBackStackImmediate(it, POP_BACK_STACK_INCLUSIVE)
}
}
}
when (val child = childStack.active.instance) {
is RoutingComponent.Child.Initial -> Unit
is RoutingComponent.Child.LegacyFragment -> {