Merge pull request #2102 from medici/summaryOptimization

Summary Screen Loan Application Id optimization
This commit is contained in:
rahul bhat
2021-12-29 15:02:02 +05:30
committed by GitHub Enterprise
2 changed files with 24 additions and 4 deletions

View File

@@ -1314,6 +1314,15 @@ class NaviAnalytics private constructor() {
fun onOtpVerified() =
NaviTrackEvent.trackEvent("otp_verified_for_disbursement")
fun loanApplicationIdError() =
NaviTrackEvent.trackEventOnClickStream("apply_loan_loan_app_id_error")
fun wrongLoanApplicationIdReceived() =
NaviTrackEvent.trackEventOnClickStream("loan_application_id_received_is_wrong")
fun loanApplicationIdReceived() =
NaviTrackEvent.trackEventOnClickStream("loan_application_id_received_is_valid")
}
inner class MyLoan {

View File

@@ -150,6 +150,9 @@ class SummaryFragment : BaseFragment(), View.OnClickListener, CtaListener,
LOAN_APPLICATION_ID,
loanDetails.loanApplicationId.orEmpty()
)
loanApplicationId = loanDetails.loanApplicationId
if (loanApplicationId.isNullOrBlank()) eventTracker.wrongLoanApplicationIdReceived()
else eventTracker.loanApplicationIdReceived()
}
private fun initAsync(asyncResponse: UploadDataAsyncResponse) {
@@ -243,9 +246,13 @@ class SummaryFragment : BaseFragment(), View.OnClickListener, CtaListener,
private fun fetchSummary() {
showLoader()
val id = loanApplicationId
if (!id.isNullOrBlank())
if (!id.isNullOrBlank()) {
viewModel.fetchSummary(id)
else
PreferenceManager.setStringPreference(
LOAN_APPLICATION_ID,
id
)
} else
viewModel.fetchLoanBasicDetails()
}
@@ -298,10 +305,14 @@ class SummaryFragment : BaseFragment(), View.OnClickListener, CtaListener,
if (binding.footerView.isCheckBoxViewVisible()) {
updateCommunicationMediums()
}
PreferenceManager.getStringPreference(LOAN_APPLICATION_ID)?.let {
val loanId = loanApplicationId
if (loanId.isNullOrBlank()) {
eventTracker.loanApplicationIdError()
} else {
showLoader()
viewModel.signLoanAgreement(it, UserProfile(email = binding.emailLayout.getText()))
viewModel.signLoanAgreement(loanId, UserProfile(email = binding.emailLayout.getText()))
}
}
private fun updateCommunicationMediums() {