Updated on 2026-08-14

This commit is contained in:
Tangem 2025-03-24 18:31:16 +03:00
commit b9d5b0fc9e
3 changed files with 17 additions and 8 deletions

View file

@ -1,6 +1,5 @@
package com.tangem.tap
import android.os.Bundle
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.core.os.bundleOf
@ -21,15 +20,11 @@ internal class DecomposeFragment : ComposeFragment() {
@Inject
override lateinit var uiDependencies: UiDependencies
private lateinit var component: ComposableContentComponent
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
private val component by lazy(LazyThreadSafetyMode.NONE) {
val tag = requireArguments().getString(TAG_KEY)
val builder = componentsBuilders[tag]
component = requireNotNull(builder?.build()) {
requireNotNull(builder?.build()) {
"Component builder is not set, call newInstance() for DecomposeFragment creation first."
}
}

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 -> {

View file

@ -121,7 +121,7 @@ internal class HomeModel @Inject constructor(
store.dispatchWithMain(HomeAction.ScanInProgress(scanInProgress = false))
delay(HIDE_PROGRESS_DELAY)
store.dispatchNavigationAction { push(AppRoute.Wallet) }
store.dispatchNavigationAction { replaceAll(AppRoute.Wallet) }
}
private fun sendSignedInCardAnalyticsEvent(scanResponse: ScanResponse) {