NTP-75402 | Change OTP from 6 to 4 digits (#16685)

Co-authored-by: Aman S <aman.s@navi.com>
This commit is contained in:
Varun Jain
2025-06-23 16:18:41 +05:30
committed by GitHub
parent 2fde5830b5
commit bb3985a1e7

View File

@@ -96,7 +96,6 @@ import com.navi.base.utils.orElse
import com.navi.base.utils.orFalse
import com.navi.base.utils.orTrue
import com.navi.common.customview.BoxInputGroup.Companion.OTP_LENGTH_4
import com.navi.common.customview.BoxInputGroup.Companion.OTP_LENGTH_6
import com.navi.common.listeners.FragmentInterchangeListener
import com.navi.common.listeners.HeaderInteractionListener
import com.navi.common.model.ModuleNameV2
@@ -138,7 +137,6 @@ class OtpFragment : AmcBaseFragment(), View.OnClickListener {
private val paymentScreenHelper by lazy { PaymentScreenHelper(owner = requireActivity()) }
@Inject lateinit var cartUseCase: CartUseCase
private var otpLength: Int = OTP_LENGTH_4
private val source by lazy { TempStorageHelper.getPreviousScreenName() }
private val buyFlowViewModel: FundBuyFlowViewModel by activityViewModels()
@@ -684,16 +682,13 @@ class OtpFragment : AmcBaseFragment(), View.OnClickListener {
}
private fun initUi() {
if (PreferenceManager.getBooleanPreference(CART_EXPERIMENT_ENABLED))
otpLength = OTP_LENGTH_6
else OTP_LENGTH_4
setOtpButtonBackgroundColor(colorId = DesignR.color.color_1F002A_opacity_56)
binding.otpLayout.setProperties(otpLength, requestFocus = true)
binding.otpLayout.setProperties(OTP_LENGTH_4, requestFocus = true)
binding.otpLayout.setTextChangeListener {
binding.otpLayout.setBoxBg(false)
binding.enterCorrectOtpTv.visibility = View.GONE
if (binding.otpLayout.getText().length == otpLength) {
if (binding.otpLayout.getText().length == OTP_LENGTH_4) {
binding.verifyOtpBtn.isEnabled = true
setOtpButtonBackgroundColor(colorId = DesignR.color.color_1F002A)
if (autoReadOtpDisabled().not()) {
@@ -795,7 +790,7 @@ class OtpFragment : AmcBaseFragment(), View.OnClickListener {
}
private fun isValidOtpDetail(): Boolean {
return (binding.otpLayout.getText().length == otpLength)
return (binding.otpLayout.getText().length == OTP_LENGTH_4)
}
private fun generateOtp(isResendOtp: Boolean) {