Fix issue in both PIN and Pattern SecurityLockDialogs, that the error message was not appearing correctly when the user wrongly entered the PIN/Pattern and also the error message was not being cleared once the cooldown timer expired.

This commit is contained in:
Severiano Jaramillo 2019-02-20 16:53:34 -06:00
parent 9e714d8f84
commit 8d257876a0
2 changed files with 5 additions and 12 deletions

View file

@ -119,6 +119,7 @@ class PINSecurityLockDialog : BaseSecurityLockDialog() {
STEP_SECURITY_LOCK_VERIFY -> {
tvTitle.text = getString(R.string.title__re_enter_your_pin)
tvSubTitle.text = getString(R.string.msg__enter_your_pin)
tietPIN.isEnabled = true
if (incorrectSecurityLockAttempts >= Constants.MAX_INCORRECT_SECURITY_LOCK_ATTEMPTS) {
// User has entered the PIN incorrectly too many times
val now = System.currentTimeMillis()
@ -126,16 +127,10 @@ class PINSecurityLockDialog : BaseSecurityLockDialog() {
tietPIN.setText("")
tietPIN.isEnabled = false
startContDownTimer()
return
} else {
resetIncorrectSecurityLockAttemptsAndTime()
}
}
// This is not in an else statement because we also want to enable the EditText and remove the error
// when the cooldown time has been reached
tietPIN.isEnabled = true
tilPIN.helperText = ""
tilPIN.isErrorEnabled = false
}
STEP_SECURITY_LOCK_CREATE -> {
tvTitle.text = getString(R.string.title__set_bitsy_screen_lock)
@ -160,5 +155,6 @@ class PINSecurityLockDialog : BaseSecurityLockDialog() {
override fun onTimerFinished() {
setupScreen()
tilPIN.isErrorEnabled = false
}
}

View file

@ -148,22 +148,18 @@ class PatternSecurityLockDialog : BaseSecurityLockDialog() {
tvSubTitle.text = getString(R.string.msg__enter_your_pattern)
btnClear.visibility = View.GONE
btnNext.visibility = View.GONE
setMessage("")
patternLockView.isInputEnabled = true
patternLockView.isInStealthMode = true
if (incorrectSecurityLockAttempts >= Constants.MAX_INCORRECT_SECURITY_LOCK_ATTEMPTS) {
// User has entered the Pattern incorrectly too many times
val now = System.currentTimeMillis()
if (now <= incorrectSecurityLockTime + Constants.INCORRECT_SECURITY_LOCK_COOLDOWN) {
patternLockView.isInputEnabled = false
startContDownTimer()
return
} else {
resetIncorrectSecurityLockAttemptsAndTime()
}
}
// This is not in an else statement because we also want to enable the EditText and remove the error
// when the cooldown time has been reached
patternLockView.isInputEnabled = true
patternLockView.isInStealthMode = true
}
STEP_SECURITY_LOCK_CREATE -> {
tvTitle.text = getString(R.string.title__set_bitsy_screen_lock)
@ -214,5 +210,6 @@ class PatternSecurityLockDialog : BaseSecurityLockDialog() {
override fun onTimerFinished() {
setupScreen()
setMessage("")
}
}