Feature/transactions screen#32
Conversation
YoussefmSaber
left a comment
There was a problem hiding this comment.
Good work, but check the comments and take in consideration
…ransactionUiState
| class GetCategoriesUseCase(private val repository: CategoryRepository) { | ||
| suspend operator fun invoke() = repository.getCategories() | ||
| } No newline at end of file |
There was a problem hiding this comment.
what is the use of this usecase it's just a wrapper, no need for it
There was a problem hiding this comment.
for the effect and intent can you referre to this pr, that shows how are we going to use our architecture and code base
| transactions: List<TransactionUiModel>, | ||
| currentState: TransactionUiState.ContentState, | ||
| selectedTransactionType: TransactionUiState.TransactionTypeFilter, | ||
| date: LocalDate, | ||
| listState: LazyListState, | ||
| onDateClick: () -> Unit, | ||
| onFilterClick: () -> Unit, | ||
| allCategories: List<CategoryUiModel>, | ||
| selectedCategoryIds: List<String>, | ||
| showCategoriesFilterBottomSheet: Boolean, | ||
| showDatePickerDialog: Boolean, | ||
| onApplyFilterClick: (List<String>) -> Unit, | ||
| onDismissCategorySheet: () -> Unit, | ||
| onTransactionTypeClick: (TransactionUiState.TransactionTypeFilter) -> Unit, | ||
| onAddTransactionClick: () -> Unit, | ||
| onDateSelected: (LocalDate) -> Unit, | ||
| onDatePickerDialogDismiss: () -> Unit, | ||
| modifier: Modifier = Modifier, |
There was a problem hiding this comment.
why all of this, just pass the state, and the viewModel intent and call them inside the code, no need for such thing
| fadeInSpec = tween(300, easing = EaseInExpo), | ||
| fadeOutSpec = tween(300, easing = EaseOutExpo), | ||
| placementSpec = spring( | ||
| dampingRatio = Spring.DampingRatioLowBouncy, | ||
| stiffness = Spring.StiffnessLow | ||
| ) |
There was a problem hiding this comment.
for animations, i have already made an animations for our project, you can find it inside the design_system module -> theme -> animations
| tryExecute( | ||
| block = { getTransactionsUseCase(filter) }, | ||
| onStart = { | ||
| updateState { copy(isLoading = true, isError = false) } | ||
| }, | ||
| onSuccess = { transactions -> | ||
| val allTransactions = transactions.map { it.toUiModel() } | ||
| updateState { | ||
| copy( | ||
| allTransactions = allTransactions, | ||
| isLoading = false, | ||
| isError = false | ||
| ) | ||
| } | ||
| applyLocalFilters(newListToFilter = allTransactions) | ||
| }, | ||
| onError = { error -> | ||
| updateState { | ||
| copy( | ||
| isLoading = false, | ||
| isError = true, | ||
| errorMessage = error.message | ||
| ) | ||
| } | ||
| sendEffect(TransactionEffect.ShowSnackbarError(error.message ?: "Unknown Error")) | ||
| } | ||
| ) |
There was a problem hiding this comment.
split each function inside the tryExecute to a seperate function, take a look on other prs, we all using this structure, and when call the functions inside the tryExecute call them in order
onStart,
block,
onSuccess,
onError
| tryExecute( | ||
| block = { getCategoriesUseCase() }, | ||
| onSuccess = { categories -> | ||
| updateState { | ||
| copy( | ||
| categories = categories.map { category -> | ||
| category.toUiModel() | ||
| }, | ||
| ) | ||
| } | ||
| }, | ||
| onError = { error -> | ||
| sendEffect(TransactionEffect.ShowSnackbarError(error.message ?: "Unknown Error")) | ||
| } | ||
| ) |
Feat: Implement Transaction Screen
Demo
money++.mp4
Key Features
Related issues: