Improve navigation to fingerprint settings.

fork-5.53.8
Greyson Parrelli 2022-08-25 08:26:09 -04:00
rodzic 490ca1d74c
commit f8aedca08e
2 zmienionych plików z 18 dodań i 1 usunięć

Wyświetl plik

@ -1,8 +1,10 @@
package org.thoughtcrime.securesms.components.settings.app.privacy
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.os.Build
import android.provider.Settings
import android.text.SpannableStringBuilder
import android.text.Spanned
@ -343,7 +345,20 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac
MaterialAlertDialogBuilder(requireContext()).apply {
setTitle(getString(R.string.PrivacySettingsFragment__cant_enable_title))
setMessage(getString(R.string.PrivacySettingsFragment__cant_enable_description))
setPositiveButton(R.string.PaymentsHomeFragment__enable) { _, _ -> startActivity(Intent(Settings.ACTION_BIOMETRIC_ENROLL)) }
setPositiveButton(R.string.PaymentsHomeFragment__enable) { _, _ ->
val intent = when {
Build.VERSION.SDK_INT >= 30 -> Intent(Settings.ACTION_BIOMETRIC_ENROLL)
Build.VERSION.SDK_INT >= 28 -> Intent(Settings.ACTION_FINGERPRINT_ENROLL)
else -> Intent(Settings.ACTION_SECURITY_SETTINGS)
}
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
Log.w(TAG, "Failed to navigate to system settings.", e)
Toast.makeText(requireContext(), R.string.PrivacySettingsFragment__failed_to_navigate_to_system_settings, Toast.LENGTH_SHORT).show()
}
}
setNegativeButton(R.string.PaymentsHomeFragment__not_now) { _, _ -> }
show()
}

Wyświetl plik

@ -3945,6 +3945,8 @@
<string name="PrivacySettingsFragment__cant_enable_title">Can\t enable payment lock</string>
<!-- Alert dialog description to setup screen lock or fingerprint in phone settings -->
<string name="PrivacySettingsFragment__cant_enable_description">To use Payment Lock, you must first enable a screen lock or fingerprint ID in your phones settings.</string>
<!-- Shown in a toast when we can't navigate to the user's system fingerprint settings -->
<string name="PrivacySettingsFragment__failed_to_navigate_to_system_settings">Failed to navigate to system settings</string>
<!-- Alert dialog button to go to phone settings -->
<string name="PrivacySettingsFragment__go_to_settings">Go to settings</string>
<!-- Alert dialog button to cancel the dialog -->