Updated on 2026-08-14
This commit is contained in:
parent
ab5fac9196
commit
a298e77060
6 changed files with 25 additions and 30 deletions
|
|
@ -18,7 +18,7 @@ interface UserWalletsListManager {
|
|||
/** [Flow] with selected [UserWallet] updates */
|
||||
val selectedUserWallet: Flow<UserWallet>
|
||||
|
||||
/** All saved [UserWallet]s */
|
||||
/** [List] with all saved [UserWallet]s updates */
|
||||
val userWalletsSync: List<UserWallet>
|
||||
|
||||
/** Selected [UserWallet] */
|
||||
|
|
|
|||
|
|
@ -7,12 +7,11 @@ import com.tangem.domain.wallets.legacy.UserWalletsListManager
|
|||
import com.tangem.domain.wallets.models.GetUserWalletError
|
||||
import com.tangem.domain.wallets.models.UserWallet
|
||||
import com.tangem.domain.wallets.models.UserWalletId
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
|
||||
class GetUserWalletUseCase(private val userWalletsListManager: UserWalletsListManager) {
|
||||
|
||||
suspend operator fun invoke(userWalletId: UserWalletId): Either<GetUserWalletError, UserWallet> = either {
|
||||
val userWallets = userWalletsListManager.userWallets.firstOrNull().orEmpty()
|
||||
operator fun invoke(userWalletId: UserWalletId): Either<GetUserWalletError, UserWallet> = either {
|
||||
val userWallets = userWalletsListManager.userWalletsSync
|
||||
|
||||
ensureNotNull(userWallets.firstOrNull { it.walletId == userWalletId }) {
|
||||
raise(GetUserWalletError.UserWalletNotFound)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue