From f89ecb15726c852b7610f8b9f113c1ce8b9e5d63 Mon Sep 17 00:00:00 2001 From: praneki Date: Fri, 23 Feb 2024 18:18:13 +0530 Subject: [PATCH] fix: Collection sheet Keeps on loading even the internet is turned off #2051 --- .../NewIndividualCollectionSheetViewModel.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividual/NewIndividualCollectionSheetViewModel.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividual/NewIndividualCollectionSheetViewModel.kt index b71fed1ac65..ba94d78a047 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividual/NewIndividualCollectionSheetViewModel.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/collectionsheetindividual/NewIndividualCollectionSheetViewModel.kt @@ -14,6 +14,7 @@ import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.plugins.RxJavaPlugins import rx.schedulers.Schedulers +import java.net.UnknownHostException import javax.inject.Inject /** @@ -86,6 +87,10 @@ class NewIndividualCollectionSheetViewModel @Inject constructor(private val repo _newIndividualCollectionSheetUiState.value = NewIndividualCollectionSheetUiState.ShowError(errorMessage) } + else if (e is UnknownHostException) { + _newIndividualCollectionSheetUiState.value = + NewIndividualCollectionSheetUiState.ShowError("No internet connection") + } } catch (throwable: Throwable) { RxJavaPlugins.getInstance().errorHandler.handleError(e) } @@ -114,6 +119,10 @@ class NewIndividualCollectionSheetViewModel @Inject constructor(private val repo _newIndividualCollectionSheetUiState.value = NewIndividualCollectionSheetUiState.ShowError(errorMessage) } + else if (e is UnknownHostException) { + _newIndividualCollectionSheetUiState.value = + NewIndividualCollectionSheetUiState.ShowError("No internet connection") + } } catch (throwable: Throwable) { RxJavaPlugins.getInstance().errorHandler.handleError(e) }