From 4690bf2e6ca1139fcc93d780233e9c1951934937 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 24 Apr 2023 20:54:01 +0800 Subject: [PATCH] Updated on 2026-08-14 --- .../tap/features/wallet/redux/WalletAction.kt | 7 +++---- .../wallet/redux/middlewares/WalletMiddleware.kt | 6 +++++- .../features/wallet/redux/reducers/WalletReducer.kt | 13 +++++++++---- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletAction.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletAction.kt index e4a508d068..18bf0dbc24 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletAction.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/WalletAction.kt @@ -105,9 +105,8 @@ sealed class WalletAction : Action { sealed class TradeCryptoAction : WalletAction() { object Sell : TradeCryptoAction() - data class Buy( - val checkUserLocation: Boolean = true, - ) : TradeCryptoAction() + + data class Buy(val checkUserLocation: Boolean = true) : TradeCryptoAction() data class FinishSelling(val transactionId: String) : TradeCryptoAction() data class SendCrypto( @@ -134,5 +133,5 @@ sealed class WalletAction : Action { data class UpdateUserWalletArtwork(val walletId: UserWalletId) : WalletAction() - data class SetArtworkUrl(val url: String) : WalletAction() + data class SetArtworkUrl(val userWalletId: UserWalletId, val url: String) : WalletAction() } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/WalletMiddleware.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/WalletMiddleware.kt index c12bebc8c7..5205339fca 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/WalletMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/middlewares/WalletMiddleware.kt @@ -224,7 +224,11 @@ class WalletMiddleware { ) }, ) - .doOnSuccess { store.dispatch(WalletAction.SetArtworkUrl(it.artworkUrl)) } + .doOnSuccess { + store.dispatch( + WalletAction.SetArtworkUrl(userWalletId = action.walletId, url = it.artworkUrl), + ) + } } } } diff --git a/app/src/main/java/com/tangem/tap/features/wallet/redux/reducers/WalletReducer.kt b/app/src/main/java/com/tangem/tap/features/wallet/redux/reducers/WalletReducer.kt index d58f997bc8..66d82deb98 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/redux/reducers/WalletReducer.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/redux/reducers/WalletReducer.kt @@ -1,8 +1,8 @@ package com.tangem.tap.features.wallet.redux.reducers import com.tangem.blockchain.common.Wallet -import com.tangem.domain.models.scan.CardDTO import com.tangem.domain.common.TapWorkarounds.isTestCard +import com.tangem.domain.models.scan.CardDTO import com.tangem.tap.common.redux.AppState import com.tangem.tap.domain.TapError import com.tangem.tap.domain.model.WalletDataModel @@ -14,6 +14,7 @@ import com.tangem.tap.features.wallet.redux.ProgressState import com.tangem.tap.features.wallet.redux.WalletAction import com.tangem.tap.features.wallet.redux.WalletState import com.tangem.tap.proxy.AppStateHolder +import com.tangem.tap.userWalletsListManager import org.rekotlin.Action object WalletReducer { @@ -115,9 +116,13 @@ private fun internalReduce(action: Action, state: AppState, appStateHolder: AppS newState = newState.copy(canSaveUserWallets = action.canSaveUserWallets) } is WalletAction.SetArtworkUrl -> { - newState = newState.copy( - cardImage = Artwork(artworkId = action.url, artwork = newState.cardImage?.artwork), - ) + val selectedUserWallet = userWalletsListManager.selectedUserWalletSync?.walletId + + if (selectedUserWallet == action.userWalletId) { + newState = newState.copy( + cardImage = Artwork(artworkId = action.url, artwork = newState.cardImage?.artwork), + ) + } } else -> Unit }