From 1545495d1c5708964e1ddc4da2226ab1f2d1dd02 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 17 Nov 2025 10:44:01 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../features/welcome/impl/model/WelcomeModel.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/features/welcome/impl/src/main/kotlin/com/tangem/features/welcome/impl/model/WelcomeModel.kt b/features/welcome/impl/src/main/kotlin/com/tangem/features/welcome/impl/model/WelcomeModel.kt index 27d08db855..3b301a83a1 100644 --- a/features/welcome/impl/src/main/kotlin/com/tangem/features/welcome/impl/model/WelcomeModel.kt +++ b/features/welcome/impl/src/main/kotlin/com/tangem/features/welcome/impl/model/WelcomeModel.kt @@ -91,7 +91,10 @@ internal class WelcomeModel @Inject constructor( router.replaceAll(AppRoute.Wallet) } .onLeft { - it.handle(null, onUserCancelled = { tryToUnlockWithAccessCodeRightAway() }) + it.handle( + specificWalletId = null, + onUserCancelled = { tryToUnlockWithAccessCodeRightAway() }, + ) setSelectWalletState() } } else { @@ -103,10 +106,10 @@ internal class WelcomeModel @Inject constructor( private suspend fun tryToUnlockWithAccessCodeRightAway() { if (onlyOneHotWalletWithAccessCode()) { - val userWallets = userWalletsListRepository.userWalletsSync() - val userWallet = userWallets.first() + val hotWalletLockedWithAccessCode = userWalletsListRepository.userWalletsSync() + .first { it.isLocked && it is UserWallet.Hot } as UserWallet.Hot uiState.value = WelcomeUM.Empty - unlockWallet(userWallet.walletId, UserWalletsListRepository.UnlockMethod.AccessCode) + unlockWallet(hotWalletLockedWithAccessCode.walletId, UserWalletsListRepository.UnlockMethod.AccessCode) } } @@ -144,7 +147,7 @@ internal class WelcomeModel @Inject constructor( } private suspend fun onlyOneHotWalletWithAccessCode(): Boolean { - val userWalletsWithLock = userWalletsListRepository.userWalletsSync().filter { it.isLocked } + val userWalletsWithLock = userWalletsListRepository.userWalletsSync() if (userWalletsWithLock.size != 1) return false val wallet = userWalletsWithLock.first() return wallet is UserWallet.Hot && wallet.hotWalletId.authType != HotWalletId.AuthType.NoPassword