Skip to content

Commit

Permalink
fix: code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-gupta99 committed Jun 17, 2024
1 parent b5be5cf commit 91fe257
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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<Pair<Int, Int>>() {
// override fun onCompleted() {
//
// }
//
// override fun onError(error: Throwable) {
// trySend(Resource.Error(error.message.toString()))
// }
//
// override fun onNext(badges: Pair<Int, Int>) {
// trySend(Resource.Success(badges))
// }
// })

// awaitClose { channel.close() }
} catch (e: Exception) {
emit(Resource.Error(e.message.toString()))
// trySend(Resource.Error(e.message.toString()))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
)
Expand Down
1 change: 1 addition & 0 deletions feature/center/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<string name="feature_center_error_loading_centers">Failed to load Centers</string>
<string name="feature_center_failed_to_load_db_centers">Failed to load Database Centers</string>
<string name="feature_center_no_more_centers">No More Centers Available !</string>
<string name="feature_center_sync">Sync</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ fun CheckerInboxScreen(
resetSelectionMode()
}) {
Icon(
imageVector = Icons.Rounded.Check,
imageVector = MifosIcons.check,
tint = Color.Green,
contentDescription = null
)
Expand All @@ -214,7 +214,7 @@ fun CheckerInboxScreen(
resetSelectionMode()
}) {
Icon(
imageVector = Icons.Rounded.Close,
imageVector = MifosIcons.close,
tint = Color.Yellow,
contentDescription = null
)
Expand All @@ -224,7 +224,7 @@ fun CheckerInboxScreen(
resetSelectionMode()
}) {
Icon(
imageVector = Icons.Rounded.Delete,
imageVector = MifosIcons.delete,
tint = Color.Red,
contentDescription = null
)
Expand Down Expand Up @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
}
)
Expand Down
1 change: 1 addition & 0 deletions feature/groups/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
<string name="feature_groups_failed_to_load_db_groups">Failed to load Database Groups</string>
<string name="feature_groups_failed_to_fetch_groups">Failed to Fetch Groups</string>
<string name="feature_groups_no_more_groups_available">No more Groups Available</string>
<string name="feature_groups_sync">Sync</string>

</resources>

0 comments on commit 91fe257

Please sign in to comment.