Skip to content

Conversation

@TheKalpeshPawar
Copy link
Contributor

Jira-#MIFOSAC-552

Record_2025-10-22-00-58-52_026f621985d6cfa1a169c52d305dc178.mp4

Copy link
Contributor

@sam-arth07 sam-arth07 left a 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:

  1. 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.

  1. The spacing looks uneven.
Image

UI mockup:

Image
  1. Same here:
Image

UI mockup:

Image

},
)
}
RecurringAccountState.DialogState.Loading -> {
Copy link
Contributor

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")
Copy link
Contributor

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 ->
Copy link
Contributor

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) {
Copy link
Contributor

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() &&
Copy link
Contributor

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()
Copy link
Contributor

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.

Comment on lines 20 to 22
fun getRecuttingAccountTemplate(): Flow<DataState<RecurringDepositAccountTemplate>>

fun getRecuttingAccountRepositoryBtProduct(
fun getRecuttingAccountTemplateByProduct(
Copy link
Contributor

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

Comment on lines 24 to 29
override fun getRecuttingAccountTemplate(): Flow<DataState<RecurringDepositAccountTemplate>> {
return dataManagerRecurringAccount.getRecurringDepositAccountTemplate
.asDataStateFlow()
}

override fun getRecuttingAccountRepositoryBtProduct(
override fun getRecuttingAccountTemplateByProduct(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, please review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants