Rename biometrics to user authentication

This commit is contained in:
topjohnwu
2023-10-17 18:43:27 -07:00
parent e483d6befe
commit 0352ea2cca
49 changed files with 16 additions and 145 deletions

View File

@@ -51,7 +51,7 @@ class RecreateEvent : ViewEvent(), ActivityExecutor {
}
}
class BiometricEvent(
class AuthEvent(
private val callback: () -> Unit
) : ViewEvent(), ActivityExecutor {

View File

@@ -282,15 +282,15 @@ object Tapjack : BaseSettingsItem.Toggle() {
override var value by Config::suTapjack
}
object Biometrics : BaseSettingsItem.Toggle() {
override val title = R.string.settings_su_biometric_title.asText()
override var description = R.string.settings_su_biometric_summary.asText()
object Authentication : BaseSettingsItem.Toggle() {
override val title = R.string.settings_su_auth_title.asText()
override var description = R.string.settings_su_auth_summary.asText()
override var value by Config::userAuth
override fun refresh() {
isEnabled = Info.isDeviceSecure
if (!isEnabled) {
description = R.string.no_biometric.asText()
description = R.string.settings_su_auth_insecure.asText()
}
}
}

View File

@@ -18,7 +18,7 @@ import com.topjohnwu.magisk.core.ktx.toast
import com.topjohnwu.magisk.core.tasks.HideAPK
import com.topjohnwu.magisk.databinding.bindExtra
import com.topjohnwu.magisk.events.AddHomeIconEvent
import com.topjohnwu.magisk.events.BiometricEvent
import com.topjohnwu.magisk.events.AuthEvent
import com.topjohnwu.magisk.events.SnackbarEvent
import com.topjohnwu.superuser.Shell
import kotlinx.coroutines.launch
@@ -72,7 +72,7 @@ class SettingsViewModel : BaseViewModel(), BaseSettingsItem.Handler {
if (Info.showSuperUser) {
list.addAll(listOf(
Superuser,
Tapjack, Biometrics, AccessMode, MultiuserMode, MountNamespaceMode,
Tapjack, Authentication, AccessMode, MultiuserMode, MountNamespaceMode,
AutomaticResponse, RequestTimeout, SUNotification
))
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
@@ -92,7 +92,7 @@ class SettingsViewModel : BaseViewModel(), BaseSettingsItem.Handler {
when (item) {
DownloadPath -> withExternalRW(andThen)
UpdateChecker -> withPostNotificationPermission(andThen)
Biometrics -> BiometricEvent(andThen).publish()
Authentication -> AuthEvent(andThen).publish()
Theme -> SettingsFragmentDirections.actionSettingsFragmentToThemeFragment().navigate()
DenyListConfig -> SettingsFragmentDirections.actionSettingsFragmentToDenyFragment().navigate()
SystemlessHosts -> createHosts()

View File

@@ -23,7 +23,7 @@ import com.topjohnwu.magisk.databinding.bindExtra
import com.topjohnwu.magisk.databinding.diffList
import com.topjohnwu.magisk.databinding.set
import com.topjohnwu.magisk.dialog.SuperuserRevokeDialog
import com.topjohnwu.magisk.events.BiometricEvent
import com.topjohnwu.magisk.events.AuthEvent
import com.topjohnwu.magisk.events.SnackbarEvent
import com.topjohnwu.magisk.utils.asText
import com.topjohnwu.magisk.view.TextItem
@@ -118,7 +118,7 @@ class SuperuserViewModel(
}
if (Config.userAuth) {
BiometricEvent { updateState() }.publish()
AuthEvent { updateState() }.publish()
} else {
SuperuserRevokeDialog(item.title) { updateState() }.show()
}
@@ -171,7 +171,7 @@ class SuperuserViewModel(
}
if (Config.userAuth) {
BiometricEvent { updateState() }.publish()
AuthEvent { updateState() }.publish()
} else {
updateState()
}

View File

@@ -28,7 +28,7 @@ import com.topjohnwu.magisk.core.model.su.SuPolicy.Companion.ALLOW
import com.topjohnwu.magisk.core.model.su.SuPolicy.Companion.DENY
import com.topjohnwu.magisk.core.su.SuRequestHandler
import com.topjohnwu.magisk.databinding.set
import com.topjohnwu.magisk.events.BiometricEvent
import com.topjohnwu.magisk.events.AuthEvent
import com.topjohnwu.magisk.events.DieEvent
import com.topjohnwu.magisk.events.ShowUIEvent
import com.topjohnwu.magisk.utils.TextHolder
@@ -77,7 +77,7 @@ class SuRequestViewModel(
fun grantPressed() {
cancelTimer()
if (Config.userAuth) {
BiometricEvent { respond(ALLOW) }.publish()
AuthEvent { respond(ALLOW) }.publish()
} else {
respond(ALLOW)
}