From b16cb42fd4a238499ba2c4a43c694c0bb512c442 Mon Sep 17 00:00:00 2001 From: arvifox Date: Mon, 9 Oct 2023 09:58:29 +0300 Subject: [PATCH] sca-133 --- build.gradle | 2 +- .../presentation/cardshub/CardsHubViewModel.kt | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 32f66423a..af8dfaf4b 100644 --- a/build.gradle +++ b/build.gradle @@ -44,7 +44,7 @@ buildscript { composeCompiler : '1.5.3', composeConstraintLayout: '1.1.0-alpha05', uiCore : '0.2.7', - soraCard : '0.1.54', + soraCard : '0.1.55', lazySodium : '5.0.2', jna : '5.8.0', accompanist : '0.30.1', diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubViewModel.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubViewModel.kt index f183a7354..5baa76c07 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubViewModel.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubViewModel.kt @@ -90,7 +90,6 @@ import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onStart -import kotlinx.coroutines.flow.withIndex import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -136,16 +135,11 @@ class CardsHubViewModel @Inject constructor( .subscribeVisibleCardsHubList() .catch { onError(it) } .distinctUntilChanged() - .withIndex() - .flatMapLatest { indexed -> - val data = indexed.value - if (indexed.index == 0) { - _state.value = _state.value.copy( - curAccount = data.first.accountTitle(), - loading = false, - cards = emptyList(), - ) - } + .flatMapLatest { data -> + _state.value = _state.value.copy( + curAccount = data.first.accountTitle(), + loading = false, + ) val flows = data.second.filter { it.visibility }.map { cardHub -> when (cardHub.cardType) { CardHubType.ASSETS -> {