<TextBox Text="{Binding ElementName=NewNote,Path=Title,UpdateSourceTrigger=PropertyChanged}"/>
<TextBox Text="{Binding NewNote.Title}"/>
suspend fun fingerPrintResult(): Boolean {
val executor = Executors.newSingleThreadExecutor()
val activity: FragmentActivity = this // reference to activity
return suspendCoroutine { coroutine ->
val biometricPrompt = BiometricPrompt(activity, executor, object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
super.onAuthenticationError(errorCode, errString)
coroutine.resume(false)
}
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
coroutine.resume(true)
}
override fun onAuthenticationFailed() {
super.onAuthenticationFailed()
coroutine.resume(false)
}
})
val promptInfo = BiometricPrompt.PromptInfo.Builder()
.setTitle("Подтвердите личность")
.setNegativeButtonText("Negative Button")
.build()
biometricPrompt.authenticate(promptInfo)
}
}