Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions features/core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
<string name="hide">Hide</string>
<string name="registered_successfully">Registered Successfully</string>
<string name="otp_limit_exceeded">OTP request limit exceeded. Please try again after some time.</string>
<string name="otp_attempt_limit_exceed">You have exceeded the invalid attempts limit, Please try later </string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class RegistrationOtpFragment : BaseFragment() {

companion object {
const val ERROR_CODE_INVALID_OTP = 1003
const val ERROR_CODE_OTP_EXPIRED = 1004
const val ERROR_CODE_OTP_LIMIT_EXCEEDED = 1029
const val EXCEEDED_INVALID_ATTEMPT_LIMIT = 1035
fun newInstance() = RegistrationOtpFragment()
}

Expand Down Expand Up @@ -64,15 +66,22 @@ class RegistrationOtpFragment : BaseFragment() {
parentVM.verifyIdentifierResponseLiveData.observe(this, Observer {
when (it) {
is PartialFailure -> {
if (it.error?.code == ERROR_CODE_INVALID_OTP) {
if (it.error?.code == ERROR_CODE_INVALID_OTP || it.error?.code == EXCEEDED_INVALID_ATTEMPT_LIMIT ) {
viewModel.otpText.set(null)
}

viewModel.errorLbl.set(
if (it.error?.code == ERROR_CODE_INVALID_OTP) {
getString(R.string.invalid_otp)
} else
it.error?.message
when (it.error?.code) {
ERROR_CODE_INVALID_OTP -> {
getString(R.string.invalid_otp)
}
ERROR_CODE_OTP_EXPIRED -> {
getString(R.string.otp_expired)
}
EXCEEDED_INVALID_ATTEMPT_LIMIT -> {
getString(R.string.otp_attempt_limit_exceed)
}
else -> it.error?.message
}
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class ResetPasswordOtpFragment : BaseFragment() {
companion object {
private const val ERROR_CODE_INVALID_OTP = 1003
private const val ERROR_CODE_OTP_EXPIRED = 1004
const val EXCEEDED_INVALID_ATTEMPT_LIMIT = 1035
fun newInstance() = ResetPasswordOtpFragment()
private lateinit var snackbar: Snackbar
}
Expand Down Expand Up @@ -75,10 +76,9 @@ class ResetPasswordOtpFragment : BaseFragment() {
is Loading -> viewModel.showProgress(it.isLoading)

is PartialFailure -> {
if (it.error?.code == ERROR_CODE_INVALID_OTP || it.error?.code == ERROR_CODE_OTP_EXPIRED) {
if (it.error?.code == ERROR_CODE_INVALID_OTP || it.error?.code == ERROR_CODE_OTP_EXPIRED || it.error?.code == EXCEEDED_INVALID_ATTEMPT_LIMIT) {
viewModel.otpText.set(null)
}

viewModel.errorLbl.set(
when (it.error?.code) {
ERROR_CODE_INVALID_OTP -> {
Expand All @@ -87,6 +87,9 @@ class ResetPasswordOtpFragment : BaseFragment() {
ERROR_CODE_OTP_EXPIRED -> {
getString(R.string.otp_expired)
}
EXCEEDED_INVALID_ATTEMPT_LIMIT -> {
getString(R.string.otp_attempt_limit_exceed)
}
else -> it.error?.message
}
)
Expand Down