Added the verification of the Pattern security lock option, before changing the current Security Lock or viewing the BrainKey in the Settings, when Pattern is the current security lock.

This commit is contained in:
Severiano Jaramillo 2019-02-16 16:58:36 -06:00
parent fb329658eb
commit a10a8cd836
2 changed files with 18 additions and 4 deletions

View file

@ -42,15 +42,16 @@ class PatternSecurityLockDialog : BaseSecurityLockDialog() {
private val mPatternLockViewListener = object : PatternLockViewListener { private val mPatternLockViewListener = object : PatternLockViewListener {
override fun onStarted() { override fun onStarted() {
// Make sure the button is hidden when the user starts a new pattern when it was incorrect // Make sure the button is hidden when the user starts a new pattern when it was incorrect
btnClear.visibility = View.INVISIBLE
when (currentStep) { when (currentStep) {
STEP_SECURITY_LOCK_VERIFY -> { STEP_SECURITY_LOCK_VERIFY -> {
// Do something tvMessage.text = ""
} }
STEP_SECURITY_LOCK_CREATE -> { STEP_SECURITY_LOCK_CREATE -> {
btnClear.visibility = View.INVISIBLE
tvMessage.text = getString(R.string.msg__release_finger) tvMessage.text = getString(R.string.msg__release_finger)
} }
STEP_SECURITY_LOCK_CONFIRM -> { STEP_SECURITY_LOCK_CONFIRM -> {
btnClear.visibility = View.INVISIBLE
tvMessage.text = getString(R.string.msg__release_finger) tvMessage.text = getString(R.string.msg__release_finger)
} }
} }
@ -62,7 +63,16 @@ class PatternSecurityLockDialog : BaseSecurityLockDialog() {
override fun onComplete(pattern: List<PatternLockView.Dot>) { override fun onComplete(pattern: List<PatternLockView.Dot>) {
if (currentStep == STEP_SECURITY_LOCK_VERIFY) { if (currentStep == STEP_SECURITY_LOCK_VERIFY) {
// Do something context?.let {
val encryptedPattern = CryptoUtils.encrypt(it, getStringPattern(pattern)).trim()
if (encryptedPattern == currentEncryptedPINPattern) {
// Pattern is correct, proceed
dismiss()
mCallback?.onPINPatternEntered(actionIdentifier)
} else {
tvMessage.text = getString(R.string.error__wront_pattern)
}
}
} else if (currentStep == STEP_SECURITY_LOCK_CREATE) { } else if (currentStep == STEP_SECURITY_LOCK_CREATE) {
btnClear.visibility = View.VISIBLE btnClear.visibility = View.VISIBLE
if (pattern.size < 4) { if (pattern.size < 4) {
@ -128,7 +138,9 @@ class PatternSecurityLockDialog : BaseSecurityLockDialog() {
STEP_SECURITY_LOCK_VERIFY -> { STEP_SECURITY_LOCK_VERIFY -> {
tvTitle.text = getString(R.string.title__re_enter_your_pattern) tvTitle.text = getString(R.string.title__re_enter_your_pattern)
tvSubTitle.text = getString(R.string.msg__enter_your_pattern) tvSubTitle.text = getString(R.string.msg__enter_your_pattern)
btnClear.visibility = View.INVISIBLE btnClear.visibility = View.GONE
btnNext.visibility = View.GONE
patternLockView.isInStealthMode = true
} }
STEP_SECURITY_LOCK_CREATE -> { STEP_SECURITY_LOCK_CREATE -> {
tvTitle.text = getString(R.string.title__set_bitsy_screen_lock) tvTitle.text = getString(R.string.title__set_bitsy_screen_lock)

View file

@ -59,6 +59,8 @@
app:normalStateColor="?android:textColorSecondary" app:normalStateColor="?android:textColorSecondary"
app:correctStateColor="@color/colorPrimary" app:correctStateColor="@color/colorPrimary"
app:wrongStateColor="@color/colorSend" app:wrongStateColor="@color/colorSend"
app:dotNormalSize="12dp"
app:dotSelectedSize="16dp"
app:layout_constraintDimensionRatio="h,1:1" app:layout_constraintDimensionRatio="h,1:1"
app:layout_constraintTop_toBottomOf="@id/tvMessage" app:layout_constraintTop_toBottomOf="@id/tvMessage"
app:layout_constraintBottom_toTopOf="@id/btnClear" app:layout_constraintBottom_toTopOf="@id/btnClear"