From dfd6f4f82ea9aa780c76da6a74b52b65c332decb Mon Sep 17 00:00:00 2001 From: Darkeye14 Date: Thu, 12 Dec 2024 19:59:12 +0530 Subject: [PATCH] spotless and detekt MIFOSAC-306 --- .../feature/center/centerList/ui/CenterListScreen.kt | 2 +- .../client/clientList/presentation/ClientListScreen.kt | 5 ++--- .../clientList/presentation/ClientListViewModel.kt | 9 ++------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/feature/center/src/main/java/com/mifos/feature/center/centerList/ui/CenterListScreen.kt b/feature/center/src/main/java/com/mifos/feature/center/centerList/ui/CenterListScreen.kt index d6fad7813c..265564a8e9 100644 --- a/feature/center/src/main/java/com/mifos/feature/center/centerList/ui/CenterListScreen.kt +++ b/feature/center/src/main/java/com/mifos/feature/center/centerList/ui/CenterListScreen.kt @@ -584,7 +584,7 @@ private fun CenterListDbContent( } } -class CenterListUiStateProvider : +private class CenterListUiStateProvider : PreviewParameterProvider { override val values: Sequence diff --git a/feature/client/src/main/java/com/mifos/feature/client/clientList/presentation/ClientListScreen.kt b/feature/client/src/main/java/com/mifos/feature/client/clientList/presentation/ClientListScreen.kt index dad7f3a89e..97ce291169 100644 --- a/feature/client/src/main/java/com/mifos/feature/client/clientList/presentation/ClientListScreen.kt +++ b/feature/client/src/main/java/com/mifos/feature/client/clientList/presentation/ClientListScreen.kt @@ -104,9 +104,8 @@ internal fun ClientListScreen( viewModel.refreshClientList() }, refreshState = isRefreshing, - onClientSelect = onClientSelect + onClientSelect = onClientSelect, ) - } @Composable @@ -117,7 +116,7 @@ internal fun ClientListScreen( onRefresh: () -> Unit, refreshState: Boolean, onClientSelect: (Int) -> Unit, -){ +) { val snackbarHostState = remember { SnackbarHostState() } val swipeRefreshState = rememberSwipeRefreshState(isRefreshing = refreshState) diff --git a/feature/client/src/main/java/com/mifos/feature/client/clientList/presentation/ClientListViewModel.kt b/feature/client/src/main/java/com/mifos/feature/client/clientList/presentation/ClientListViewModel.kt index cf3faec16c..9267017035 100644 --- a/feature/client/src/main/java/com/mifos/feature/client/clientList/presentation/ClientListViewModel.kt +++ b/feature/client/src/main/java/com/mifos/feature/client/clientList/presentation/ClientListViewModel.kt @@ -15,16 +15,11 @@ import com.mifos.core.common.utils.Resource import com.mifos.core.data.repository.ClientListRepository import com.mifos.core.datastore.PrefManager import com.mifos.core.domain.useCases.GetClientListDbUseCase -import com.mifos.core.objects.client.Client -import com.mifos.core.objects.client.Page import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch -import rx.Subscriber -import rx.android.schedulers.AndroidSchedulers -import rx.schedulers.Schedulers import javax.inject.Inject /** @@ -69,8 +64,8 @@ class ClientListViewModel @Inject constructor( } private fun loadClientsFromDb() = viewModelScope.launch(Dispatchers.IO) { - getClientListDbUseCase.invoke().collect{ result -> - when(result){ + getClientListDbUseCase.invoke().collect { result -> + when (result) { is Resource.Error<*> -> _clientListUiState.value = ClientListUiState.Error("Failed to Fetch Clients") is Resource.Loading -> _clientListUiState.value = ClientListUiState.Empty