Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-03 14:20:19 +05:00
parent b340fc7e33
commit 7fee3c6d3b
2 changed files with 34 additions and 31 deletions

View file

@ -103,30 +103,6 @@ internal class WalletSettingsModel @Inject constructor(
),
)
private val makeBackupAtFirstAlertBS
get() = bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_passcode_lock_32) {
type = MessageBottomSheetUMV2.Icon.Type.Accent
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.hw_backup_need_title)
body = resourceReference(R.string.hw_backup_need_description)
}
primaryButton {
text = resourceReference(R.string.hw_backup_need_action)
onClick {
router.push(
AppRoute.CreateWalletBackup(
userWalletId = params.userWalletId,
isUpgradeFlow = false,
),
)
closeBs()
}
}
}
init {
getUserWalletUseCase.invoke(params.userWalletId).onRight {
analyticsContextProxy.addContext(it)
@ -366,7 +342,7 @@ internal class WalletSettingsModel @Inject constructor(
private fun onAccessCodeClick() {
if (!state.value.isWalletBackedUp) {
messageSender.send(makeBackupAtFirstAlertBS)
showMakeBackupAtFirstAlertBS(isUpgradeFlow = false)
} else {
unlockWalletIfNeedAndProceed {
router.push(AppRoute.UpdateAccessCode(params.userWalletId))
@ -375,12 +351,12 @@ internal class WalletSettingsModel @Inject constructor(
}
private fun onUpgradeWalletClick() {
unlockWalletIfNeedAndProceed {
router.push(
AppRoute.UpgradeWallet(
userWalletId = params.userWalletId,
),
)
if (!state.value.isWalletBackedUp) {
showMakeBackupAtFirstAlertBS(isUpgradeFlow = true)
} else {
unlockWalletIfNeedAndProceed {
router.push(AppRoute.UpgradeWallet(userWalletId = params.userWalletId))
}
}
}
@ -390,6 +366,32 @@ internal class WalletSettingsModel @Inject constructor(
}
}
private fun showMakeBackupAtFirstAlertBS(isUpgradeFlow: Boolean) {
val message = bottomSheetMessage {
infoBlock {
icon(R.drawable.ic_passcode_lock_32) {
type = MessageBottomSheetUMV2.Icon.Type.Accent
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
}
title = resourceReference(R.string.hw_backup_need_title)
body = resourceReference(R.string.hw_backup_need_description)
}
primaryButton {
text = resourceReference(R.string.hw_backup_need_action)
onClick {
router.push(
AppRoute.CreateWalletBackup(
userWalletId = params.userWalletId,
isUpgradeFlow = isUpgradeFlow,
),
)
closeBs()
}
}
}
messageSender.send(message)
}
private fun unlockWalletIfNeedAndProceed(action: () -> Unit) {
val userWallet = getUserWalletUseCase(params.userWalletId)
.getOrElse { error("User wallet with id ${params.userWalletId} not found") }

View file

@ -262,6 +262,7 @@ private fun UpgradeWalletBlock(model: WalletSettingsItemUM.UpgradeWallet, modifi
iconSize = 36.dp,
onClick = model.onClick,
onCloseClick = model.onDismissClick,
shouldShowArrowIcon = false,
),
modifier = modifier,
)