TP-56936 rewards api removed (#10100)
Co-authored-by: Aman <amankasyapp@gmail.com>
This commit is contained in:
@@ -83,14 +83,6 @@ class LoanDisbursementVM : BaseVM() {
|
||||
val abSettingsError: LiveData<Int>
|
||||
get() = _abSettingsError
|
||||
|
||||
private val _rewardsDetails = MutableLiveData<WidgetResponse>()
|
||||
val rewardsDetails: LiveData<WidgetResponse>
|
||||
get() = _rewardsDetails
|
||||
|
||||
private val _rewardsError = MutableLiveData<Int>()
|
||||
val rewardsError: LiveData<Int>
|
||||
get() = _rewardsError
|
||||
|
||||
val loanAccountNumber = MutableLiveData<String>()
|
||||
|
||||
fun getLoanDisbursementStatus(loanApplicationId: String) {
|
||||
@@ -225,14 +217,4 @@ class LoanDisbursementVM : BaseVM() {
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchRewardsDetails(type: String, typeId: String) {
|
||||
coroutineScope.launch {
|
||||
val response = repository.fetchRewardsDetails(type = type, typeId = typeId)
|
||||
if (response.isValidResponse()) {
|
||||
_rewardsDetails.value = response.data
|
||||
} else {
|
||||
_rewardsError.value = response.statusCode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,6 @@ class BankDetailsLoaderPostKycActivity : BaseActivity() {
|
||||
observeUnifiedProgress()
|
||||
observeAsyncResponse()
|
||||
observeUiStatus()
|
||||
observeRewardsDetails()
|
||||
observeNextScreeDetails()
|
||||
observeLoanBasicDetails()
|
||||
}
|
||||
@@ -154,68 +153,8 @@ class BankDetailsLoaderPostKycActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeRewardsDetails() {
|
||||
viewModel.rewardsDetails.observeNonNull(this) { widgetResponse ->
|
||||
var rewardWidgetData: RewardWidgetData? = null
|
||||
widgetResponse.contentWidget?.forEach { naviWidget ->
|
||||
if (naviWidget is RewardWidget) {
|
||||
rewardWidgetData = naviWidget.widgetData
|
||||
}
|
||||
}
|
||||
|
||||
rewardWidgetData?.let { nonNullRewardWidgetData ->
|
||||
val bundle = Bundle()
|
||||
bundle.putParcelable(KEY_REWARD_INFO, nonNullRewardWidgetData)
|
||||
bundle.putString(
|
||||
REWARD_CTA_URL,
|
||||
viewModel.dataAsyncResponse.value?.details?.redirectCtaUrl
|
||||
)
|
||||
bundle.putDouble(
|
||||
REWARD_AMOUNT,
|
||||
viewModel.dataAsyncResponse.value?.details?.netDisbursalAmount.orZero()
|
||||
)
|
||||
navigateNextScreen(
|
||||
screenName = ScreenNavigator.REWARDS_DELIGHT_SCREEN,
|
||||
bundle = bundle
|
||||
)
|
||||
}
|
||||
?: kotlin.run { navigateToNextScreen() }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed() {}
|
||||
|
||||
private fun navigateToNextScreen() {
|
||||
val bundle = Bundle()
|
||||
viewModel.dataUnifiedAsyncResponse.value?.details?.redirectCtaUrl?.let {
|
||||
bundle.putParcelable(
|
||||
Constants.PREVIOUS_SCREEN,
|
||||
PreviousScreenNameRequest(Constants.DISBURSED)
|
||||
)
|
||||
bundle.putBoolean(
|
||||
Constants.POST_DISBURSEMENT,
|
||||
viewModel.dataAsyncResponse.value?.details?.postDisbursement.orFalse()
|
||||
)
|
||||
Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
{
|
||||
NaviDeepLinkNavigator.navigate(
|
||||
activity = this,
|
||||
ctaData = CtaData(url = it),
|
||||
bundle = bundle
|
||||
)
|
||||
},
|
||||
viewModel.dataUnifiedAsyncResponse.value?.details?.redirectInMillis
|
||||
?: NEXT_SCREEN_TRANSITION_DELAY
|
||||
)
|
||||
}
|
||||
?: kotlin.run {
|
||||
viewModel.fetchABExperiment(
|
||||
experimentName = Constants.PL_POST_DISBURSAL_SCREEN_AB_NAME
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun navigateNextScreen(screenName: String, bundle: Bundle = Bundle()) {
|
||||
Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
@@ -383,13 +322,6 @@ class BankDetailsLoaderPostKycActivity : BaseActivity() {
|
||||
)
|
||||
}
|
||||
|
||||
private fun startSuccessAnimationEndListener() {
|
||||
viewModel.fetchRewardsDetails(
|
||||
type = ModuleNameV2.PL.name,
|
||||
typeId = PreferenceManager.getStringPreference(LOAN_APPLICATION_ID).orEmpty()
|
||||
)
|
||||
}
|
||||
|
||||
private fun deInitialiseAsync() {
|
||||
baseApiPollScheduler?.stopApiPoll()
|
||||
baseFirebaseDataHelper?.clear()
|
||||
@@ -630,7 +562,6 @@ class BankDetailsLoaderPostKycActivity : BaseActivity() {
|
||||
private const val NEXT_SCREEN_TRANSITION_DELAY = GET_LOAN_VIEW_ANIMATION_DELAY + 100L
|
||||
private const val PROGRESS = "progress"
|
||||
private const val ADD_BANK_DETAILS = "ADD_BANK_ACCOUNT"
|
||||
private const val SIGN_LOAN_AGREEMENT = "SIGN_LOAN_AGREEMENT"
|
||||
private const val DISBURSEMENT = "DISBURSEMENT_STATUS"
|
||||
private const val MID = 50
|
||||
private const val DEFAULT_MILLI = 200L
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.navi.base.model.CtaData
|
||||
import com.navi.base.sharedpref.PreferenceManager
|
||||
import com.navi.base.utils.orElse
|
||||
import com.navi.base.utils.orFalse
|
||||
import com.navi.base.utils.orZero
|
||||
import com.navi.common.constants.MESSAGE_TEXT
|
||||
import com.navi.common.firebasedb.DISBURSEMENT
|
||||
import com.navi.common.firebasedb.FirebaseDataHelper
|
||||
@@ -35,15 +34,9 @@ import com.navi.common.model.PreviousScreenNameRequest
|
||||
import com.navi.common.model.RequestConfig
|
||||
import com.navi.common.ui.activity.BaseActivity
|
||||
import com.navi.common.utils.ApiPollScheduler
|
||||
import com.navi.common.utils.Constants.KEY_REWARD_INFO
|
||||
import com.navi.common.utils.Constants.REWARD_AMOUNT
|
||||
import com.navi.common.utils.Constants.REWARD_CTA_URL
|
||||
import com.navi.common.utils.Constants.REWARD_MESSAGE_TEXT
|
||||
import com.navi.common.utils.appendStrings
|
||||
import com.navi.common.utils.observeNonNull
|
||||
import com.navi.common.utils.observeNullable
|
||||
import com.navi.naviwidgets.models.response.RewardWidget
|
||||
import com.navi.naviwidgets.models.response.RewardWidgetData
|
||||
import com.navi.naviwidgets.utils.FORWARD_SLASH
|
||||
import com.navi.pl.dynamic.helper.GetLoanV2Helper
|
||||
import com.naviapp.R
|
||||
@@ -104,39 +97,6 @@ class LoanDisbursementLoaderV2Activity : BaseActivity() {
|
||||
observeAsyncResponse()
|
||||
observeAsyncError()
|
||||
observeNextScreeDetails()
|
||||
observeRewardsDetails()
|
||||
}
|
||||
|
||||
private fun observeRewardsDetails() {
|
||||
viewModel.rewardsDetails.observeNonNull(this) { widgetResponse ->
|
||||
var rewardWidgetData: RewardWidgetData? = null
|
||||
widgetResponse.contentWidget?.forEach { naviWidget ->
|
||||
if (naviWidget is RewardWidget) {
|
||||
rewardWidgetData = naviWidget.widgetData
|
||||
}
|
||||
}
|
||||
|
||||
rewardWidgetData?.let { nonNullRewardWidgetData ->
|
||||
val bundle = Bundle()
|
||||
bundle.putParcelable(KEY_REWARD_INFO, nonNullRewardWidgetData)
|
||||
bundle.putString(REWARD_MESSAGE_TEXT, binding.statusDetailsTv.text.toString())
|
||||
bundle.putString(
|
||||
REWARD_CTA_URL,
|
||||
viewModel.dataAsyncResponse.value?.details?.redirectCtaUrl
|
||||
)
|
||||
bundle.putDouble(
|
||||
REWARD_AMOUNT,
|
||||
viewModel.dataAsyncResponse.value?.details?.netDisbursalAmount.orZero()
|
||||
)
|
||||
navigateNextScreen(
|
||||
screenName = ScreenNavigator.REWARDS_DELIGHT_SCREEN,
|
||||
bundle = bundle
|
||||
)
|
||||
}
|
||||
?: kotlin.run { navigateToNextScreen() }
|
||||
}
|
||||
|
||||
viewModel.rewardsError.observeNonNull(this) { navigateToNextScreen() }
|
||||
}
|
||||
|
||||
private fun observeLoanBasicDetails() {
|
||||
@@ -448,11 +408,7 @@ class LoanDisbursementLoaderV2Activity : BaseActivity() {
|
||||
Handler(Looper.getMainLooper())
|
||||
.postDelayed(
|
||||
{
|
||||
viewModel.fetchRewardsDetails(
|
||||
type = ModuleNameV2.PL.name,
|
||||
typeId =
|
||||
PreferenceManager.getStringPreference(LOAN_APPLICATION_ID).orEmpty()
|
||||
)
|
||||
navigateToNextScreen()
|
||||
},
|
||||
if (showSuccessAnimation == false) LONG_ZERO
|
||||
else Constants.GREEN_SUCCESS_ANIMATION_TIME
|
||||
@@ -463,7 +419,6 @@ class LoanDisbursementLoaderV2Activity : BaseActivity() {
|
||||
const val TAG = "LOAN_DISBURSEMENT_LOADER_V2"
|
||||
const val LOAN_ACCOUNT_NUMBER = "loanAccountNumber"
|
||||
private const val NEXT_SCREEN_TRANSITION_DELAY = 1000L
|
||||
private const val NUMBER_OF_RETRY = 12
|
||||
}
|
||||
|
||||
override fun attachBaseContext(newBase: Context?) {
|
||||
|
||||
Reference in New Issue
Block a user