From 6846deed7448bc241c53a45be658a45763fa0421 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 1 Mar 2023 12:38:45 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../features/wallet/ui/wallet/MultiWalletView.kt | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/MultiWalletView.kt b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/MultiWalletView.kt index d1eab75515..4d2bdc1fdc 100644 --- a/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/MultiWalletView.kt +++ b/app/src/main/java/com/tangem/tap/features/wallet/ui/wallet/MultiWalletView.kt @@ -1,10 +1,8 @@ package com.tangem.tap.features.wallet.ui.wallet import android.widget.Button -import androidx.core.view.isGone import androidx.core.view.isVisible import androidx.recyclerview.widget.LinearLayoutManager -import com.badoo.mvicore.DiffStrategy import com.badoo.mvicore.modelWatcher import com.tangem.core.analytics.Analytics import com.tangem.domain.common.TapWorkarounds.derivationStyle @@ -20,7 +18,6 @@ import com.tangem.tap.common.redux.navigation.NavigationAction import com.tangem.tap.domain.tokens.CurrenciesRepository import com.tangem.tap.features.tokens.redux.TokensAction import com.tangem.tap.features.wallet.models.TotalBalance -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.features.wallet.ui.BalanceStatus @@ -36,13 +33,6 @@ class MultiWalletView : WalletView() { private lateinit var walletsAdapter: WalletAdapter private val watcher = modelWatcher { - val totalBalanceStrategy: DiffStrategy = { old, new -> - old.cardId != new.cardId || - old.totalBalance != new.totalBalance || - old.state != new.state || - old.walletsStores.size != new.walletsStores.size - } - // !!! Workaround !!! // Checking state properties instead of state params can reduce application performance, // but here it is necessary because the WalletStore has an unsuitable equals method @@ -67,12 +57,11 @@ class MultiWalletView : WalletView() { handleBackupWarning(it, showBackupWarnings) } } - watch({ it }, totalBalanceStrategy) { walletState -> + (WalletState::totalBalance or WalletState::walletsDataFromStores) { walletState -> binding?.let { handleTotalBalance( binding = it, totalBalance = walletState.totalBalance, - progressState = walletState.state, walletsCount = walletState.walletsDataFromStores.size, ) } @@ -179,10 +168,9 @@ class MultiWalletView : WalletView() { private fun handleTotalBalance( binding: FragmentWalletBinding, totalBalance: TotalBalance?, - progressState: ProgressState, walletsCount: Int, ) = with(binding.lCardTotalBalance) { - isGone = progressState == ProgressState.Done && walletsCount == 0 + isVisible = walletsCount > 0 onChangeFiatCurrencyClick = { store.dispatch(WalletAction.AppCurrencyAction.ChooseAppCurrency)