mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 23:59:17 +01:00
Rename some biometrics things since it's no longer specifically for biometric auth
This commit is contained in:
parent
bbbcb18b91
commit
c741920ec0
@ -83,7 +83,7 @@
|
||||
android:resource="@xml/s_pen_actions"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.security.BiometricUnlockActivity"
|
||||
android:name=".ui.security.UnlockActivity"
|
||||
android:theme="@style/Theme.Base" />
|
||||
<activity
|
||||
android:name=".ui.webview.WebViewActivity"
|
||||
|
@ -154,7 +154,7 @@ object PreferenceKeys {
|
||||
|
||||
const val startScreen = "start_screen"
|
||||
|
||||
const val useBiometricLock = "use_biometric_lock"
|
||||
const val useAuthenticator = "use_biometric_lock"
|
||||
|
||||
const val lockAppAfter = "lock_app_after"
|
||||
|
||||
|
@ -65,7 +65,7 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun hideBottomBar() = flowPrefs.getBoolean(Keys.hideBottomBar, true)
|
||||
|
||||
fun useBiometricLock() = flowPrefs.getBoolean(Keys.useBiometricLock, false)
|
||||
fun useAuthenticator() = flowPrefs.getBoolean(Keys.useAuthenticator, false)
|
||||
|
||||
fun lockAppAfter() = flowPrefs.getInt(Keys.lockAppAfter, 0)
|
||||
|
||||
|
@ -5,7 +5,7 @@ import android.view.WindowManager
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.util.system.BiometricUtil
|
||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
@ -28,14 +28,14 @@ class SecureActivityDelegate(private val activity: FragmentActivity) {
|
||||
}
|
||||
|
||||
fun onResume() {
|
||||
if (preferences.useBiometricLock().get()) {
|
||||
if (BiometricUtil.isSupported(activity)) {
|
||||
if (preferences.useAuthenticator().get()) {
|
||||
if (AuthenticatorUtil.isSupported(activity)) {
|
||||
if (isAppLocked()) {
|
||||
activity.startActivity(Intent(activity, BiometricUnlockActivity::class.java))
|
||||
activity.startActivity(Intent(activity, UnlockActivity::class.java))
|
||||
activity.overridePendingTransition(0, 0)
|
||||
}
|
||||
} else {
|
||||
preferences.useBiometricLock().set(false)
|
||||
preferences.useAuthenticator().set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import android.os.Bundle
|
||||
import androidx.biometric.BiometricPrompt
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseThemedActivity
|
||||
import eu.kanade.tachiyomi.util.system.BiometricUtil
|
||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
|
||||
import timber.log.Timber
|
||||
import java.util.Date
|
||||
import java.util.concurrent.Executors
|
||||
@ -12,7 +12,7 @@ import java.util.concurrent.Executors
|
||||
/**
|
||||
* Blank activity with a BiometricPrompt.
|
||||
*/
|
||||
class BiometricUnlockActivity : BaseThemedActivity() {
|
||||
class UnlockActivity : BaseThemedActivity() {
|
||||
|
||||
private val executor = Executors.newSingleThreadExecutor()
|
||||
|
||||
@ -40,10 +40,10 @@ class BiometricUnlockActivity : BaseThemedActivity() {
|
||||
|
||||
var promptInfo = BiometricPrompt.PromptInfo.Builder()
|
||||
.setTitle(getString(R.string.unlock_app))
|
||||
.setAllowedAuthenticators(BiometricUtil.getSupportedAuthenticators(this))
|
||||
.setAllowedAuthenticators(AuthenticatorUtil.getSupportedAuthenticators(this))
|
||||
.setConfirmationRequired(false)
|
||||
|
||||
if (!BiometricUtil.isDeviceCredentialAllowed(this)) {
|
||||
if (!AuthenticatorUtil.isDeviceCredentialAllowed(this)) {
|
||||
promptInfo = promptInfo.setNegativeButtonText(getString(R.string.action_cancel))
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
import eu.kanade.tachiyomi.util.preference.summaryRes
|
||||
import eu.kanade.tachiyomi.util.preference.switchPreference
|
||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||
import eu.kanade.tachiyomi.util.system.BiometricUtil
|
||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
|
||||
@ -17,9 +17,9 @@ class SettingsSecurityController : SettingsController() {
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = R.string.pref_category_security
|
||||
|
||||
if (BiometricUtil.isSupported(context)) {
|
||||
if (AuthenticatorUtil.isSupported(context)) {
|
||||
switchPreference {
|
||||
key = Keys.useBiometricLock
|
||||
key = Keys.useAuthenticator
|
||||
titleRes = R.string.lock_with_biometrics
|
||||
defaultValue = false
|
||||
}
|
||||
@ -38,7 +38,7 @@ class SettingsSecurityController : SettingsController() {
|
||||
defaultValue = "0"
|
||||
summary = "%s"
|
||||
|
||||
preferences.useBiometricLock().asImmediateFlow { isVisible = it }
|
||||
preferences.useAuthenticator().asImmediateFlow { isVisible = it }
|
||||
.launchIn(viewScope)
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import android.os.Build
|
||||
import androidx.biometric.BiometricManager
|
||||
import androidx.biometric.BiometricManager.Authenticators
|
||||
|
||||
object BiometricUtil {
|
||||
object AuthenticatorUtil {
|
||||
|
||||
fun getSupportedAuthenticators(context: Context): Int {
|
||||
if (isLegacySecured(context)) {
|
Loading…
Reference in New Issue
Block a user