Additional info if biometric auth unavailable, Fix biometric auth setting, Update strings

This commit is contained in:
MrLetsplay 2023-10-08 15:14:43 +02:00
parent a5d8bada63
commit 961a40c004
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg
4 changed files with 25 additions and 11 deletions

View File

@ -125,8 +125,15 @@ public class SettingsFragment extends NamedFragment {
});
boolean biometricSupported = BiometricUtil.isSupported(requireContext());
if(SettingsUtil.isDatabaseEncrypted(requireContext()) && biometricSupported) {
binding.settingsBiometricLock.setChecked(SettingsUtil.isBiometricEncryption(requireContext()));
binding.settingsBiometricLock.setEnabled(SettingsUtil.isDatabaseEncrypted(requireContext()) && biometricSupported);
binding.settingsBiometricLock.setChecked(SettingsUtil.isBiometricEncryption(requireContext()));
if(!biometricSupported) {
binding.settingsBiometricLockInfo.setVisibility(View.VISIBLE);
binding.settingsBiometricLockInfo.setText(R.string.biometric_encryption_unavailable);
}
if(biometricSupported) {
binding.settingsBiometricLock.setOnCheckedChangeListener((view, checked) -> {
if(checked) {
OTPDatabase.promptLoadDatabase(requireActivity(), () -> {
@ -150,10 +157,6 @@ public class SettingsFragment extends NamedFragment {
SettingsUtil.disableBiometricEncryption(requireContext());
}
});
}else {
binding.settingsBiometricLock.setChecked(false);
binding.settingsBiometricLock.setEnabled(false);
// TODO: inform user
}
binding.settingsScreenSecurity.setChecked(SettingsUtil.isScreenSecurity(requireContext()));

View File

@ -59,6 +59,15 @@
android:layout_height="wrap_content"
android:text="@string/settings_biometric_lock" />
<TextView
android:id="@+id/settings_biometric_lock_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:visibility="gone"
tools:visibility="visible"
tools:text="Additional info when biometric auth is unavailable" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/settings_screen_security"
android:layout_width="match_parent"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="action_settings">Einstellungen</string>
<string name="show_images">Bilder Anzeigen</string>
<string name="show_images">Bilder anzeigen</string>
<string name="delete_pack_title">Paket löschen</string>
<string name="delete_pack_message">Möchtest du das Symbolpaket wirklich löschen?</string>
<string name="no_icon_packs_installed">Aktuell sind keine Symbolpakete installiert!</string>
@ -165,4 +165,5 @@
<string name="localization">Lokalisierung</string>
<string name="error_duplicate_otp_message">Ein OTP mit dem Namen des OTPs, das du hinzufügen willst, existiert bereits.\n\nWillst du das neue OTP umbenennen lassen, um sie voneinander zu unterscheiden?</string>
<string name="error_duplicate_otp_title">Doppeltes OTP</string>
<string name="biometric_encryption_unavailable">Biometrische Authentifizierung ist deaktiviert, da sie auf deinem Gerät nicht eingerichtet oder nicht verfügbar ist</string>
</resources>

View File

@ -49,8 +49,8 @@
<string name="qr_scanner_migration_title">OTP Migration</string>
<string name="qr_scanner_migration_message">It seems like you\'re trying to import OTP codes from another app. Do you want to import all codes into this group?</string>
<string name="qr_scanner_migration_part">Code %d of %d scanned</string>
<string name="screen_security">Screen Security</string>
<string name="hide_codes">Hide Codes</string>
<string name="screen_security">Screen security</string>
<string name="hide_codes">Hide codes</string>
<string name="enable_encryption">Enable encryption</string>
<string name="password">Password</string>
<string name="set_password">Set Password</string>
@ -102,7 +102,7 @@
<string name="otp_add_type">Type</string>
<string name="otp_add_algorithm">Algorithm</string>
<string name="otp_add_digits">Digits</string>
<string name="show_images">Show Images</string>
<string name="show_images">Show images</string>
<string name="delete_pack_title">Delete pack</string>
<string name="delete_pack_message">Do you want to delete the icon pack?</string>
<string name="no_icon_packs_installed">No icon packs are currently installed</string>
@ -154,7 +154,7 @@
<string name="search">Search</string>
<string name="settings_enable_themed_background">Use themed background</string>
<string name="settings_enable_minimalist_theme">Use minimalist theme</string>
<string name="settings_icon_packs">Icon Packs</string>
<string name="settings_icon_packs">Icon packs</string>
<string name="settings_icon_packs_import">Import icon pack</string>
<string name="settings_icon_packs_manage">Manage icon packs</string>
<string name="save">Save</string>
@ -171,6 +171,7 @@
<string name="localization">Localization</string>
<string name="error_duplicate_otp_message">An OTP with the name of the OTP you\'re trying to add already exists.\n\nDo you want to automatically rename the new OTP to distinguish them from each other?</string>
<string name="error_duplicate_otp_title">Duplicate OTP</string>
<string name="biometric_encryption_unavailable">Biometric authentication is disabled because it is not set up or not available on your device</string>
<string-array name="edit_otp_choose_image_options">
<item>Image from icon pack</item>
<item>Image from gallery</item>