Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update unlock page structure so it can be interacted with via tests (#1404)
Leendert de Borst065874e71246
diff --git a/apps/mobile-app/app/unlock.tsx b/apps/mobile-app/app/unlock.tsxindex 9eafd5963..eedc9c373 100644--- a/apps/mobile-app/app/unlock.tsx+++ b/apps/mobile-app/app/unlock.tsx@@ -4,7 +4,7 @@ import { MaterialIcons } from '@expo/vector-icons';import { LinearGradient } from 'expo-linear-gradient';import { router } from 'expo-router';import { useState, useEffect, useCallback } from 'react';-import { StyleSheet, View, TextInput, Alert, KeyboardAvoidingView, Platform, ScrollView, Dimensions, TouchableWithoutFeedback, Keyboard, Text, Pressable } from 'react-native';+import { StyleSheet, View, TextInput, Alert, KeyboardAvoidingView, Platform, ScrollView, Dimensions, Text, Pressable } from 'react-native';import EncryptionUtility from '@/utils/EncryptionUtility';import { VaultVersionIncompatibleError } from '@/utils/types/errors/VaultVersionIncompatibleError';@@ -15,7 +15,6 @@ import { useTranslation } from '@/hooks/useTranslation';import Logo from '@/assets/images/logo.svg';import LoadingIndicator from '@/components/LoadingIndicator';import { ThemedText } from '@/components/themed/ThemedText';-import { ThemedView } from '@/components/themed/ThemedView';import { Avatar } from '@/components/ui/Avatar';import { RobustPressable } from '@/components/ui/RobustPressable';import { useApp } from '@/context/AppContext';@@ -261,9 +260,6 @@ export default function UnlockScreen() : React.ReactNode {inputIcon: {padding: 12,},- keyboardAvoidingView: {- flex: 1,- },linkButton: {marginTop: 16,},@@ -318,114 +314,114 @@ export default function UnlockScreen() : React.ReactNode {// Render password mode or loadingreturn (- <ThemedView style={styles.container}>+ <KeyboardAvoidingView+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}+ style={styles.container}+ testID="unlock-screen"+ >{isLoading ? (<View style={styles.loadingContainer}><LoadingIndicator status={t('app.status.unlockingVault')} /></View>) : (- <KeyboardAvoidingView- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}- style={styles.keyboardAvoidingView}+ <ScrollView+ style={styles.container}+ contentContainerStyle={styles.scrollContent}+ keyboardShouldPersistTaps="handled">- <TouchableWithoutFeedback onPress={Keyboard.dismiss}>- <ScrollView- contentContainerStyle={styles.scrollContent}- keyboardShouldPersistTaps="handled"- >- <LinearGradient- colors={[colors.loginHeader, colors.background]}- style={styles.gradientContainer}- />- <View style={styles.mainContent}>- <View style={styles.headerSection}>- <View style={styles.logoContainer}>- <Logo width={80} height={80} />- <Text style={styles.appName}>{t('auth.unlockVault')}</Text>- </View>- </View>- <View style={styles.content}>- <View style={styles.avatarContainer}>- <Avatar />- <ThemedText style={styles.username}>{username}</ThemedText>- </View>- <ThemedText style={styles.subtitle}>{t('auth.enterPassword')}</ThemedText>-- {/* Error Message */}- {error && <ThemedText style={styles.errorText}>{error}</ThemedText>}-- <View style={styles.inputContainer}>- <MaterialIcons- name="lock"- size={20}- color={colors.textMuted}- style={styles.inputIcon}- />- <TextInput- style={styles.input}- placeholder={t('auth.enterPasswordPlaceholder')}- placeholderTextColor={colors.textMuted}- secureTextEntry={!showPassword}- value={password}- onChangeText={setPassword}- autoCapitalize="none"- autoCorrect={false}- multiline={false}- numberOfLines={1}- />- <Pressable- onPress={() => setShowPassword(!showPassword)}- style={styles.inputIcon}- >- <MaterialIcons- name={showPassword ? "visibility" : "visibility-off"}- size={20}- color={colors.textMuted}- />- </Pressable>- </View>-- <RobustPressable- style={styles.button}- onPress={handleUnlock}- disabled={isLoading}- >- <ThemedText style={styles.buttonText}>- {isLoading ? t('auth.unlocking') : t('auth.unlock')}- </ThemedText>- </RobustPressable>-- {isBiometricsAvailable && (- <RobustPressable- style={styles.faceIdButton}- onPress={handleUnlockRetry}- >- <ThemedText style={styles.faceIdButtonText}>{t('auth.tryBiometricAgain', { biometric: biometricDisplayName })}</ThemedText>- </RobustPressable>- )}-- {/* Use PIN Button */}- {pinAvailable && (- <RobustPressable- style={styles.faceIdButton}- onPress={handleUnlockRetry}- >- <ThemedText style={styles.faceIdButtonText}>{t('auth.tryPinAgain')}</ThemedText>- </RobustPressable>- )}- </View>+ <LinearGradient+ colors={[colors.loginHeader, colors.background]}+ style={styles.gradientContainer}+ />+ <View style={styles.mainContent}>+ <View style={styles.headerSection}>+ <View style={styles.logoContainer}>+ <Logo width={80} height={80} />+ <Text style={styles.appName}>{t('auth.unlockVault')}</Text>+ </View>+ </View>+ <View style={styles.content}>+ <View style={styles.avatarContainer}>+ <Avatar />+ <ThemedText style={styles.username}>{username}</ThemedText>+ </View>+ <ThemedText style={styles.subtitle}>{t('auth.enterPassword')}</ThemedText>++ {/* Error Message */}+ {error && <ThemedText style={styles.errorText}>{error}</ThemedText>}++ <View style={styles.inputContainer}>+ <MaterialIcons+ name="lock"+ size={20}+ color={colors.textMuted}+ style={styles.inputIcon}+ />+ <TextInput+ style={styles.input}+ placeholder={t('auth.enterPasswordPlaceholder')}+ placeholderTextColor={colors.textMuted}+ secureTextEntry={!showPassword}+ value={password}+ onChangeText={setPassword}+ autoCapitalize="none"+ autoCorrect={false}+ multiline={false}+ numberOfLines={1}+ testID="unlock-password-input"+ />+ <Pressable+ onPress={() => setShowPassword(!showPassword)}+ style={styles.inputIcon}+ >+ <MaterialIcons+ name={showPassword ? "visibility" : "visibility-off"}+ size={20}+ color={colors.textMuted}+ />+ </Pressable>+ </View>+ <RobustPressable+ style={styles.button}+ onPress={handleUnlock}+ disabled={isLoading}+ testID="unlock-button"+ >+ <ThemedText style={styles.buttonText}>+ {isLoading ? t('auth.unlocking') : t('auth.unlock')}+ </ThemedText>+ </RobustPressable>++ {isBiometricsAvailable && (<RobustPressable- style={styles.logoutButton}- onPress={handleLogout}+ style={styles.faceIdButton}+ onPress={handleUnlockRetry}>- <ThemedText style={styles.logoutButtonText}>{t('auth.logout')}</ThemedText>+ <ThemedText style={styles.faceIdButtonText}>{t('auth.tryBiometricAgain', { biometric: biometricDisplayName })}</ThemedText></RobustPressable>- </View>- </ScrollView>- </TouchableWithoutFeedback>- </KeyboardAvoidingView>+ )}++ {/* Use PIN Button */}+ {pinAvailable && (+ <RobustPressable+ style={styles.faceIdButton}+ onPress={handleUnlockRetry}+ >+ <ThemedText style={styles.faceIdButtonText}>{t('auth.tryPinAgain')}</ThemedText>+ </RobustPressable>+ )}+ </View>++ <RobustPressable+ style={styles.logoutButton}+ onPress={handleLogout}+ >+ <ThemedText style={styles.logoutButtonText}>{t('auth.logout')}</ThemedText>+ </RobustPressable>+ </View>+ </ScrollView>)}- </ThemedView>+ </KeyboardAvoidingView>);}\ No newline at end of file