Updated on 2026-08-14

This commit is contained in:
Tangem 2026-01-30 20:48:10 +03:00
parent 5a8ebb312c
commit 047a48eaf0
12 changed files with 76 additions and 18 deletions

View file

@ -197,18 +197,20 @@ internal class WelcomeModel @Inject constructor(
onSuccess = { scanResponse ->
val userWallet =
coldUserWalletBuilderFactory.create(scanResponse = scanResponse).build() ?: return@scan
saveWalletUseCase.invoke(userWallet)
.onLeft { error ->
if (error is SaveWalletError.WalletAlreadySaved) {
userWalletsListRepository.unlock(
userWallet.walletId,
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(scanResponse),
).onRight {
userWalletsListRepository.select(userWallet.walletId)
router.replaceAll(AppRoute.Wallet)
}
saveWalletUseCase.invoke(
userWallet = userWallet,
analyticsSource = AnalyticsParam.ScreensSources.SignIn,
).onLeft { error ->
if (error is SaveWalletError.WalletAlreadySaved) {
userWalletsListRepository.unlock(
userWallet.walletId,
unlockMethod = UserWalletsListRepository.UnlockMethod.Scan(scanResponse),
).onRight {
userWalletsListRepository.select(userWallet.walletId)
router.replaceAll(AppRoute.Wallet)
}
}
}
.onRight {
router.replaceAll(AppRoute.Wallet)
}