Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update AdvancedPasswordField to prevent freezes on Android (#1187)
Leendert de Borst67c4b55cbb0c
diff --git a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsxindex fb3739cef..b044a08a3 100644--- a/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx+++ b/apps/mobile-app/app/(tabs)/credentials/add-edit.tsx@@ -332,7 +332,7 @@ export default function AddEditCredentialScreen() : React.ReactNode {// Then navigate after a short delay to ensure the modal has closedsetTimeout(() => {if (isEditMode) {- router.replace(`/credentials/${credentialToSave.Id}`);+ // Do nothing, as the original screen will update itself.} else {router.push(`/credentials/${credentialToSave.Id}`);}diff --git a/apps/mobile-app/app/(tabs)/emails/[id].tsx b/apps/mobile-app/app/(tabs)/emails/[id].tsxindex 93c6c4bbb..8954c58be 100644--- a/apps/mobile-app/app/(tabs)/emails/[id].tsx+++ b/apps/mobile-app/app/(tabs)/emails/[id].tsx@@ -230,7 +230,7 @@ export default function EmailDetailsScreen() : React.ReactNode {paddingRight: 10,},headerRightButtonDelete: {- paddingRight: 0,+ paddingRight: Platform.OS === 'ios' ? 0 : 10,},headerRightContainer: {flexDirection: 'row',@@ -333,8 +333,8 @@ export default function EmailDetailsScreen() : React.ReactNode {<RobustPressableonPress={() => setHtmlView(!isHtmlView)}style={styles.headerRightButton}- pressRetentionOffset={10}- hitSlop={10}+ pressRetentionOffset={5}+ hitSlop={5}><Ioniconsname={isHtmlView ? 'text-outline' : 'document-outline'}@@ -345,8 +345,8 @@ export default function EmailDetailsScreen() : React.ReactNode {<RobustPressableonPress={handleDelete}style={[styles.headerRightButton, styles.headerRightButtonDelete]}- pressRetentionOffset={10}- hitSlop={10}+ pressRetentionOffset={5}+ hitSlop={5}><Ioniconsname="trash-outline"diff --git a/apps/mobile-app/components/form/AdvancedPasswordField.tsx b/apps/mobile-app/components/form/AdvancedPasswordField.tsxindex 7cacab6d2..ef53f8d87 100644--- a/apps/mobile-app/components/form/AdvancedPasswordField.tsx+++ b/apps/mobile-app/components/form/AdvancedPasswordField.tsx@@ -1,9 +1,9 @@import { MaterialIcons } from '@expo/vector-icons';import Slider from '@react-native-community/slider';-import React, { forwardRef, useImperativeHandle, useRef, useState, useCallback, useEffect } from 'react';+import React, { forwardRef, useImperativeHandle, useMemo, useRef, useState, useCallback } from 'react';import { Controller, Control, FieldValues, Path } from 'react-hook-form';import { useTranslation } from 'react-i18next';-import { View, TextInput, TextInputProps, StyleSheet, TouchableHighlight, Platform, Modal, ScrollView, Switch, TouchableOpacity } from 'react-native';+import { View, TextInput, TextInputProps, StyleSheet, TouchableOpacity, Platform, Modal, ScrollView, Switch } from 'react-native';import type { PasswordSettings } from '@/utils/dist/shared/models/vault';import { CreatePasswordGenerator } from '@/utils/dist/shared/password-generator';@@ -28,9 +28,15 @@ type AdvancedPasswordFieldProps<T extends FieldValues> = Omit<TextInputProps, 'visNewCredential?: boolean;}-/**- * Advanced password field component with inline length slider and settings modal.- */+const defaultSettings: PasswordSettings = {+ Length: 16,+ UseLowercase: true,+ UseUppercase: true,+ UseNumbers: true,+ UseSpecialChars: true,+ UseNonAmbiguousChars: false+};+const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, AdvancedPasswordFieldProps<FieldValues>>(({label,name,@@ -44,32 +50,19 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva}, ref) => {const colors = useColors();const { t } = useTranslation();- const inputRef = React.useRef<TextInput>(null);- const currentValue = useRef<string>('');- const [isFocused, setIsFocused] = React.useState(false);- const defaultSettings: PasswordSettings = {- Length: 16,- UseLowercase: true,- UseUppercase: true,- UseNumbers: true,- UseSpecialChars: true,- UseNonAmbiguousChars: false- };+ const inputRef = useRef<TextInput>(null);const [internalShowPassword, setInternalShowPassword] = useState(false);const [showSettingsModal, setShowSettingsModal] = useState(false);- const [currentSettings, setCurrentSettings] = useState<PasswordSettings>(initialSettings || defaultSettings);+ const [currentSettings, setCurrentSettings] = useState<PasswordSettings>(() => initialSettings || defaultSettings);const [previewPassword, setPreviewPassword] = useState<string>('');- const [displayLength, setDisplayLength] = useState<number>((initialSettings || defaultSettings).Length);- const [hasAutoGenerated, setHasAutoGenerated] = useState(false);- const onChangeRef = useRef<((value: string) => void) | null>(null);+ const [sliderValue, setSliderValue] = useState<number>(() => (initialSettings || defaultSettings).Length);+ const fieldOnChangeRef = useRef<((value: string) => void) | null>(null);+ const lastGeneratedLength = useRef<number>(0);+ const isSliding = useRef(false);- // Use controlled or uncontrolled showPassword stateconst showPassword = controlledShowPassword ?? internalShowPassword;- /**- * Set the showPassword state.- */- const setShowPasswordState = useCallback((show: boolean): void => {+ const setShowPasswordState = useCallback((show: boolean) => {if (controlledShowPassword !== undefined) {onShowPasswordChange?.(show);} else {@@ -77,160 +70,117 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva}}, [controlledShowPassword, onShowPasswordChange]);- /**- * Expose focus and selectAll methods through ref.- */useImperativeHandle(ref, () => ({- /**- * Focus the input field.- */- focus: (): void => {- inputRef.current?.focus();- },- /**- * Select all text in the input field.- */- selectAll: (): void => {- inputRef.current?.setSelection(0, currentValue.current.length);- }- }));-- /**- * Initialize settings when initialSettings change.- */- useEffect(() => {- const settings = initialSettings || defaultSettings;- setCurrentSettings({ ...settings });- setDisplayLength(settings.Length);- }, [initialSettings]);-- /**- * Auto-generate password for new credentials after component mount.- */- useEffect(() => {- if (isNewCredential && !hasAutoGenerated && currentSettings.Length > 0 && onChangeRef.current) {- try {- const passwordGenerator = CreatePasswordGenerator(currentSettings);- const password = passwordGenerator.generateRandomPassword();- onChangeRef.current(password);- setShowPasswordState(true);- setHasAutoGenerated(true);- } catch (error) {- console.error('Error auto-generating password:', error);- setHasAutoGenerated(true);+ focus: () => inputRef.current?.focus(),+ selectAll: () => {+ const input = inputRef.current;+ if (input && input.props.value) {+ input.setSelection(0, String(input.props.value).length);}}- }, [isNewCredential, hasAutoGenerated, currentSettings, setShowPasswordState]);+ }), []);- /**- * Generate a password with the given settings.- */- const generatePassword = useCallback((settings: PasswordSettings, onChange: (value: string) => void) => {+ const generatePassword = useCallback((settings: PasswordSettings): string => {try {const passwordGenerator = CreatePasswordGenerator(settings);- const password = passwordGenerator.generateRandomPassword();- onChange(password);- setShowPasswordState(true);- return password;+ return passwordGenerator.generateRandomPassword();} catch (error) {console.error('Error generating password:', error);return '';}- }, [setShowPasswordState]);-- /**- * Generate a preview password for the settings modal.- */- const generatePreview = useCallback((settings: PasswordSettings) => {- try {- const passwordGenerator = CreatePasswordGenerator(settings);- const password = passwordGenerator.generateRandomPassword();- setPreviewPassword(password);- } catch (error) {- console.error('Error generating preview password:', error);- setPreviewPassword('');- }}, []);- /**- * Individual handlers for each switch to prevent re-renders.- */- const handleLowercaseChange = useCallback((value: boolean) => {- const newSettings = { ...currentSettings, UseLowercase: value };- setCurrentSettings(newSettings);- generatePreview(newSettings);- }, [currentSettings, generatePreview]);-- const handleUppercaseChange = useCallback((value: boolean) => {- const newSettings = { ...currentSettings, UseUppercase: value };- setCurrentSettings(newSettings);- generatePreview(newSettings);- }, [currentSettings, generatePreview]);-- const handleNumbersChange = useCallback((value: boolean) => {- const newSettings = { ...currentSettings, UseNumbers: value };+ const handleGeneratePassword = useCallback(() => {+ if (fieldOnChangeRef.current) {+ const password = generatePassword(currentSettings);+ if (password) {+ fieldOnChangeRef.current(password);+ setShowPasswordState(true);+ }+ }+ }, [currentSettings, generatePassword, setShowPasswordState]);++ const handleSliderChange = useCallback((value: number) => {+ const roundedLength = Math.round(value);+ setSliderValue(roundedLength);++ // Only generate if value actually changed and we're actively sliding+ if (roundedLength !== lastGeneratedLength.current && isSliding.current) {+ lastGeneratedLength.current = roundedLength;++ // Show password when sliding+ if (!showPassword) {+ setShowPasswordState(true);+ }++ const newSettings = { ...currentSettings, Length: roundedLength };+ if (fieldOnChangeRef.current) {+ const password = generatePassword(newSettings);+ if (password) {+ fieldOnChangeRef.current(password);+ }+ }+ }+ }, [currentSettings, generatePassword, showPassword, setShowPasswordState]);++ const handleSliderStart = useCallback(() => {+ isSliding.current = true;+ // Initialize lastGeneratedLength when starting to slide+ lastGeneratedLength.current = sliderValue;+ }, [sliderValue]);++ const handleSliderComplete = useCallback((value: number) => {+ isSliding.current = false;+ const roundedLength = Math.round(value);+ const newSettings = { ...currentSettings, Length: roundedLength };setCurrentSettings(newSettings);- generatePreview(newSettings);- }, [currentSettings, generatePreview]);+ lastGeneratedLength.current = 0; // Reset for next sliding session+ }, [currentSettings]);- const handleSpecialCharsChange = useCallback((value: boolean) => {- const newSettings = { ...currentSettings, UseSpecialChars: value };- setCurrentSettings(newSettings);- generatePreview(newSettings);- }, [currentSettings, generatePreview]);+ const handleRefreshPreview = useCallback(() => {+ const password = generatePassword(currentSettings);+ setPreviewPassword(password);+ }, [currentSettings, generatePassword]);- const handleNonAmbiguousChange = useCallback((value: boolean) => {- const newSettings = { ...currentSettings, UseNonAmbiguousChars: value };- setCurrentSettings(newSettings);- generatePreview(newSettings);- }, [currentSettings, generatePreview]);+ const handleUsePassword = useCallback(() => {+ if (fieldOnChangeRef.current && previewPassword) {+ fieldOnChangeRef.current(previewPassword);+ setShowPasswordState(true);+ setShowSettingsModal(false);+ }+ }, [previewPassword, setShowPasswordState]);- /**- * Handle opening the settings modal.- */const handleOpenSettings = useCallback(() => {- // Focus the password input field to prevent scroll jumping- inputRef.current?.focus();- // Generate initial preview when modal opens- generatePreview(currentSettings);+ const password = generatePassword(currentSettings);+ setPreviewPassword(password);setShowSettingsModal(true);- }, [currentSettings, generatePreview]);-- /**- * Handle refreshing the preview password in the modal.- */- const handleRefreshPreview = useCallback(() => {- generatePreview(currentSettings);- }, [currentSettings, generatePreview]);-- /**- * Handle using the generated password from the modal.- */- const handleUsePassword = useCallback((onChange: (value: string) => void) => {- onChange(previewPassword);- setShowPasswordState(true);- setShowSettingsModal(false);- }, [previewPassword, setShowPasswordState]);+ }, [currentSettings, generatePassword]);- const colorRed = 'red';- const modalBackgroundColor = 'rgba(0, 0, 0, 0.8)';+ const updateSetting = useCallback((key: keyof PasswordSettings, value: boolean) => {+ setCurrentSettings(prev => {+ const newSettings = { ...prev, [key]: value };+ const password = generatePassword(newSettings);+ setPreviewPassword(password);+ return newSettings;+ });+ }, [generatePassword]);- const styles = StyleSheet.create({+ const styles = useMemo(() => StyleSheet.create({button: {borderLeftColor: colors.accentBorder,borderLeftWidth: 1,- padding: 10,+ paddingHorizontal: 12,+ paddingVertical: 10,},clearButton: {- borderRadius: 6,- marginRight: 4,- padding: 6,+ paddingHorizontal: 8,+ paddingVertical: 10,},closeButton: {- padding: 4,+ padding: 8,},errorText: {- color: colorRed,+ color: 'red',fontSize: 12,marginTop: 4,},@@ -238,8 +188,8 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Advacolor: colors.text,flex: 1,fontSize: 16,- marginRight: 5,- padding: 10,+ paddingHorizontal: 10,+ paddingVertical: 10,},inputContainer: {alignItems: 'center',@@ -250,7 +200,7 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, AdvaflexDirection: 'row',},inputError: {- borderColor: colorRed,+ borderColor: 'red',},inputGroup: {marginBottom: 6,@@ -276,7 +226,7 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva},modalOverlay: {alignItems: 'center',- backgroundColor: modalBackgroundColor,+ backgroundColor: 'rgba(0, 0, 0, 0.8)',flex: 1,justifyContent: 'center',},@@ -310,18 +260,19 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Advapadding: 10,},requiredIndicator: {- color: colorRed,+ color: 'red',marginLeft: 4,},settingItem: {alignItems: 'center',flexDirection: 'row',justifyContent: 'space-between',- paddingVertical: 8,+ paddingVertical: 10,},settingLabel: {color: colors.text,fontSize: 14,+ flex: 1,},settingsButton: {marginLeft: 8,@@ -332,19 +283,17 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva},slider: {height: 40,- paddingVertical: 10, // Add padding for better touch area on Androidwidth: '100%',},sliderContainer: {marginTop: 8,paddingHorizontal: 4,- paddingVertical: 5, // Additional padding around the slider},sliderHeader: {alignItems: 'center',flexDirection: 'row',justifyContent: 'space-between',- marginBottom: 8,+ marginBottom: 12,},sliderLabel: {color: colors.textMuted,@@ -363,13 +312,10 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, AdvauseButton: {alignItems: 'center',backgroundColor: colors.primary,- borderColor: colors.accentBorder,borderRadius: 6,- borderWidth: 1,- color: colors.primarySurfaceText,flexDirection: 'row',justifyContent: 'center',- padding: 6,+ padding: 12,},useButtonText: {color: colors.text,@@ -377,150 +323,18 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, AdvafontWeight: '600',marginLeft: 8,},- });-- /**- * Handle closing the settings modal.- */- const handleCloseModal = useCallback(() => {- setShowSettingsModal(false);- }, []);-- /**- * Render the settings modal.- */- const renderSettingsModal = useCallback((onChange: (value: string) => void) => {- if (!showSettingsModal) {- return null;- }-- return (- <Modal- visible={showSettingsModal}- transparent- animationType="fade"- onRequestClose={handleCloseModal}- >- <View style={styles.modalOverlay}>- <View style={styles.modalContent}>- <View style={styles.modalHeader}>- <ThemedText style={styles.modalTitle}>{t('credentials.changePasswordComplexity')}</ThemedText>- <TouchableOpacity- style={styles.closeButton}- onPress={handleCloseModal}- >- <MaterialIcons name="close" size={24} color={colors.textMuted} />- </TouchableOpacity>- </View>-- <ScrollView showsVerticalScrollIndicator={false}>- <View style={styles.previewContainer}>- <View style={styles.previewInputContainer}>- <TextInput- style={styles.previewInput}- value={previewPassword}- editable={false}- multiline={false}- numberOfLines={1}- />- <TouchableOpacity- style={styles.refreshButton}- onPress={handleRefreshPreview}- >- <MaterialIcons name="refresh" size={20} color={colors.primary} />- </TouchableOpacity>- </View>- </View>-- <View style={styles.settingsSection}>- <View style={styles.settingItem}>- <ThemedText style={styles.settingLabel}>{t('credentials.includeLowercase')}</ThemedText>- <Switch- value={currentSettings.UseLowercase}- onValueChange={handleLowercaseChange}- trackColor={{ false: colors.accentBorder, true: colors.primary }}- thumbColor={Platform.OS === 'android' ? colors.background : undefined}- />- </View>-- <View style={styles.settingItem}>- <ThemedText style={styles.settingLabel}>{t('credentials.includeUppercase')}</ThemedText>- <Switch- value={currentSettings.UseUppercase}- onValueChange={handleUppercaseChange}- trackColor={{ false: colors.accentBorder, true: colors.primary }}- thumbColor={Platform.OS === 'android' ? colors.background : undefined}- />- </View>-- <View style={styles.settingItem}>- <ThemedText style={styles.settingLabel}>{t('credentials.includeNumbers')}</ThemedText>- <Switch- value={currentSettings.UseNumbers}- onValueChange={handleNumbersChange}- trackColor={{ false: colors.accentBorder, true: colors.primary }}- thumbColor={Platform.OS === 'android' ? colors.background : undefined}- />- </View>-- <View style={styles.settingItem}>- <ThemedText style={styles.settingLabel}>{t('credentials.includeSpecialChars')}</ThemedText>- <Switch- value={currentSettings.UseSpecialChars}- onValueChange={handleSpecialCharsChange}- trackColor={{ false: colors.accentBorder, true: colors.primary }}- thumbColor={Platform.OS === 'android' ? colors.background : undefined}- />- </View>-- <View style={styles.settingItem}>- <ThemedText style={styles.settingLabel}>{t('credentials.avoidAmbiguousChars')}</ThemedText>- <Switch- value={currentSettings.UseNonAmbiguousChars}- onValueChange={handleNonAmbiguousChange}- trackColor={{ false: colors.accentBorder, true: colors.primary }}- thumbColor={Platform.OS === 'android' ? colors.background : undefined}- />- </View>- </View>-- <TouchableOpacity- style={styles.useButton}- onPress={() => handleUsePassword(onChange)}- >- <MaterialIcons name="keyboard-arrow-down" size={20} color={colors.text} />- <ThemedText style={styles.useButtonText}>{t('common.use')}</ThemedText>- </TouchableOpacity>- </ScrollView>- </View>- </View>- </Modal>- );- }, [- showSettingsModal,- styles,- previewPassword,- handleRefreshPreview,- currentSettings,- handleLowercaseChange,- handleUppercaseChange,- handleNumbersChange,- handleSpecialCharsChange,- handleNonAmbiguousChange,- colors,- handleUsePassword,- handleCloseModal,- t- ]);+ }), [colors]);return (<Controllercontrol={control}name={name}render={({ field: { onChange, value }, fieldState: { error } }) => {- currentValue.current = value as string;- onChangeRef.current = onChange; // Assign onChange to the ref- const showClearButton = Platform.OS === 'android' && value && value.length > 0 && isFocused;+ fieldOnChangeRef.current = onChange;++ // Removed auto-generation on initial render to prevent Android crashes++ const showClearButton = Platform.OS === 'android' && value && value.length > 0;return (<View style={styles.inputGroup}>@@ -539,54 +353,50 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, AdvaautoComplete="off"autoCorrect={false}clearButtonMode={Platform.OS === 'ios' ? "while-editing" : "never"}- onFocus={() => setIsFocused(true)}- onBlur={() => setIsFocused(false)}secureTextEntry={!showPassword}- multiline={false}- numberOfLines={1}{...props}/>{showClearButton && (- <TouchableHighlight+ <TouchableOpacitystyle={styles.clearButton}onPress={() => onChange('')}- underlayColor={colors.accentBackground}+ activeOpacity={0.7}><MaterialIcons name="close" size={16} color={colors.textMuted} />- </TouchableHighlight>+ </TouchableOpacity>)}- <TouchableHighlight+ <TouchableOpacitystyle={styles.button}onPress={() => setShowPasswordState(!showPassword)}- underlayColor={colors.accentBackground}+ activeOpacity={0.7}><MaterialIconsname={showPassword ? "visibility-off" : "visibility"}size={20}color={colors.primary}/>- </TouchableHighlight>+ </TouchableOpacity>- <TouchableHighlight+ <TouchableOpacitystyle={styles.button}- onPress={() => generatePassword(currentSettings, onChange)}- underlayColor={colors.accentBackground}+ onPress={handleGeneratePassword}+ activeOpacity={0.7}><MaterialIcons name="refresh" size={20} color={colors.primary} />- </TouchableHighlight>+ </TouchableOpacity></View>- {/* Inline Password Length Slider */}<View style={styles.sliderContainer}><View style={styles.sliderHeader}><ThemedText style={styles.sliderLabel}>{t('credentials.passwordLength')}</ThemedText><View style={styles.sliderValueContainer}>- <ThemedText style={styles.sliderValue}>{displayLength}</ThemedText>+ <ThemedText style={styles.sliderValue}>{sliderValue}</ThemedText><TouchableOpacitystyle={styles.settingsButton}onPress={handleOpenSettings}+ activeOpacity={0.7}><MaterialIcons name="settings" size={20} color={colors.primary} /></TouchableOpacity>@@ -597,19 +407,10 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Advastyle={styles.slider}minimumValue={8}maximumValue={64}- value={currentSettings.Length}- onValueChange={(value) => {- const roundedLength = Math.round(value);- setDisplayLength(roundedLength); // Update display immediately- const tempSettings = { ...currentSettings, Length: roundedLength };- generatePassword(tempSettings, onChange);- }}- onSlidingComplete={(value) => {- const roundedLength = Math.round(value);- const newSettings = { ...currentSettings, Length: roundedLength };- setCurrentSettings(newSettings);- setDisplayLength(roundedLength); // Ensure display matches final value- }}+ value={sliderValue}+ onValueChange={handleSliderChange}+ onSlidingStart={handleSliderStart}+ onSlidingComplete={handleSliderComplete}step={1}minimumTrackTintColor={colors.primary}maximumTrackTintColor={colors.accentBorder}@@ -619,7 +420,107 @@ const AdvancedPasswordFieldComponent = forwardRef<AdvancedPasswordFieldRef, Adva{error && <ThemedText style={styles.errorText}>{error.message}</ThemedText>}- {renderSettingsModal(onChange)}+ <Modal+ visible={showSettingsModal}+ transparent+ animationType="fade"+ onRequestClose={() => setShowSettingsModal(false)}+ >+ <View style={styles.modalOverlay}>+ <View style={styles.modalContent}>+ <View style={styles.modalHeader}>+ <ThemedText style={styles.modalTitle}>{t('credentials.changePasswordComplexity')}</ThemedText>+ <TouchableOpacity+ style={styles.closeButton}+ onPress={() => setShowSettingsModal(false)}+ activeOpacity={0.7}+ >+ <MaterialIcons name="close" size={24} color={colors.textMuted} />+ </TouchableOpacity>+ </View>++ <ScrollView showsVerticalScrollIndicator={false}>+ <View style={styles.previewContainer}>+ <View style={styles.previewInputContainer}>+ <TextInput+ style={styles.previewInput}+ value={previewPassword}+ editable={false}+ />+ <TouchableOpacity+ style={styles.refreshButton}+ onPress={handleRefreshPreview}+ activeOpacity={0.7}+ >+ <MaterialIcons name="refresh" size={20} color={colors.primary} />+ </TouchableOpacity>+ </View>+ </View>++ <View style={styles.settingsSection}>+ <View style={styles.settingItem}>+ <ThemedText style={styles.settingLabel}>{t('credentials.includeLowercase')}</ThemedText>+ <Switch+ value={currentSettings.UseLowercase}+ onValueChange={(value) => updateSetting('UseLowercase', value)}+ trackColor={{ false: colors.accentBorder, true: colors.primary }}+ thumbColor={Platform.OS === 'android' ? colors.background : undefined}+ />+ </View>++ <View style={styles.settingItem}>+ <ThemedText style={styles.settingLabel}>{t('credentials.includeUppercase')}</ThemedText>+ <Switch+ value={currentSettings.UseUppercase}+ onValueChange={(value) => updateSetting('UseUppercase', value)}+ trackColor={{ false: colors.accentBorder, true: colors.primary }}+ thumbColor={Platform.OS === 'android' ? colors.background : undefined}+ />+ </View>++ <View style={styles.settingItem}>+ <ThemedText style={styles.settingLabel}>{t('credentials.includeNumbers')}</ThemedText>+ <Switch+ value={currentSettings.UseNumbers}+ onValueChange={(value) => updateSetting('UseNumbers', value)}+ trackColor={{ false: colors.accentBorder, true: colors.primary }}+ thumbColor={Platform.OS === 'android' ? colors.background : undefined}+ />+ </View>++ <View style={styles.settingItem}>+ <ThemedText style={styles.settingLabel}>{t('credentials.includeSpecialChars')}</ThemedText>+ <Switch+ value={currentSettings.UseSpecialChars}+ onValueChange={(value) => updateSetting('UseSpecialChars', value)}+ trackColor={{ false: colors.accentBorder, true: colors.primary }}+ thumbColor={Platform.OS === 'android' ? colors.background : undefined}+ />+ </View>++ <View style={styles.settingItem}>+ <ThemedText style={styles.settingLabel}>{t('credentials.avoidAmbiguousChars')}</ThemedText>+ <Switch+ value={currentSettings.UseNonAmbiguousChars}+ onValueChange={(value) => updateSetting('UseNonAmbiguousChars', value)}+ trackColor={{ false: colors.accentBorder, true: colors.primary }}+ thumbColor={Platform.OS === 'android' ? colors.background : undefined}+ />+ </View>+ </View>++ <TouchableOpacity+ style={styles.useButton}+ onPress={handleUsePassword}+ activeOpacity={0.7}+ >+ <MaterialIcons name="keyboard-arrow-down" size={20} color={colors.text} />+ <ThemedText style={styles.useButtonText}>{t('common.use')}</ThemedText>+ </TouchableOpacity>+ </ScrollView>+ </View>+ </View>+ </Modal></View>);}}