Skip to content

Commit

Permalink
Send LOADING to the UI model of stats screen if the state is loading
Browse files Browse the repository at this point in the history
  • Loading branch information
irfano committed Mar 2, 2024
1 parent 86e5706 commit c069412
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ class UiModelMapper
if (useCaseModels.isNotEmpty()) {
UiModel.Success(useCaseModels.mapNotNull { useCaseModel ->
when {
useCaseModel.state == LOADING -> useCaseModel.stateData?.let {
StatsBlock.Loading(useCaseModel.type, useCaseModel.stateData)
}

useCaseModel.type == overViewType && useCaseModel.data != null -> StatsBlock.Success(
useCaseModel.type,
useCaseModel.data
Expand All @@ -109,10 +113,6 @@ class UiModelMapper
useCaseModel.data ?: listOf()
)

useCaseModel.state == LOADING -> useCaseModel.stateData?.let {
StatsBlock.Loading(useCaseModel.type, useCaseModel.stateData)
}

useCaseModel.state == ERROR -> useCaseModel.stateData?.let {
StatsBlock.Error(useCaseModel.type, useCaseModel.stateData)
}
Expand Down

0 comments on commit c069412

Please sign in to comment.