Updated on 2026-08-14
This commit is contained in:
parent
6b75b48f1e
commit
8e6eca1b4c
23 changed files with 327 additions and 216 deletions
|
|
@ -5,25 +5,23 @@ import com.tangem.domain.common.wallets.UserWalletsListRepository
|
|||
import com.tangem.domain.common.wallets.error.SelectWalletError
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.redux.ReduxStateHolder
|
||||
|
||||
/**
|
||||
* Use case for selecting wallet
|
||||
* Use case for selecting wallet.
|
||||
*
|
||||
* Side effects tied to selection (analytics tracking context, Tangem SDK display config, access
|
||||
* code request policy) are fired from the repository itself when the selected [UserWalletId]
|
||||
* changes — see the implementation of [UserWalletsListRepository.select].
|
||||
*
|
||||
* @property userWalletsListRepository repository for getting list of user wallets
|
||||
* @property reduxStateHolder redux state holder
|
||||
*
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class SelectWalletUseCase(
|
||||
private val userWalletsListRepository: UserWalletsListRepository,
|
||||
private val reduxStateHolder: ReduxStateHolder,
|
||||
) {
|
||||
|
||||
suspend operator fun invoke(userWalletId: UserWalletId): Either<SelectWalletError, UserWallet> {
|
||||
return userWalletsListRepository.select(userWalletId).map {
|
||||
reduxStateHolder.onUserWalletSelected(it)
|
||||
it
|
||||
}
|
||||
return userWalletsListRepository.select(userWalletId)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue