Updated on 2026-08-14

This commit is contained in:
Tangem 2025-09-11 15:53:28 +05:00
parent 410253dc5a
commit 3c3f35aeb6
26 changed files with 589 additions and 63 deletions

View file

@ -363,32 +363,16 @@ internal class WalletSettingsModel @Inject constructor(
if (!state.value.isWalletBackedUp) {
messageSender.send(makeBackupAtFirstAlertBS)
} else {
val userWallet = getUserWalletUseCase(params.userWalletId)
.getOrElse { error("User wallet with id ${params.userWalletId} not found") }
if (userWallet is UserWallet.Hot) {
val hotWalletId = userWallet.hotWalletId
when (hotWalletId.authType) {
HotWalletId.AuthType.NoPassword -> {
router.push(AppRoute.UpdateAccessCode(params.userWalletId))
}
HotWalletId.AuthType.Password,
HotWalletId.AuthType.Biometry,
-> modelScope.launch {
unlockHotWalletContextualUseCase.invoke(hotWalletId)
.onLeft {
Timber.e("Unable to unlock wallet with id ${params.userWalletId}")
}
.onRight {
router.push(AppRoute.UpdateAccessCode(params.userWalletId))
}
}
}
unlockWalletIfNeedAndProceed {
router.push(AppRoute.UpdateAccessCode(params.userWalletId))
}
}
}
private fun onUpgradeWalletClick() {
router.push(AppRoute.UpgradeWallet(params.userWalletId))
unlockWalletIfNeedAndProceed {
router.push(AppRoute.UpgradeWallet(params.userWalletId))
}
}
private fun onDismissUpgradeWalletClick() {
@ -396,4 +380,28 @@ internal class WalletSettingsModel @Inject constructor(
dismissUpgradeWalletNotificationUseCase.invoke(params.userWalletId)
}
}
private fun unlockWalletIfNeedAndProceed(action: () -> Unit) {
val userWallet = getUserWalletUseCase(params.userWalletId)
.getOrElse { error("User wallet with id ${params.userWalletId} not found") }
if (userWallet is UserWallet.Hot) {
val hotWalletId = userWallet.hotWalletId
when (hotWalletId.authType) {
HotWalletId.AuthType.NoPassword -> {
action()
}
HotWalletId.AuthType.Password,
HotWalletId.AuthType.Biometry,
-> modelScope.launch {
unlockHotWalletContextualUseCase.invoke(hotWalletId)
.onLeft {
Timber.e("Unable to unlock wallet with id ${params.userWalletId}")
}
.onRight {
action()
}
}
}
}
}
}