Webview loan details page api support (#5626)
* adding webview support for all non-polling APIs before fetch-loan-fee-details API * corrected webview api support of fetchOfferId API * removed wrong clickstream event * moved common code to helper function
This commit is contained in:
committed by
GitHub Enterprise
parent
e0e8ce3a77
commit
6df4e63a3e
@@ -28,7 +28,8 @@ data class Offer(
|
||||
@SerializedName("moratoriumConfig") val moratoriumConfig: MoratoriumConfig? = null,
|
||||
@SerializedName("productCode") val productCode: String? = null,
|
||||
@SerializedName("configureEmiDate") val configureEmiDate: ConfigureEmiDate? = null,
|
||||
@SerializedName("loanOfferType") val loanOfferType: String? = null
|
||||
@SerializedName("loanOfferType") val loanOfferType: String? = null,
|
||||
@SerializedName("webViewUrl") var webViewUrl: String? = ""
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
|
||||
@@ -12,7 +12,8 @@ import com.google.gson.annotations.SerializedName
|
||||
data class OfferIdResponse(
|
||||
@SerializedName("requestId") val requestId: String? = null,
|
||||
@SerializedName("status") val status: String? = null,
|
||||
@SerializedName("details") val details: OfferId? = null
|
||||
@SerializedName("details") val details: OfferId? = null,
|
||||
@SerializedName("webViewUrl") var webViewUrl: String? = ""
|
||||
)
|
||||
|
||||
data class OfferId(
|
||||
|
||||
@@ -9,7 +9,8 @@ data class UploadDataWithCtaAsyncResponse(
|
||||
@SerializedName("status") val status: String? = null,
|
||||
@SerializedName("data") val data: AsyncDataResponse? = null,
|
||||
@SerializedName("notificationPath") val notificationPath: String? = null,
|
||||
@SerializedName("requestConfig") val requestConfig: RequestConfig? = null
|
||||
@SerializedName("requestConfig") val requestConfig: RequestConfig? = null,
|
||||
@SerializedName("webViewUrl") val webViewUrl: String? = ""
|
||||
)
|
||||
|
||||
data class AsyncDataResponse(
|
||||
|
||||
@@ -202,8 +202,13 @@ class FreshLoanDetailsV2Fragment :
|
||||
private fun initObservers() {
|
||||
viewModel.requestIdGenerateOffer.observeNullable(this) {
|
||||
it?.let {
|
||||
firebaseInit(it.requestId.orEmpty(), OFFER_GENERATE, it.notificationPath.orEmpty())
|
||||
apiPollInit(it.requestId, OFFER_GENERATE, it.requestConfig)
|
||||
loanDetailURL = it.webViewUrl ?: ""
|
||||
if (isWebView()) {
|
||||
redirectToWebView()
|
||||
} else {
|
||||
firebaseInit(it.requestId.orEmpty(), OFFER_GENERATE, it.notificationPath.orEmpty())
|
||||
apiPollInit(it.requestId, OFFER_GENERATE, it.requestConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,9 +217,14 @@ class FreshLoanDetailsV2Fragment :
|
||||
}
|
||||
|
||||
viewModel.offerIdResponse.observeNonNull(this) { offerIdResponse ->
|
||||
offerIdResponse.details?.offerId?.let {
|
||||
viewModel.fetchOffer(it)
|
||||
PreferenceManager.setStringPreference(OFFER_ID, it)
|
||||
loanDetailURL = offerIdResponse.webViewUrl ?: ""
|
||||
if(isWebView()) {
|
||||
redirectToWebView()
|
||||
} else {
|
||||
offerIdResponse.details?.offerId?.let {
|
||||
viewModel.fetchOffer(it)
|
||||
PreferenceManager.setStringPreference(OFFER_ID, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,9 +243,7 @@ class FreshLoanDetailsV2Fragment :
|
||||
}
|
||||
if (isWebView()) {
|
||||
loanDetailsEventTracker.onLoanFeeDetailReceived(currentTimeStamp = System.currentTimeMillis())
|
||||
binding.freshLoanCl.visibility = View.GONE
|
||||
binding.loanDetailWebView.visibility = View.VISIBLE
|
||||
showWebViewUI(binding.loanDetailWebView)
|
||||
redirectToWebView()
|
||||
feeDetailsWithFirstEmiDateFlow.value = getFeeDetailAndEmiDate(it)
|
||||
} else {
|
||||
destroyWebView(binding.loanDetailWebView)
|
||||
@@ -253,11 +261,16 @@ class FreshLoanDetailsV2Fragment :
|
||||
}
|
||||
|
||||
viewModel.offer.observeNonNull(this) {
|
||||
if (it.offerExpired.orTrue()) {
|
||||
handleOfferExpiry()
|
||||
return@observeNonNull
|
||||
loanDetailURL = it.webViewUrl ?: ""
|
||||
if(isWebView()) {
|
||||
redirectToWebView()
|
||||
} else {
|
||||
if (it.offerExpired.orTrue()) {
|
||||
handleOfferExpiry()
|
||||
return@observeNonNull
|
||||
}
|
||||
initData(it)
|
||||
}
|
||||
initData(it)
|
||||
}
|
||||
|
||||
viewModel.requestIdApplyLoan.observeNullable(this) {
|
||||
@@ -313,6 +326,12 @@ class FreshLoanDetailsV2Fragment :
|
||||
|
||||
}
|
||||
|
||||
private fun redirectToWebView() {
|
||||
binding.freshLoanCl.visibility = View.GONE
|
||||
binding.loanDetailWebView.visibility = View.VISIBLE
|
||||
showWebViewUI(binding.loanDetailWebView)
|
||||
}
|
||||
|
||||
private fun updateUiTronSliderValueInSnappedHeader(resIdToSliderValue: Triple<String, String, String?>) {
|
||||
when (resIdToSliderValue.first) {
|
||||
LOAN_AMOUNT_UITRON_LAYOUT_ID -> {
|
||||
|
||||
Reference in New Issue
Block a user