NTP-1410 | timer refresh bug fix (#12522)
Co-authored-by: Raaj Gopal <raaj.gopal@navi.com>
This commit is contained in:
@@ -283,6 +283,17 @@ class FundBuyingFragmentV2 : AmcBaseFragment(), WidgetCallback {
|
||||
viewModel.isSipSelected =
|
||||
viewModel.isSipSelected
|
||||
?: content.fundInvestmentType?.defaultChecked.equals(Constant.SIP)
|
||||
|
||||
if (viewModel.sipData.isNotNull()) {
|
||||
content.fundInvestmentType?.sipData = viewModel.sipData
|
||||
}
|
||||
if (viewModel.lumpsumAmount.isNotNull()) {
|
||||
content.fundInvestmentType?.lumpsumData = viewModel.lumpsumData
|
||||
}
|
||||
|
||||
viewModel.sipData = content.fundInvestmentType?.sipData
|
||||
viewModel.lumpsumData = content.fundInvestmentType?.lumpsumData
|
||||
|
||||
content.fundInvestmentType?.sipData?.getOrNull(0)?.let { sipFrequencyData ->
|
||||
binding.sipFrequency.updateData(sipFrequencyData as InputWidgetModel, this, 0)
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ data class FundInvestmentType(
|
||||
@SerializedName("defaultChecked") val defaultChecked: String? = null,
|
||||
@SerializedName("sipTutorial") val sipTutorial: SubItemData? = null,
|
||||
@SerializedName("lumpsumTutorial") val lumpsumTutorial: SubItemData? = null,
|
||||
@SerializedName("SIP") val sipData: List<NaviWidget>? = null,
|
||||
@SerializedName("LUMPSUM") val lumpsumData: List<NaviWidget>? = null,
|
||||
@SerializedName("SIP") var sipData: List<NaviWidget>? = null,
|
||||
@SerializedName("LUMPSUM") var lumpsumData: List<NaviWidget>? = null,
|
||||
@SerializedName("sipRecommendedAmount") val sipRecommendedAmount: List<AmountChipData>? = null,
|
||||
@SerializedName("lumpsumRecommendedAmount")
|
||||
val lumpsumRecommendedAmount: List<AmountChipData>? = null,
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.navi.design.font.FontWeightEnum
|
||||
import com.navi.design.textview.model.NaviSpan
|
||||
import com.navi.design.textview.model.TextWithStyle
|
||||
import com.navi.design.utils.parseDateFromOneToAnother
|
||||
import com.navi.naviwidgets.models.NaviWidget
|
||||
import com.navi.naviwidgets.models.response.CardType
|
||||
import com.navi.uitron.utils.orFalse
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
@@ -70,6 +71,8 @@ class FundBuyV2ViewModel @Inject constructor(private val repository: FundBuyRepo
|
||||
var isAutoPaySelected: Boolean? = null
|
||||
var lumpsumAmount: String? = null
|
||||
var sipAmount: String? = null
|
||||
var sipData: List<NaviWidget>? = null
|
||||
var lumpsumData: List<NaviWidget>? = null
|
||||
|
||||
private val _paymentInitiateData =
|
||||
MutableLiveData<AdditionalDataAsyncResponse<NextCtaResponse>?>()
|
||||
@@ -307,6 +310,8 @@ class FundBuyV2ViewModel @Inject constructor(private val repository: FundBuyRepo
|
||||
lastLumpsumInteraction = AmcAnalytics.DEFAULT
|
||||
_paymentInitiateData.value = null
|
||||
isAutoPaySelected = null
|
||||
sipData = null
|
||||
lumpsumData = null
|
||||
super.onCleared()
|
||||
}
|
||||
|
||||
|
||||
@@ -67,15 +67,26 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
data.timerInvalidateAfter?.let { timerInvalidateAfter ->
|
||||
timeLeft - timerInvalidateAfter
|
||||
}
|
||||
timer.startTimer(
|
||||
timeFormat = "hms",
|
||||
timeInMillis = timeLeft,
|
||||
countDownInterval = 1000L,
|
||||
onTimerDataChangeCallback = ::onTimerDataChange,
|
||||
onTimerRefreshCallBack = ::onTimerRefresh,
|
||||
timerRefreshInterval = timerRefresh,
|
||||
text = data.title,
|
||||
)
|
||||
if (timerRefresh != 0L) {
|
||||
timer.startTimer(
|
||||
timeFormat = "hms",
|
||||
timeInMillis = timeLeft,
|
||||
countDownInterval = 1000L,
|
||||
onTimerDataChangeCallback = ::onTimerDataChange,
|
||||
onTimerRefreshCallBack = ::onTimerRefresh,
|
||||
timerRefreshInterval = timerRefresh,
|
||||
text = data.title,
|
||||
)
|
||||
} else {
|
||||
timer.startTimer(
|
||||
timeFormat = "hms",
|
||||
timeInMillis = timeLeft,
|
||||
countDownInterval = 1000L,
|
||||
onTimerDataChangeCallback = ::onTimerDataChange,
|
||||
onTimerRefreshCallBack = ::onTimerRefresh,
|
||||
text = data.title,
|
||||
)
|
||||
}
|
||||
}
|
||||
?: run {
|
||||
data.timerInvalidateAfter?.let { timerInvalidateAfter ->
|
||||
@@ -139,6 +150,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
}
|
||||
|
||||
private fun onTimerRefresh() {
|
||||
this.binding.container.removeAllViews()
|
||||
widgetCallback.onDataChanged(TIMER_WITH_IMAGE_WIDGET)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user