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

Commit 2957c93

Browse files
author
seldon1000
committed
fixed wrong pin alert message disappearing immediately
1 parent 18aa3ac commit 2957c93

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

app/src/main/java/eu/seldon1000/nextpass/MainViewModel.kt

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
231231

232232
fun lock(shouldRaiseBiometric: Boolean = true) {
233233
if (pinProtected.value) {
234-
unlocked = false
235234
biometricDismissed.value = false
236235
dismissDialog()
237236

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

245244
fun unlock(pin: String = "") {
246-
if (!unlocked && pin.isNotEmpty() &&
247-
pin != sharedPreferences.getString("PIN", null)
248-
) showDialog(
249-
title = context.getString(R.string.wrong_pin),
250-
body = {
251-
Text(
252-
text = context.getString(R.string.wrong_pin_body),
253-
fontSize = 14.sp
254-
)
255-
}
256-
)
245+
if (pin.isNotEmpty() && pin != sharedPreferences.getString("PIN", null))
246+
showDialog(
247+
title = context.getString(R.string.wrong_pin),
248+
body = {
249+
Text(
250+
text = context.getString(R.string.wrong_pin_body),
251+
fontSize = 14.sp
252+
)
253+
}
254+
)
257255

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

@@ -264,7 +262,7 @@ class MainViewModel(application: Application) : AndroidViewModel(application) {
264262
pendingUnlockAction!!()
265263
pendingUnlockAction = null
266264
} else executeRequest { nextcloudApi.refreshServerList() }
267-
} else lock()
265+
} else if (pin.isEmpty()) lock()
268266
}
269267

270268
fun changePin() {

0 commit comments

Comments
 (0)