diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt index 418cb39368..23569c3eee 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/wallet/model/WalletModel.kt @@ -15,6 +15,7 @@ import com.tangem.domain.nft.FetchNFTCollectionsUseCase import com.tangem.domain.settings.* import com.tangem.domain.tokens.FetchCurrencyStatusUseCase import com.tangem.domain.tokens.RefreshMultiCurrencyWalletQuotesUseCase +import com.tangem.domain.wallets.models.UserWallet import com.tangem.domain.wallets.models.UserWalletId import com.tangem.domain.wallets.repository.WalletsRepository import com.tangem.domain.wallets.usecase.GetSelectedWalletUseCase @@ -356,9 +357,7 @@ internal class WalletModel @Inject constructor( coroutineScope = modelScope, ) - if (action.selectedWallet.scanResponse.cardTypesResolver.isSingleWallet()) { - fetchCurrencyStatusUseCase(userWalletId = action.selectedWallet.walletId) - } + fetchIfSingleWallet(action.selectedWallet) if (action.wallets.size > 1 && isWalletsScrollPreviewEnabled()) { withContext(dispatchers.io) { delay(timeMillis = 1_800) } @@ -385,6 +384,8 @@ internal class WalletModel @Inject constructor( coroutineScope = modelScope, ) + fetchIfSingleWallet(userWallet = action.selectedWallet) + stateHolder.update( ReinitializeWalletTransformer( prevWalletId = action.prevWalletId, @@ -402,12 +403,7 @@ internal class WalletModel @Inject constructor( coroutineScope = modelScope, ) - if (action.selectedWallet.scanResponse.cardTypesResolver.isSingleWallet()) { - modelScope.launch { - fetchCurrencyStatusUseCase(userWalletId = action.selectedWallet.walletId) - .onLeft { Timber.e(it.toString()) } - } - } + fetchIfSingleWallet(userWallet = action.selectedWallet) stateHolder.update( AddWalletTransformer( @@ -506,6 +502,15 @@ internal class WalletModel @Inject constructor( } } + private fun fetchIfSingleWallet(userWallet: UserWallet) { + if (userWallet.scanResponse.cardTypesResolver.isSingleWallet()) { + modelScope.launch { + fetchCurrencyStatusUseCase(userWalletId = userWallet.walletId) + .onLeft { Timber.e(it.toString()) } + } + } + } + inner class AskBiometryModelCallbacks : AskBiometryComponent.ModelCallbacks { override fun onAllowed() { analyticsEventsHandler.send(MainScreenAnalyticsEvent.EnableBiometrics(AnalyticsParam.OnOffState.On))