Use ContextCompat

This commit is contained in:
topjohnwu 2019-11-15 11:01:39 -05:00
parent 1dc531930d
commit 3d285b91c6

View File

@ -2,10 +2,10 @@ package com.topjohnwu.magisk.utils
import androidx.biometric.BiometricManager import androidx.biometric.BiometricManager
import androidx.biometric.BiometricPrompt import androidx.biometric.BiometricPrompt
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import com.topjohnwu.magisk.Config import com.topjohnwu.magisk.Config
import com.topjohnwu.magisk.R import com.topjohnwu.magisk.R
import com.topjohnwu.superuser.internal.UiThreadHandler
import org.koin.core.KoinComponent import org.koin.core.KoinComponent
import org.koin.core.get import org.koin.core.get
@ -32,7 +32,7 @@ object BiometricHelper: KoinComponent {
onError: () -> Unit = {}, onError: () -> Unit = {},
onSuccess: () -> Unit): BiometricPrompt { onSuccess: () -> Unit): BiometricPrompt {
val prompt = BiometricPrompt(activity, val prompt = BiometricPrompt(activity,
{ cmd: Runnable -> UiThreadHandler.run(cmd) }, ContextCompat.getMainExecutor(activity),
object : BiometricPrompt.AuthenticationCallback() { object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) { override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
onError() onError()