mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-06-28 01:55:45 +01:00
Add bio auth when viewing a recovery key.
This commit is contained in:
committed by
jeffrey-signal
parent
22dddeb3b7
commit
13aafbfefd
+12
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.thoughtcrime.securesms.backup.v2.ui.subscription
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.Image
|
||||
@@ -28,6 +29,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -46,6 +48,7 @@ import org.signal.core.ui.compose.SignalIcons
|
||||
import org.signal.core.ui.compose.horizontalGutters
|
||||
import org.signal.core.ui.compose.theme.SignalTheme
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.compose.rememberBiometricsAuthentication
|
||||
import org.signal.core.ui.R as CoreUiR
|
||||
|
||||
enum class MessageBackupsKeyEducationScreenMode {
|
||||
@@ -80,6 +83,14 @@ fun MessageBackupsKeyEducationScreen(
|
||||
mode: MessageBackupsKeyEducationScreenMode = MessageBackupsKeyEducationScreenMode.DEFAULT
|
||||
) {
|
||||
val scrollState = rememberScrollState()
|
||||
val context = LocalContext.current
|
||||
val biometrics = rememberBiometricsAuthentication(
|
||||
promptTitle = stringResource(R.string.RemoteBackupsSettingsFragment__unlock_to_view_backup_key),
|
||||
educationSheetMessage = stringResource(R.string.RemoteBackupsSettingsFragment__to_view_your_key),
|
||||
onAuthenticationFailed = {
|
||||
Toast.makeText(context, R.string.RemoteBackupsSettingsFragment__authentication_required, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
)
|
||||
|
||||
Scaffolds.Settings(
|
||||
title = "",
|
||||
@@ -139,7 +150,7 @@ fun MessageBackupsKeyEducationScreen(
|
||||
.padding(top = 16.dp, bottom = 24.dp)
|
||||
) {
|
||||
Buttons.LargeTonal(
|
||||
onClick = onNextClick,
|
||||
onClick = { biometrics.withBiometricsAuthentication(onNextClick) },
|
||||
modifier = Modifier.align(Alignment.Center)
|
||||
) {
|
||||
Text(
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ class VerifyBackupKeyActivity : PassphraseRequiredActivity() {
|
||||
// Matches existing behavior: show a generic "authentication required" toast.
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.RemoteBackupsSettingsFragment__authenticatino_required,
|
||||
R.string.RemoteBackupsSettingsFragment__authentication_required,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
|
||||
+1
-1
@@ -368,7 +368,7 @@ private fun RemoteBackupsSettingsContent(
|
||||
promptTitle = stringResource(R.string.RemoteBackupsSettingsFragment__unlock_to_view_backup_key),
|
||||
educationSheetMessage = stringResource(R.string.RemoteBackupsSettingsFragment__to_view_your_key),
|
||||
onAuthenticationFailed = {
|
||||
Toast.makeText(context, R.string.RemoteBackupsSettingsFragment__authenticatino_required, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, R.string.RemoteBackupsSettingsFragment__authentication_required, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -8724,7 +8724,7 @@
|
||||
<!-- Displayed as a label when remote backups are off -->
|
||||
<string name="RemoteBackupsSettingsFragment__off">Off</string>
|
||||
<!-- Text shown in a popup indicating that the user needs to enter their screen lock -->
|
||||
<string name="RemoteBackupsSettingsFragment__authenticatino_required">Authentication required</string>
|
||||
<string name="RemoteBackupsSettingsFragment__authentication_required">Authentication required</string>
|
||||
<!-- Row label to launch payment history screen -->
|
||||
<string name="RemoteBackupsSettingsFragment__payment_history">Payment history</string>
|
||||
<!-- Section header for backup information -->
|
||||
|
||||
Reference in New Issue
Block a user