Updated on 2026-08-14
This commit is contained in:
parent
22e6daa5d6
commit
4690bf2e6c
3 changed files with 17 additions and 9 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
@ -224,7 +224,11 @@ class WalletMiddleware {
|
|||
)
|
||||
},
|
||||
)
|
||||
.doOnSuccess { store.dispatch(WalletAction.SetArtworkUrl(it.artworkUrl)) }
|
||||
.doOnSuccess {
|
||||
store.dispatch(
|
||||
WalletAction.SetArtworkUrl(userWalletId = action.walletId, url = it.artworkUrl),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue