From 91fe257823ce3f7fcb8970db887953e645e26f0a Mon Sep 17 00:00:00 2001 From: Aditya-gupta99 Date: Mon, 17 Jun 2024 21:20:28 +0530 Subject: [PATCH] fix: code clean up --- .../mifos/core/designsystem/icon/MifosIcon.kt | 8 +++++ .../use_cases/GetCheckerInboxBadgesUseCase.kt | 31 ------------------- .../center/center_list/ui/CenterListScreen.kt | 4 +-- .../center/src/main/res/values/strings.xml | 1 + .../checker_inbox/ui/CheckerInboxScreen.kt | 12 +++---- .../ui/CheckerInboxTasksViewModel.kt | 1 - .../feature/groupsList/GroupsListScreen.kt | 5 +-- .../groups/src/main/res/values/strings.xml | 1 + 8 files changed, 21 insertions(+), 42 deletions(-) diff --git a/core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcon.kt b/core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcon.kt index cd383b02a24..9ccc8e3c24b 100644 --- a/core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcon.kt +++ b/core/designsystem/src/main/java/com/mifos/core/designsystem/icon/MifosIcon.kt @@ -2,11 +2,19 @@ package com.mifos.core.designsystem.icon import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.Add +import androidx.compose.material.icons.rounded.Check +import androidx.compose.material.icons.rounded.Close +import androidx.compose.material.icons.rounded.Delete import androidx.compose.material.icons.rounded.FilterList import androidx.compose.material.icons.rounded.Search +import androidx.compose.material.icons.rounded.Sync object MifosIcons { val Add = Icons.Rounded.Add val search = Icons.Rounded.Search val filter = Icons.Rounded.FilterList + val sync = Icons.Rounded.Sync + val check = Icons.Rounded.Check + val close = Icons.Rounded.Close + val delete = Icons.Rounded.Delete } \ No newline at end of file diff --git a/core/domain/src/main/java/com/mifos/core/domain/use_cases/GetCheckerInboxBadgesUseCase.kt b/core/domain/src/main/java/com/mifos/core/domain/use_cases/GetCheckerInboxBadgesUseCase.kt index 05220a5dcde..59359eec6e3 100644 --- a/core/domain/src/main/java/com/mifos/core/domain/use_cases/GetCheckerInboxBadgesUseCase.kt +++ b/core/domain/src/main/java/com/mifos/core/domain/use_cases/GetCheckerInboxBadgesUseCase.kt @@ -2,15 +2,9 @@ package com.mifos.core.domain.use_cases import com.mifos.core.common.utils.Resource import com.mifos.core.data.repository.CheckerInboxTasksRepository -import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.callbackFlow import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.zip -import rx.Observable -import rx.Subscriber -import rx.android.schedulers.AndroidSchedulers -import rx.schedulers.Schedulers import javax.inject.Inject @@ -30,33 +24,8 @@ class GetCheckerInboxBadgesUseCase @Inject constructor( }.collect { emit(Resource.Success(it)) } - - -// Observable.zip( -// repository.getCheckerTaskList(), -// repository.getRescheduleLoansTaskList() -// ) { checkerTasks, rescheduleLoanTasks -> -// Pair(checkerTasks.size, rescheduleLoanTasks.size) -// }.observeOn(AndroidSchedulers.mainThread()) -// .subscribeOn(Schedulers.io()) -// .subscribe(object : Subscriber>() { -// override fun onCompleted() { -// -// } -// -// override fun onError(error: Throwable) { -// trySend(Resource.Error(error.message.toString())) -// } -// -// override fun onNext(badges: Pair) { -// trySend(Resource.Success(badges)) -// } -// }) - -// awaitClose { channel.close() } } catch (e: Exception) { emit(Resource.Error(e.message.toString())) -// trySend(Resource.Error(e.message.toString())) } } } \ No newline at end of file diff --git a/feature/center/src/main/java/com/mifos/feature/center/center_list/ui/CenterListScreen.kt b/feature/center/src/main/java/com/mifos/feature/center/center_list/ui/CenterListScreen.kt index 02147b1030b..75adea38229 100644 --- a/feature/center/src/main/java/com/mifos/feature/center/center_list/ui/CenterListScreen.kt +++ b/feature/center/src/main/java/com/mifos/feature/center/center_list/ui/CenterListScreen.kt @@ -152,10 +152,10 @@ fun CenterListScreen( }, ) { Icon( - imageVector = Icons.Rounded.Sync, + imageVector = MifosIcons.sync, contentDescription = "Sync Items", ) - Text(text = "Sync") + Text(text = stringResource(id = R.string.feature_center_sync)) } } ) diff --git a/feature/center/src/main/res/values/strings.xml b/feature/center/src/main/res/values/strings.xml index 3ee4a26d3e8..b6941a5e13e 100644 --- a/feature/center/src/main/res/values/strings.xml +++ b/feature/center/src/main/res/values/strings.xml @@ -3,4 +3,5 @@ Failed to load Centers Failed to load Database Centers No More Centers Available ! + Sync \ No newline at end of file diff --git a/feature/checker-inbox-task/src/main/java/com/mifos/feature/checker_inbox_task/checker_inbox/ui/CheckerInboxScreen.kt b/feature/checker-inbox-task/src/main/java/com/mifos/feature/checker_inbox_task/checker_inbox/ui/CheckerInboxScreen.kt index 1e393b32a1a..c73f5f16bd3 100644 --- a/feature/checker-inbox-task/src/main/java/com/mifos/feature/checker_inbox_task/checker_inbox/ui/CheckerInboxScreen.kt +++ b/feature/checker-inbox-task/src/main/java/com/mifos/feature/checker_inbox_task/checker_inbox/ui/CheckerInboxScreen.kt @@ -204,7 +204,7 @@ fun CheckerInboxScreen( resetSelectionMode() }) { Icon( - imageVector = Icons.Rounded.Check, + imageVector = MifosIcons.check, tint = Color.Green, contentDescription = null ) @@ -214,7 +214,7 @@ fun CheckerInboxScreen( resetSelectionMode() }) { Icon( - imageVector = Icons.Rounded.Close, + imageVector = MifosIcons.close, tint = Color.Yellow, contentDescription = null ) @@ -224,7 +224,7 @@ fun CheckerInboxScreen( resetSelectionMode() }) { Icon( - imageVector = Icons.Rounded.Delete, + imageVector = MifosIcons.delete, tint = Color.Red, contentDescription = null ) @@ -514,21 +514,21 @@ fun CheckerInboxItem( ) { IconButton(onClick = { onApprove(checkerTask.id) }) { Icon( - imageVector = Icons.Rounded.Check, + imageVector = MifosIcons.check, tint = Color.Green, contentDescription = null ) } IconButton(onClick = { onReject(checkerTask.id) }) { Icon( - imageVector = Icons.Rounded.Close, + imageVector = MifosIcons.close, tint = Color.Yellow, contentDescription = null ) } IconButton(onClick = { onDelete(checkerTask.id) }) { Icon( - imageVector = Icons.Rounded.Delete, + imageVector = MifosIcons.delete, tint = Color.Red, contentDescription = null ) diff --git a/feature/checker-inbox-task/src/main/java/com/mifos/feature/checker_inbox_task/checker_inbox_tasks/ui/CheckerInboxTasksViewModel.kt b/feature/checker-inbox-task/src/main/java/com/mifos/feature/checker_inbox_task/checker_inbox_tasks/ui/CheckerInboxTasksViewModel.kt index 9f300f7539b..a0694878bc2 100644 --- a/feature/checker-inbox-task/src/main/java/com/mifos/feature/checker_inbox_task/checker_inbox_tasks/ui/CheckerInboxTasksViewModel.kt +++ b/feature/checker-inbox-task/src/main/java/com/mifos/feature/checker_inbox_task/checker_inbox_tasks/ui/CheckerInboxTasksViewModel.kt @@ -39,7 +39,6 @@ class CheckerInboxTasksViewModel @Inject constructor( when (result) { is Resource.Error -> { - Log.e("Error", result.message.toString()) _checkerInboxTasksUiState.value = CheckerInboxTasksUiState.Error(result.message.toString()) } diff --git a/feature/groups/src/main/java/com/mifos/feature/groupsList/GroupsListScreen.kt b/feature/groups/src/main/java/com/mifos/feature/groupsList/GroupsListScreen.kt index 7cfc38a4506..1d3b55ece9f 100644 --- a/feature/groups/src/main/java/com/mifos/feature/groupsList/GroupsListScreen.kt +++ b/feature/groups/src/main/java/com/mifos/feature/groupsList/GroupsListScreen.kt @@ -60,6 +60,7 @@ import com.mifos.core.designsystem.component.MifosCircularProgress import com.mifos.core.designsystem.component.MifosPaginationSweetError import com.mifos.core.designsystem.component.MifosPagingAppendProgress import com.mifos.core.designsystem.component.MifosSweetError +import com.mifos.core.designsystem.icon.MifosIcons import com.mifos.core.designsystem.theme.BluePrimary import com.mifos.core.designsystem.theme.BlueSecondary import com.mifos.core.designsystem.theme.DarkGray @@ -165,10 +166,10 @@ fun GroupsListScreen( }, ) { Icon( - imageVector = Icons.Rounded.Sync, + imageVector = MifosIcons.sync, contentDescription = "Sync Items", ) - Text(text = "Sync") + Text(text = stringResource(id = R.string.feature_groups_sync)) } } ) diff --git a/feature/groups/src/main/res/values/strings.xml b/feature/groups/src/main/res/values/strings.xml index 9e1001e3ad0..aaa826c8622 100644 --- a/feature/groups/src/main/res/values/strings.xml +++ b/feature/groups/src/main/res/values/strings.xml @@ -5,5 +5,6 @@ Failed to load Database Groups Failed to Fetch Groups No more Groups Available + Sync \ No newline at end of file