Skip to content

Commit

Permalink
Show assets errors only when non-automatic refresh is ongoing
Browse files Browse the repository at this point in the history
  • Loading branch information
micbakos-rdx committed Jul 3, 2024
1 parent e47b241 commit 6b2a183
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class AccountViewModel @Inject constructor(

fun onAssetsError(error: Throwable): State = copy(
refreshType = RefreshType.None,
uiMessage = UiMessage.ErrorMessage(error = error)
uiMessage = if (refreshType is RefreshType.Automatic) null else UiMessage.ErrorMessage(error = error)
)

fun onAssetsReceived(assets: Assets?): State = copy(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.babylon.wallet.android.domain.usecases.SecurityPromptType
import com.babylon.wallet.android.domain.usecases.accountPrompts
import com.babylon.wallet.android.domain.usecases.assets.GetFiatValueUseCase
import com.babylon.wallet.android.domain.usecases.assets.GetWalletAssetsUseCase
import com.babylon.wallet.android.presentation.account.AccountViewModel.State.RefreshType
import com.babylon.wallet.android.presentation.common.OneOffEvent
import com.babylon.wallet.android.presentation.common.OneOffEventHandler
import com.babylon.wallet.android.presentation.common.OneOffEventHandlerImpl
Expand Down Expand Up @@ -42,7 +43,6 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterIsInstance
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
Expand Down Expand Up @@ -390,7 +390,7 @@ class WalletViewModel @Inject constructor(
error: Throwable
): State = copy(
refreshType = RefreshType.None,
uiMessage = UiMessage.ErrorMessage(error),
uiMessage = if (refreshType is RefreshType.Automatic) null else UiMessage.ErrorMessage(error),
accountsWithAssets = accountsWithAssets?.map { accountWithAssets ->
if (accountWithAssets.assets == null) {
// If assets don't exist leave them empty
Expand Down

0 comments on commit 6b2a183

Please sign in to comment.