-
Notifications
You must be signed in to change notification settings - Fork 652
MIFOSAC-552 Implement Settings Step for New Recurring Deposits Account Flow #2528
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
base: development
Are you sure you want to change the base?
MIFOSAC-552 Implement Settings Step for New Recurring Deposits Account Flow #2528
Conversation
…agement in recurring account
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.
Suggestion: For the viewModel, you can take ref from how the vm is written in loanAccount or savingsAccount
Some additional changes:
-
Checkbox options dynamically influence field visibility (penal interest fields should only appear if checked).
Currently the field are visible even when Apply Penal Interest is unchecked.
- The spacing looks uneven.
UI mockup:
- Same here:
UI mockup:
| }, | ||
| ) | ||
| } | ||
| RecurringAccountState.DialogState.Loading -> { |
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.
The Loading State should be a ScreenState and not a DialogState.
| // Must be removed from here after the implementation of detail screen is finished. | ||
| loadTemplateByProduct() | ||
| } else { | ||
| setErrorState("No internet connection") |
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.
Hardcoded string can be moved to strings.xml and use getString() here
| // date in dd MM yyyy format. | ||
| submittedOnDate = s.recurringDepositAccountDetail.submittedOnDate, | ||
| ) | ||
| recurringAccountRepository.createRecurringDepositAccount(payload).collect { dataState -> |
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.
Before making a network call, check if the user is online or not. So include the logic from observe network here too.
| sendEvent(RecurringAccountEvent.NavigateBack) | ||
| } | ||
| RecurringAccountAction.RecurringAccountSettingsAction.OnNextPress -> { | ||
| if (state.currentStep < state.totalSteps) { |
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.
This part is same for the RecurringAccountAction.NextStep action as well, and can be extracted into a function like so:
private fun moveToNextStep() {
val current = state.currentStep
if (current < state.totalSteps) {
mutableStateFlow.update {
it.copy(
currentStep = current + 1,
)
}
} else {
sendEvent(SavingsAccountEvent.Finish)
}
}
| onFirstBtnClick = { onAction(RecurringAccountAction.RecurringAccountSettingsAction.OnBackPress) }, | ||
| onSecondBtnClick = { onAction(RecurringAccountAction.RecurringAccountSettingsAction.OnNextPress) }, | ||
| isButtonIconVisible = true, | ||
| isSecondButtonEnabled = settingsState.preMatureClosure.penalInterest.isNotBlank() && |
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.
Could extract this validation logic into the viewModel and use a state to represent this, something like:
val isTermsNextEnabled = isDetailsNextEnabled &&
currencyIndex != -1 &&
interestCalcIndex != -1 &&
interestPostingPeriodIndex != -1 &&
interestCompPeriodIndex != -1
| >(RecurringAccountState()) { | ||
|
|
||
| init { | ||
| observeNetwork() |
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.
I believe observerNetwork() is not really required. Instead only check network status right before making an api call or network request. So for each request include this logic before making the network request like so:
private fun loadClientTemplate() = viewModelScope.launch {
val online = networkMonitor.isOnline.first()
if (online) {
getClientTemplateUseCase().collect { result ->
sendAction(SavingsAccountAction.Internal.OnReceivingClientTemplate(result))
}
} else {
mutableStateFlow.update {
it.copy(
screenState = SavingsAccountState.ScreenState.NetworkError,
)
}
}
}
private fun loadSavingsProductTemplate() = viewModelScope.launch {
val online = networkMonitor.isOnline.first()
if (online) {
getSavingsProductTemplateUseCase().collect { result ->
sendAction(SavingsAccountAction.Internal.OnReceivingSavingsProductTemplate(result))
}
} else {
mutableStateFlow.update {
it.copy(
screenState = SavingsAccountState.ScreenState.NetworkError,
)
}
}
}
For reference you can check the NewLoanAccount pr's and the NewSavingsAccount pr's that are already merged.
| fun getRecuttingAccountTemplate(): Flow<DataState<RecurringDepositAccountTemplate>> | ||
|
|
||
| fun getRecuttingAccountRepositoryBtProduct( | ||
| fun getRecuttingAccountTemplateByProduct( |
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.
It should Recurring instead of Recutting
| override fun getRecuttingAccountTemplate(): Flow<DataState<RecurringDepositAccountTemplate>> { | ||
| return dataManagerRecurringAccount.getRecurringDepositAccountTemplate | ||
| .asDataStateFlow() | ||
| } | ||
|
|
||
| override fun getRecuttingAccountRepositoryBtProduct( | ||
| override fun getRecuttingAccountTemplateByProduct( |
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.
Same here, please review.
…in RecurringAccount components
…ingAccountViewModel and SettingsPage
Jira-#MIFOSAC-552
Record_2025-10-22-00-58-52_026f621985d6cfa1a169c52d305dc178.mp4