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

@ -3,6 +3,7 @@ package com.tangem.data.wallets.hot
import com.tangem.common.core.TangemSdkError
import com.tangem.domain.core.wallets.UserWalletsListRepository
import com.tangem.domain.models.wallet.UserWallet
import com.tangem.domain.models.wallet.UserWalletId
import com.tangem.domain.wallets.hot.HotWalletAccessor
import com.tangem.domain.wallets.hot.HotWalletPasswordRequester
import com.tangem.domain.wallets.repository.WalletsRepository
@ -56,12 +57,22 @@ class DefaultHotWalletAccessor @Inject constructor(
contextualUnlockHotWallet[hotWalletId]
override fun clearContextualUnlock(hotWalletId: HotWalletId) {
contextualUnlockHotWallet[hotWalletId] = null
contextualUnlockHotWallet.remove(hotWalletId)
scope.launch {
tangemHotSdk.clearUnlockContext(hotWalletId)
}
}
override fun clearContextualUnlock(userWalletId: UserWalletId) {
scope.launch {
val userWallet = userWalletsListRepository.userWalletsSync()
.find { it is UserWallet.Hot && it.walletId == userWalletId }
as? UserWallet.Hot
?: return@launch
clearContextualUnlock(userWallet.hotWalletId)
}
}
override fun clearAllContextualUnlock() {
val hotWalletsIds = contextualUnlockHotWallet.keys.toList()
contextualUnlockHotWallet.clear()