Updated on 2026-08-14

This commit is contained in:
Tangem 2025-11-17 10:44:01 +03:00
parent 6ad2d142a4
commit 1545495d1c

View file

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