-
Notifications
You must be signed in to change notification settings - Fork 669
feat: Client upcoming charges UI #2488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Client upcoming charges UI #2488
Conversation
...Main/kotlin/com/mifos/feature/client/clientUpcomingCharges/ClientUpcomingChargesViewmodel.kt
Outdated
Show resolved
Hide resolved
...Main/kotlin/com/mifos/feature/client/clientUpcomingCharges/ClientUpcomingChargesViewmodel.kt
Show resolved
Hide resolved
|
it is not ready for review yet, its a draft |
|
@revanthkumarJ @Nagarjuna0033 any idea how do i get count of total charges as i am getting that as |
| dueAsOf = if (charge.dueDate != null) { | ||
| DateHelper.getDateAsString(charge.dueDate!!) | ||
| } else { | ||
| "N/A" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hard coded string, move to strings.xml
| due = if (charge.amount != null && charge.amountPaid != null) { | ||
| (charge.amount!! - charge.amountPaid!!).toString() | ||
| } else { | ||
| "N/A" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hard coded string, move to strings.xml
|
|
||
| fun checkNetworkAndGetCharges() { | ||
| viewModelScope.launch { | ||
| val isOnline = networkMonitor.isOnline.first() | ||
| when (isOnline) { | ||
| true -> { | ||
| mutableStateFlow.update { it.copy(dialogState = null) } | ||
| getClientCharges() | ||
| } | ||
|
|
||
| false -> { | ||
| mutableStateFlow.update { | ||
| it.copy( | ||
| dialogState = ClientUpcomingChargesState.DialogState.Error( | ||
| getString(Res.string.feature_client_error_not_connected_internet), | ||
| ), | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why aren't you using .collect,
It will update automatically UI when network status changes, without having to call the function.
Fetching a single boolean value continuously, isn't that much expensive operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we only need to check connectivity once before calling getClientCharges(), thats why i didn't use collect as it is unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair, I find updating automatically fun. But okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me give you an example 😀, lets say user is browsing savings accounts list, which is already loaded.
if we use collect - By chance, even for a second if the user loses internet, the screen will disappear depending on your usage :) which is not a good experience...
thats why it is preferable that we only show errorScreen if it fails to fetch at starting (using first() ) , otherwise we can just show a snackbar, which we are already doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. understood. I will update composables I am working on as well.
| menuList: List<Actions>, | ||
| onActionClicked: (Actions) -> Unit, | ||
| ) { | ||
| MifosActionsListingComponentOutline { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moves this MifosActionsListingComponentOutline inside the column and don't put action button inside this,
In figma design when you expand the card, the outline doesn't apply to the drop down box.
see the rest of the components.
I forgot to modify this one. I made changes to rest of them.
If another is left, update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you are at it. use a better animation to update the corner radius, I have just put a spring() animation spec.
| .padding(6.dp), | ||
| text = org.jetbrains.compose.resources.stringResource(Res.string.client_upcoming_charges_no_more_charges_available), | ||
| style = MaterialTheme.typography.bodyMedium, | ||
| textAlign = TextAlign.Center, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could fix this import issue.
Didn't create a Jira ticket, click here to create new.
Please Add Screenshots If there are any UI changes.
Please make sure these boxes are checked before submitting your pull request - thanks!
Run the static analysis check
./gradlew checkorci-prepush.shto make sure you didn't break anythingIf you have multiple commits please combine them into one commit by squashing them.