Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
fixed wrong pin alert message disappearing immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
seldon1000 committed Aug 10, 2021
1 parent 18aa3ac commit 2957c93
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions app/src/main/java/eu/seldon1000/nextpass/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {

fun lock(shouldRaiseBiometric: Boolean = true) {
if (pinProtected.value) {
unlocked = false
biometricDismissed.value = false
dismissDialog()

Expand All @@ -243,17 +242,16 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
}

fun unlock(pin: String = "") {
if (!unlocked && pin.isNotEmpty() &&
pin != sharedPreferences.getString("PIN", null)
) showDialog(
title = context.getString(R.string.wrong_pin),
body = {
Text(
text = context.getString(R.string.wrong_pin_body),
fontSize = 14.sp
)
}
)
if (pin.isNotEmpty() && pin != sharedPreferences.getString("PIN", null))
showDialog(
title = context.getString(R.string.wrong_pin),
body = {
Text(
text = context.getString(R.string.wrong_pin_body),
fontSize = 14.sp
)
}
)

unlocked = unlocked || pin == sharedPreferences.getString("PIN", null)

Expand All @@ -264,7 +262,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
pendingUnlockAction!!()
pendingUnlockAction = null
} else executeRequest { nextcloudApi.refreshServerList() }
} else lock()
} else if (pin.isEmpty()) lock()
}

fun changePin() {
Expand Down

0 comments on commit 2957c93

Please sign in to comment.