Improved Suggestions

resolves #100
This commit is contained in:
tom5079
2020-09-10 16:50:26 +09:00
parent cea3fb1e65
commit 18c6954be3
28 changed files with 592 additions and 490 deletions

View File

@@ -42,6 +42,7 @@ import xyz.quaver.pupil.util.Preferences
class LockActivity : AppCompatActivity() {
private lateinit var lockManager: LockManager
private var lastUnlocked = 0L
private var mode: String? = null
private val patternLockFragment = PatternLockFragment().apply {
@@ -52,6 +53,7 @@ class LockActivity : AppCompatActivity() {
val result = lockManager.check(it)
if (result == true) {
lastUnlocked = System.currentTimeMillis()
setResult(Activity.RESULT_OK)
finish()
} else
@@ -86,6 +88,7 @@ class LockActivity : AppCompatActivity() {
val result = lockManager.check(it)
if (result == true) {
lastUnlocked = System.currentTimeMillis()
setResult(Activity.RESULT_OK)
finish()
} else {
@@ -157,6 +160,7 @@ class LockActivity : AppCompatActivity() {
override fun onAuthenticationSucceeded(
result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
lastUnlocked = System.currentTimeMillis()
setResult(RESULT_OK)
finish()
return
@@ -185,6 +189,7 @@ class LockActivity : AppCompatActivity() {
}
mode = intent.getStringExtra("mode")
val force = intent.getBooleanExtra("force", false)
when(mode) {
null -> {
@@ -194,6 +199,13 @@ class LockActivity : AppCompatActivity() {
return
}
if (System.currentTimeMillis() - lastUnlocked < 5*60*1000 && !force) {
lastUnlocked = System.currentTimeMillis()
setResult(RESULT_OK)
finish()
return
}
if (
Preferences["lock_fingerprint"]
&& BiometricManager.from(this).canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS