From 64f9369a7ef9d28bdbc40ca38e626861f591eb00 Mon Sep 17 00:00:00 2001 From: Sai thanush reddy Date: Fri, 8 Dec 2023 20:32:22 +0530 Subject: [PATCH] fix:#2448 Handle network error in HomeViewModel to emit error --- .../main/java/org/mifos/mobile/viewModels/HomeViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mifos/mobile/viewModels/HomeViewModel.kt b/app/src/main/java/org/mifos/mobile/viewModels/HomeViewModel.kt index e724ac68a..07125e4be 100644 --- a/app/src/main/java/org/mifos/mobile/viewModels/HomeViewModel.kt +++ b/app/src/main/java/org/mifos/mobile/viewModels/HomeViewModel.kt @@ -31,16 +31,18 @@ class HomeViewModel @Inject constructor(private val homeRepositoryImp: HomeRepos viewModelScope.launch { _homeUiState.value = HomeUiState.Loading homeRepositoryImp.clientAccounts().catch { - _homeUiState.value = HomeUiState.Error(R.string.error_fetching_accounts) + _homeUiState.value = HomeUiState.Error(R.string.no_internet_connection) }.collect { clientAccounts -> _homeUiState.value = HomeUiState.ClientAccountDetails( getLoanAccountDetails(clientAccounts.loanAccounts), getSavingAccountDetails(clientAccounts.savingsAccounts) ) + } } } + val userDetails: Unit get() { viewModelScope.launch {