Updated on 2026-08-14

This commit is contained in:
Tangem 2026-06-02 00:50:30 -07:00
parent ec818bfd0a
commit adb7549046
12 changed files with 49 additions and 14 deletions

View file

@ -582,6 +582,7 @@ internal class ChildFactory @Inject constructor(
analyticsSource = route.analyticsSource,
analyticsAction = route.analyticsAction,
nextScreen = route.nextScreen,
shouldShowBackButton = route.shouldShowBackButton,
),
componentFactory = createWalletBackupComponentFactory,
)
@ -593,6 +594,7 @@ internal class ChildFactory @Inject constructor(
userWalletId = route.userWalletId,
source = route.source,
nextScreen = route.nextScreen,
shouldShowBackButton = route.shouldShowBackButton,
),
componentFactory = updateAccessCodeComponentFactory,
)

View file

@ -409,6 +409,7 @@ sealed class AppRoute(val path: String) : Route {
val analyticsAction: String,
val isUpgradeFlow: Boolean = false,
val nextScreen: AppRoute? = null,
val shouldShowBackButton: Boolean = true,
) : AppRoute(path = "/create_wallet_backup/${userWalletId.stringValue}")
@Serializable
@ -416,6 +417,7 @@ sealed class AppRoute(val path: String) : Route {
val userWalletId: UserWalletId,
val source: String,
val nextScreen: AppRoute? = null,
val shouldShowBackButton: Boolean = true,
) : AppRoute(path = "/update_access_code/${userWalletId.stringValue}")
@Serializable

View file

@ -13,6 +13,7 @@ interface CreateWalletBackupComponent : ComposableContentComponent {
val analyticsSource: String,
val analyticsAction: String,
val nextScreen: AppRoute? = null,
val shouldShowBackButton: Boolean = true,
)
interface Factory : ComponentFactory<Params, CreateWalletBackupComponent>

View file

@ -10,6 +10,7 @@ interface UpdateAccessCodeComponent : ComposableContentComponent {
val userWalletId: UserWalletId,
val source: String,
val nextScreen: AppRoute? = null,
val shouldShowBackButton: Boolean = true,
)
interface Factory : ComponentFactory<Params, UpdateAccessCodeComponent>
}

View file

@ -67,6 +67,11 @@ internal class CreateWalletBackupModel @Inject constructor(
}
}
fun isBackButtonVisible(route: CreateWalletBackupRoute): Boolean = when (route) {
is CreateWalletBackupRoute.RecoveryPhraseStart -> params.shouldShowBackButton
else -> true
}
fun onManualBackupStarted() {
analyticsEventHandler.send(
event = WalletSettingsAnalyticEvents.RecoveryPhraseScreen(

View file

@ -65,6 +65,7 @@ internal class DefaultCreateWalletBackupComponent @AssistedInject constructor(
stackState = stackState,
modifier = modifier,
showTopBar = currentRoute !is CreateWalletBackupRoute.BackupCompleted,
showBackButton = model.isBackButtonVisible(currentRoute),
onBackClick = model::onBack,
)
}

View file

@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import com.arkivanov.decompose.extensions.compose.stack.Children
import com.arkivanov.decompose.extensions.compose.stack.animation.slide
@ -23,6 +24,7 @@ import com.tangem.features.hotwallet.createwalletbackup.routing.CreateWalletBack
internal fun CreateWalletBackupContent(
stackState: ChildStack<CreateWalletBackupRoute, ComposableContentComponent>,
showTopBar: Boolean,
showBackButton: Boolean,
onBackClick: () -> Unit,
modifier: Modifier = Modifier,
) {
@ -34,13 +36,19 @@ internal fun CreateWalletBackupContent(
.systemBarsPadding(),
) {
if (showTopBar) {
TangemTopAppBar(
modifier = Modifier,
startButton = TopAppBarButtonUM.Back(
onBackClicked = onBackClick,
),
title = stringResourceSafe(id = R.string.common_backup),
)
if (showBackButton) {
TangemTopAppBar(
modifier = Modifier,
startButton = TopAppBarButtonUM.Back(onBackClicked = onBackClick),
title = stringResourceSafe(id = R.string.common_backup),
)
} else {
TangemTopAppBar(
modifier = Modifier,
title = stringResourceSafe(id = R.string.common_backup),
titleAlignment = Alignment.CenterHorizontally,
)
}
}
Children(

View file

@ -55,11 +55,13 @@ internal class DefaultUpdateAccessCodeComponent @AssistedInject constructor(
@Composable
override fun Content(modifier: Modifier) {
val stackState by innerStack.subscribeAsState()
val currentRoute = stackState.active.configuration
BackHandler(onBack = model::onChildBack)
SetAccessCodeContent(
onBackClick = model::onChildBack,
showBackButton = model.isBackButtonVisible(currentRoute),
stackState = stackState,
)
}

View file

@ -23,6 +23,7 @@ import com.tangem.features.hotwallet.updateaccesscode.routing.UpdateAccessCodeRo
@Composable
internal fun SetAccessCodeContent(
onBackClick: () -> Unit,
showBackButton: Boolean,
stackState: ChildStack<UpdateAccessCodeRoute, ComposableContentComponent>,
) {
Column(
@ -32,17 +33,17 @@ internal fun SetAccessCodeContent(
.imePadding()
.systemBarsPadding(),
) {
if (stackState.active.configuration is UpdateAccessCodeRoute.SetupFinished) {
if (showBackButton) {
TangemTopAppBar(
modifier = Modifier,
title = stringResourceSafe(R.string.access_code_navtitle),
titleAlignment = Alignment.CenterHorizontally,
startButton = TopAppBarButtonUM.Back(onBackClick),
)
} else {
TangemTopAppBar(
modifier = Modifier,
title = stringResourceSafe(R.string.access_code_navtitle),
startButton = TopAppBarButtonUM.Back(onBackClick),
titleAlignment = Alignment.CenterHorizontally,
)
}
Children(

View file

@ -45,6 +45,12 @@ internal class UpdateAccessCodeModel @Inject constructor(
}
}
fun isBackButtonVisible(route: UpdateAccessCodeRoute): Boolean = when (route) {
is UpdateAccessCodeRoute.SetAccessCode -> params.shouldShowBackButton
is UpdateAccessCodeRoute.ConfirmAccessCode -> true
is UpdateAccessCodeRoute.SetupFinished -> false
}
override fun onNewAccessCodeInput(userWalletId: UserWalletId, accessCode: String) {
analyticsEventHandler.send(WalletSettingsAnalyticEvents.ReEnterAccessCodeScreen(source = params.source))
stackNavigation.push(UpdateAccessCodeRoute.ConfirmAccessCode(userWalletId, accessCode))

View file

@ -80,14 +80,16 @@ internal class TangemPayHotWalletOnboardingModel @Inject constructor(
TangemLogger.i("[TangemPay][HWO]Hot wallet created")
clearAppsFlyerDeeplinkUseCase(AppsFlyerDeeplinkSource.TangemPayHotWalletOnboarding)
router.replaceCurrent(
router.replaceAll(
AppRoute.CreateWalletBackup(
userWalletId = userWallet.walletId,
analyticsSource = AnalyticsParam.ScreensSources.TangemPayHotWalletOnboarding.value,
analyticsAction = WalletSettingsAnalyticEvents.RecoveryPhraseScreenAction.Backup.value,
shouldShowBackButton = false,
nextScreen = AppRoute.UpdateAccessCode(
userWalletId = userWallet.walletId,
source = AnalyticsParam.ScreensSources.TangemPayHotWalletOnboarding.value,
shouldShowBackButton = false,
nextScreen = AppRoute.TangemPayOnboarding(
mode = AppRoute.TangemPayOnboarding.Mode.FirstSetup(userWallet.walletId),
),

View file

@ -82,8 +82,12 @@ internal class TangemPayHotWalletOnboardingModelTest {
coVerify { clearAppsFlyerDeeplinkUseCase(AppsFlyerDeeplinkSource.TangemPayHotWalletOnboarding) }
verify {
router.replaceCurrent(
match { it is AppRoute.CreateWalletBackup && it.userWalletId == testUserWalletId },
router.replaceAll(
match { route ->
route is AppRoute.CreateWalletBackup &&
route.userWalletId == testUserWalletId &&
!route.shouldShowBackButton
},
)
}
}
@ -102,7 +106,7 @@ internal class TangemPayHotWalletOnboardingModelTest {
assertThat(model.uiState.value.isLoading).isFalse()
verify { uiMessageSender.send(match<DialogMessage> { true }) }
coVerify(exactly = 0) { clearAppsFlyerDeeplinkUseCase(any()) }
verify(exactly = 0) { router.replaceCurrent(any()) }
verify(exactly = 0) { router.replaceAll(*anyVararg()) }
}
}