NTP-31 | Change of bank bottom sheet (#13248)
Co-authored-by: saksham <saksham>
This commit is contained in:
@@ -68,6 +68,7 @@ import com.navi.amc.utils.getPaymentSyncFlowStatusCta
|
||||
import com.navi.amc.utils.toNavigateAmcModule
|
||||
import com.navi.base.model.ActionData
|
||||
import com.navi.base.utils.BaseUtils
|
||||
import com.navi.base.utils.EMPTY
|
||||
import com.navi.base.utils.isNotNullAndNotEmpty
|
||||
import com.navi.base.utils.orElse
|
||||
import com.navi.base.utils.orFalse
|
||||
@@ -179,13 +180,19 @@ class OtpFragment : AmcBaseFragment(), View.OnClickListener {
|
||||
override fun onOtpReceive(otp: String) {
|
||||
if (otp.length == SUPPORTED_OTP_SIZE) {
|
||||
binding.otpLayout.setOtp(otp)
|
||||
verifyOtp(true)
|
||||
if (autoReadOtpDisabled().not()) {
|
||||
verifyOtp(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun autoReadOtpDisabled(): Boolean {
|
||||
return (flowType == EMPTY || flowType == OTP_FLOW_TYPE_REDEEMPTION)
|
||||
}
|
||||
|
||||
private fun initObservers() {
|
||||
viewModel.dataResponse.observe(viewLifecycleOwner) { response ->
|
||||
hideLoader()
|
||||
@@ -562,7 +569,9 @@ class OtpFragment : AmcBaseFragment(), View.OnClickListener {
|
||||
if (binding.otpLayout.getText().length == OTP_LENGTH_4) {
|
||||
binding.verifyOtpBtn.isEnabled = true
|
||||
setOtpButtonBackgroundColor(colorId = DesignR.color.color_1F002A)
|
||||
verifyOtp()
|
||||
if (autoReadOtpDisabled().not()) {
|
||||
verifyOtp()
|
||||
}
|
||||
} else {
|
||||
binding.verifyOtpBtn.isEnabled = false
|
||||
setOtpButtonBackgroundColor(colorId = DesignR.color.color_1F002A_opacity_56)
|
||||
@@ -617,7 +626,6 @@ class OtpFragment : AmcBaseFragment(), View.OnClickListener {
|
||||
}
|
||||
|
||||
private fun verifyOtp(isAutoFetchOtp: Boolean = false) {
|
||||
|
||||
sendEvent(
|
||||
AmcAnalytics.AMC_BTN_OTP_SCREEN_VERIFY,
|
||||
hashMapOf(
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.navi.amc.kyc.model.Bank
|
||||
import com.navi.amc.kyc.model.BankDetailsResponse
|
||||
import com.navi.amc.kyc.viewmodel.BankDetailsVM
|
||||
import com.navi.amc.utils.*
|
||||
import com.navi.amc.utils.Constant.BACK
|
||||
import com.navi.base.model.ActionData
|
||||
import com.navi.base.model.NaviClickAction
|
||||
import com.navi.base.model.NaviWidgetClickWithActionData
|
||||
@@ -96,30 +97,8 @@ class BankDetailsFragment :
|
||||
hideLoader()
|
||||
bindData(response)
|
||||
arguments?.getParcelable<GenericErrorResponse>(ERROR_DATA)?.let {
|
||||
val bundle = Bundle().apply { putParcelable(ERROR_DATA, it) }
|
||||
var firstAction: View.OnClickListener? = null
|
||||
var secopndAction: View.OnClickListener? = null
|
||||
it.actions?.forEachIndexed { index, action ->
|
||||
when (index) {
|
||||
0 -> {
|
||||
firstAction = getBottomSheetActionCta(action)
|
||||
}
|
||||
1 -> {
|
||||
secopndAction = getBottomSheetActionCta(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
getBottomSheet(
|
||||
SubPageStatusType.GENERIC_BOTTOMSHEET,
|
||||
bundle,
|
||||
firstAction,
|
||||
secopndAction
|
||||
)
|
||||
?.let { sheet ->
|
||||
safelyShowBottomSheet(sheet, SubPageStatusType.GENERIC_BOTTOMSHEET)
|
||||
arguments?.remove(ERROR_DATA)
|
||||
}
|
||||
}
|
||||
showErrorBottomSheet(it)
|
||||
} ?: run { response?.content?.errorBottomSheet?.let { showErrorBottomSheet(it) } }
|
||||
}
|
||||
viewModel.banks.observeNonNull(this) { bankList ->
|
||||
hideLoader()
|
||||
@@ -134,6 +113,27 @@ class BankDetailsFragment :
|
||||
}
|
||||
}
|
||||
|
||||
private fun showErrorBottomSheet(bottomSheetData: GenericErrorResponse) {
|
||||
val bundle = Bundle().apply { putParcelable(ERROR_DATA, bottomSheetData) }
|
||||
var firstAction: View.OnClickListener? = null
|
||||
var secondAction: View.OnClickListener? = null
|
||||
bottomSheetData.actions?.forEachIndexed { index, action ->
|
||||
when (index) {
|
||||
0 -> {
|
||||
firstAction = getBottomSheetActionCta(action)
|
||||
}
|
||||
1 -> {
|
||||
secondAction = getBottomSheetActionCta(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
getBottomSheet(SubPageStatusType.GENERIC_BOTTOMSHEET, bundle, firstAction, secondAction)
|
||||
?.let { sheet ->
|
||||
safelyShowBottomSheet(sheet, SubPageStatusType.GENERIC_BOTTOMSHEET)
|
||||
arguments?.remove(ERROR_DATA)
|
||||
}
|
||||
}
|
||||
|
||||
private fun bindData(response: BankDetailsResponse?) {
|
||||
setHeaderProperties(response?.header)
|
||||
hideDivider()
|
||||
@@ -299,12 +299,15 @@ class BankDetailsFragment :
|
||||
}
|
||||
|
||||
private fun getBottomSheetActionCta(action: Action): View.OnClickListener? {
|
||||
if (REMOVE_BANK_DETAILS == action.url) {
|
||||
return clearBankDetailsClickListener()
|
||||
return when (action.url) {
|
||||
REMOVE_BANK_DETAILS -> clearBankDetailsClickListener()
|
||||
BACK -> goBack()
|
||||
else -> null
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun goBack() = View.OnClickListener { activity?.onBackPressed() }
|
||||
|
||||
private fun clearBankDetailsClickListener() =
|
||||
View.OnClickListener {
|
||||
viewModel.bankItems.value?.content?.widgets?.forEachIndexed { index, naviWidget ->
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.google.gson.annotations.SerializedName
|
||||
import com.navi.amc.common.model.Footer
|
||||
import com.navi.amc.fundbuy.models.RewardsData
|
||||
import com.navi.common.model.Header
|
||||
import com.navi.common.network.models.GenericErrorResponse
|
||||
import com.navi.design.textview.model.TextWithStyle
|
||||
import com.navi.naviwidgets.models.NaviWidget
|
||||
import com.navi.naviwidgets.models.response.ToastWidgetData
|
||||
@@ -31,6 +32,7 @@ data class BankDetailsContent(
|
||||
@SerializedName("note") val note: Note? = null,
|
||||
@SerializedName("rewards") val rewards: RewardsData? = null,
|
||||
@SerializedName("toastData") val toastData: ToastWidgetData? = null,
|
||||
@SerializedName("errorBottomSheet") val errorBottomSheet: GenericErrorResponse? = null
|
||||
) : Parcelable
|
||||
|
||||
@Parcelize
|
||||
|
||||
@@ -204,4 +204,5 @@ object Constant {
|
||||
const val NAVI_UPI_TXN = "NAVI_UPI_TXN"
|
||||
const val ALL = "ALL"
|
||||
const val DARK_YELLOW_COLOR = "#FFE6A0"
|
||||
const val BACK = "back"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user