Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add email load more button to mobile app and add missing translations (#990)

Leendert de Borst6178303418ea
diff --git a/apps/mobile-app/app/(tabs)/emails/[id].tsx b/apps/mobile-app/app/(tabs)/emails/[id].tsx
index e07a75920..2e5d6526e 100644
--- a/apps/mobile-app/app/(tabs)/emails/[id].tsx
+++ b/apps/mobile-app/app/(tabs)/emails/[id].tsx
@@ -234,6 +234,7 @@ export default function EmailDetailsScreen() : React.ReactNode {
},
metadataCredential: {
alignItems: 'center',
+ alignSelf: 'center',
flexDirection: 'row',
},
metadataCredentialIcon: {
@@ -271,6 +272,10 @@ export default function EmailDetailsScreen() : React.ReactNode {
paddingBottom: 0,
paddingTop: 0,
},
+ metadataSubject: {
+ textAlign: 'center',
+ fontWeight: 'bold',
+ },
metadataValue: {
flex: 1,
paddingBottom: 4,
@@ -343,7 +348,7 @@ export default function EmailDetailsScreen() : React.ReactNode {
if (isLoading) {
return (
<ThemedView style={styles.centerContainer}>
- <Stack.Screen options={{ title: t('emails.title') }} />
+ <Stack.Screen options={{ title: t('emails.emailDetails') }} />
<ActivityIndicator size="large" />
</ThemedView>
);
@@ -384,20 +389,20 @@ export default function EmailDetailsScreen() : React.ReactNode {
<TouchableOpacity onPress={() => setMetadataMaximized(!isMetadataMaximized)}>
<View style={styles.metadataContainer}>
<View style={styles.metadataRow}>
- <View style={styles.metadataLabel}>
- <ThemedText style={styles.metadataHeading}>{t('emails.subject')}</ThemedText>
- </View>
- <View style={styles.metadataValue}>
- <ThemedText style={styles.metadataText}>{email.subject}</ThemedText>
+ <View style={[styles.metadataValue, { flex: 1 }]}>
+ <ThemedText style={[styles.metadataText, styles.metadataSubject]}>{email.subject}</ThemedText>
{associatedCredential && (
- <>
- <TouchableOpacity onPress={handleOpenCredential} style={styles.metadataCredential}>
+ <View>
+ <TouchableOpacity
+ onPress={handleOpenCredential}
+ style={styles.metadataCredential}
+ >
<IconSymbol size={16} name={IconSymbolName.Key} color={colors.primary} style={styles.metadataCredentialIcon} />
<ThemedText style={[styles.metadataText, { color: colors.primary }]}>
{associatedCredential.ServiceName}
</ThemedText>
</TouchableOpacity>
- </>
+ </View>
)}
</View>
<View style={styles.metadataIcon}>
@@ -474,7 +479,7 @@ export default function EmailDetailsScreen() : React.ReactNode {
return (
<ThemedView style={styles.container}>
- <Stack.Screen options={{ title: t('emails.title') }} />
+ <Stack.Screen options={{ title: t('emails.emailDetails') }} />
{metadataView}
{emailView}
{email.attachments && email.attachments.length > 0 && (
diff --git a/apps/mobile-app/app/(tabs)/emails/index.tsx b/apps/mobile-app/app/(tabs)/emails/index.tsx
index 97e1c1a36..eca310da7 100644
--- a/apps/mobile-app/app/(tabs)/emails/index.tsx
+++ b/apps/mobile-app/app/(tabs)/emails/index.tsx
@@ -1,6 +1,7 @@
import * as Haptics from 'expo-haptics';
import { useNavigation } from 'expo-router';
import React, { useEffect, useState, useCallback, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
import { StyleSheet, View, ScrollView, RefreshControl, Animated , Platform } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Toast from 'react-native-toast-message';
@@ -26,6 +27,7 @@ import { useWebApi } from '@/context/WebApiContext';
* Emails screen.
*/
export default function EmailsScreen() : React.ReactNode {
+ const { t } = useTranslation();
const dbContext = useDb();
const webApi = useWebApi();
const authContext = useAuth();
@@ -81,15 +83,15 @@ export default function EmailsScreen() : React.ReactNode {
// Show toast and throw error
Toast.show({
type: 'error',
- text1: 'Failed to load emails',
+ text1: t('emails.errors.loadFailed'),
position: 'bottom',
});
- throw new Error('Failed to load emails');
+ throw new Error(t('emails.errors.loadFailed'));
} finally {
setIsLoading(false);
}
} catch (err) {
- setError(err instanceof Error ? err.message : 'An error occurred');
+ setError(err instanceof Error ? err.message : t('emails.errors.generic'));
}
}, [dbContext?.sqliteClient, webApi, setIsLoading, authContext.isOffline]);
@@ -190,7 +192,7 @@ export default function EmailsScreen() : React.ReactNode {
if (authContext.isOffline) {
return (
<View style={styles.centerContainer}>
- <ThemedText style={styles.emptyText}>You are offline. Please connect to the internet to load your emails.</ThemedText>
+ <ThemedText style={styles.emptyText}>{t('emails.offlineMessage')}</ThemedText>
</View>
);
}
@@ -198,7 +200,7 @@ export default function EmailsScreen() : React.ReactNode {
if (error) {
return (
<View style={styles.centerContainer}>
- <ThemedText style={styles.errorText}>Error: {error}</ThemedText>
+ <ThemedText style={styles.errorText}>{t('common.error')}: {error}</ThemedText>
</View>
);
}
@@ -207,7 +209,7 @@ export default function EmailsScreen() : React.ReactNode {
return (
<View style={styles.centerContainer}>
<ThemedText style={styles.emptyText}>
- You have not received any emails at your private email addresses yet. When you receive a new email, it will appear here.
+ {t('emails.emptyMessage')}
</ThemedText>
</View>
);
@@ -221,7 +223,7 @@ export default function EmailsScreen() : React.ReactNode {
return (
<ThemedContainer>
<CollapsibleHeader
- title="Emails"
+ title={t('emails.title')}
scrollY={scrollY}
showNavigationHeader={true}
/>
@@ -243,7 +245,7 @@ export default function EmailsScreen() : React.ReactNode {
/>
}
>
- <TitleContainer title="Emails" />
+ <TitleContainer title={t('emails.title')} />
{renderContent()}
</Animated.ScrollView>
</ThemedContainer>
diff --git a/apps/mobile-app/app/(tabs)/settings/ios-autofill.tsx b/apps/mobile-app/app/(tabs)/settings/ios-autofill.tsx
index c9fd1b77d..7515bf716 100644
--- a/apps/mobile-app/app/(tabs)/settings/ios-autofill.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/ios-autofill.tsx
@@ -1,4 +1,5 @@
import { router } from 'expo-router';
+import { useTranslation } from 'react-i18next';
import { StyleSheet, View, TouchableOpacity } from 'react-native';
import { useColors } from '@/hooks/useColorScheme';
@@ -14,6 +15,7 @@ import NativeVaultManager from '@/specs/NativeVaultManager';
*/
export default function IosAutofillScreen() : React.ReactNode {
const colors = useColors();
+ const { t } = useTranslation();
const { markAutofillConfigured, shouldShowAutofillReminder } = useAuth();
/**
@@ -96,13 +98,13 @@ export default function IosAutofillScreen() : React.ReactNode {
<ThemedContainer>
<ThemedScrollView>
<ThemedText style={styles.headerText}>
- You can configure AliasVault to provide native password autofill functionality in iOS. Follow the instructions below to enable it.
+ {t('settings.iosAutofillSettings.headerText')}
</ThemedText>
<View style={styles.instructionContainer}>
- <ThemedText style={styles.instructionTitle}>How to enable:</ThemedText>
+ <ThemedText style={styles.instructionTitle}>{t('settings.iosAutofillSettings.howToEnable')}</ThemedText>
<ThemedText style={styles.instructionStep}>
- 1. Open iOS Settings via the button below
+ {t('settings.iosAutofillSettings.step1')}
</ThemedText>
<View style={styles.buttonContainer}>
<TouchableOpacity
@@ -110,24 +112,24 @@ export default function IosAutofillScreen() : React.ReactNode {
onPress={handleConfigurePress}
>
<ThemedText style={styles.configureButtonText}>
- Open iOS Settings
+ {t('settings.iosAutofillSettings.openIosSettings')}
</ThemedText>
</TouchableOpacity>
</View>
<ThemedText style={styles.instructionStep}>
- 2. Go to &quot;General&quot;
+ {t('settings.iosAutofillSettings.step2')}
</ThemedText>
<ThemedText style={styles.instructionStep}>
- 3. Tap &quot;AutoFill & Passwords&quot;
+ {t('settings.iosAutofillSettings.step3')}
</ThemedText>
<ThemedText style={styles.instructionStep}>
- 4. Enable &quot;AliasVault&quot;
+ {t('settings.iosAutofillSettings.step4')}
</ThemedText>
<ThemedText style={styles.instructionStep}>
- 5. Disable other password providers (e.g. &quot;iCloud Passwords&quot;) to avoid conflicts
+ {t('settings.iosAutofillSettings.step5')}
</ThemedText>
<ThemedText style={styles.warningText}>
- Note: You&apos;ll need to authenticate with Face ID/Touch ID or your device passcode when using autofill.
+ {t('settings.iosAutofillSettings.warningText')}
</ThemedText>
<View style={styles.buttonContainer}>
{shouldShowAutofillReminder && (
@@ -136,7 +138,7 @@ export default function IosAutofillScreen() : React.ReactNode {
onPress={handleAlreadyConfigured}
>
<ThemedText style={styles.secondaryButtonText}>
- I already configured it
+ {t('settings.iosAutofillSettings.alreadyConfigured')}
</ThemedText>
</TouchableOpacity>
)}
diff --git a/apps/mobile-app/app/login.tsx b/apps/mobile-app/app/login.tsx
index 2416c6375..21a050db7 100644
--- a/apps/mobile-app/app/login.tsx
+++ b/apps/mobile-app/app/login.tsx
@@ -534,7 +534,7 @@ export default function LoginScreen() : React.ReactNode {
<View style={styles.headerContainer}>
<Text style={styles.headerTitle}>{t('auth.login')}</Text>
<Text style={styles.headerSubtitle}>
- Connecting to{' '}
+ {t('auth.connectingTo')} {' '}
<Text
style={styles.clickableLink}
onPress={() => router.push('/login-settings')}
@@ -654,10 +654,10 @@ export default function LoginScreen() : React.ReactNode {
)}
</TouchableOpacity>
<View style={styles.createNewVaultContainer}>
- <Text style={styles.textMuted}>No account yet? </Text>
+ <Text style={styles.textMuted}>{t('auth.noAccountYet')} </Text>
<InAppBrowserView
url="https://app.aliasvault.net/user/setup"
- title="Create new vault"
+ title={t('auth.createNewVault')}
textStyle={styles.clickableLink}
/>
</View>
diff --git a/apps/mobile-app/components/credentials/details/EmailPreview.tsx b/apps/mobile-app/components/credentials/details/EmailPreview.tsx
index d58bd9b7f..38579a659 100644
--- a/apps/mobile-app/components/credentials/details/EmailPreview.tsx
+++ b/apps/mobile-app/components/credentials/details/EmailPreview.tsx
@@ -3,6 +3,7 @@ import { router } from 'expo-router';
import React, { useState, useEffect, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { View, StyleSheet, TouchableOpacity, Linking, AppState } from 'react-native';
+import { MaterialIcons } from '@expo/vector-icons';
import { AppInfo } from '@/utils/AppInfo';
import type { ApiErrorResponse, MailboxEmail } from '@/utils/dist/shared/models/webapi';
@@ -26,18 +27,40 @@ type EmailPreviewProps = {
*/
export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.ReactNode => {
const [emails, setEmails] = useState<MailboxEmail[]>([]);
+ const [displayedEmails, setDisplayedEmails] = useState<MailboxEmail[]>([]);
const [loading, setLoading] = useState(true);
const [lastEmailId, setLastEmailId] = useState<number>(0);
const [isSpamOk, setIsSpamOk] = useState(false);
const [isComponentVisible, setIsComponentVisible] = useState(true);
const [error, setError] = useState<string | null>(null);
const [isSupportedDomain, setIsSupportedDomain] = useState(false);
+ const [displayedCount, setDisplayedCount] = useState(2);
const webApi = useWebApi();
const dbContext = useDb();
const authContext = useAuth();
const colors = useColors();
const { t } = useTranslation();
+ const emailsPerLoad = 3;
+ const canLoadMore = displayedCount < emails.length;
+
+ /**
+ * Updates the displayed emails based on the current count.
+ */
+ const updateDisplayedEmails = useCallback((allEmails: MailboxEmail[], count: number) => {
+ const displayed = allEmails.slice(0, count);
+ setDisplayedEmails(displayed);
+ }, []);
+
+ /**
+ * Loads more emails.
+ */
+ const loadMoreEmails = useCallback(() => {
+ const newCount = Math.min(displayedCount + emailsPerLoad, emails.length);
+ setDisplayedCount(newCount);
+ updateDisplayedEmails(emails, newCount);
+ }, [displayedCount, emails, emailsPerLoad, updateDisplayedEmails]);
+
/**
* Check if the email is a public domain.
*/
@@ -129,17 +152,17 @@ export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.Rea
const data = await response.json();
- // Only show the latest 2 emails to save space in UI
- const latestMails = data?.mails
+ // Store all emails, sorted by date
+ const allMails = data?.mails
?.sort((a: MailboxEmail, b: MailboxEmail) =>
- new Date(b.dateSystem).getTime() - new Date(a.dateSystem).getTime())
- ?.slice(0, 2) ?? [];
+ new Date(b.dateSystem).getTime() - new Date(a.dateSystem).getTime()) ?? [];
- if (loading && latestMails.length > 0) {
- setLastEmailId(latestMails[0].id);
+ if (loading && allMails.length > 0) {
+ setLastEmailId(allMails[0].id);
}
- setEmails(latestMails);
+ setEmails(allMails);
+ updateDisplayedEmails(allMails, displayedCount);
} else if (isPrivate) {
// For private domains, use existing encrypted email logic
if (!dbContext?.sqliteClient) {
@@ -155,15 +178,14 @@ export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.Rea
try {
const data = response as { mails: MailboxEmail[] };
- // Only show the latest 2 emails to save space in UI
- const latestMails = data.mails
- .sort((a, b) => new Date(b.dateSystem).getTime() - new Date(a.dateSystem).getTime())
- .slice(0, 2);
+ // Store all emails, sorted by date
+ const allMails = data.mails
+ .sort((a, b) => new Date(b.dateSystem).getTime() - new Date(a.dateSystem).getTime());
- if (latestMails) {
+ if (allMails) {
// Loop through all emails and decrypt them locally
const decryptedEmails = await EncryptionUtility.decryptEmailList(
- latestMails,
+ allMails,
encryptionKeys
);
@@ -172,6 +194,7 @@ export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.Rea
}
setEmails(decryptedEmails);
+ updateDisplayedEmails(decryptedEmails, displayedCount);
// Reset error
setError(null);
@@ -203,7 +226,7 @@ export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.Rea
clearInterval(interval);
}
};
- }, [email, loading, webApi, dbContext, isPublicDomain, isPrivateDomain, authContext.isOffline, isComponentVisible, t]);
+ }, [email, loading, webApi, dbContext, isPublicDomain, isPrivateDomain, authContext.isOffline, isComponentVisible, t, displayedCount, updateDisplayedEmails]);
const styles = StyleSheet.create({
date: {
@@ -254,6 +277,22 @@ export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.Rea
flexDirection: 'row',
gap: 8,
},
+ loadMoreButton: {
+ backgroundColor: colors.accentBackground,
+ borderRadius: 8,
+ marginTop: 8,
+ paddingHorizontal: 16,
+ paddingVertical: 10,
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'center',
+ gap: 6,
+ },
+ loadMoreText: {
+ color: colors.textMuted,
+ fontSize: 14,
+ fontWeight: '500',
+ },
});
// Sanity check: if no email is provided, don't render anything.
@@ -317,10 +356,10 @@ export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.Rea
return (
<ThemedView style={styles.section}>
<View style={styles.titleContainer}>
- <ThemedText type="title" style={styles.title}>Recent emails</ThemedText>
+ <ThemedText type="title" style={styles.title}>{t('credentials.recentEmails')}</ThemedText>
<PulseDot />
</View>
- {emails.map((mail) => (
+ {displayedEmails.map((mail) => (
<TouchableOpacity
key={mail.id}
style={[
@@ -344,6 +383,12 @@ export const EmailPreview: React.FC<EmailPreviewProps> = ({ email }) : React.Rea
</ThemedText>
</TouchableOpacity>
))}
+ {canLoadMore && (
+ <TouchableOpacity style={styles.loadMoreButton} onPress={loadMoreEmails}>
+ <ThemedText style={styles.loadMoreText}>{t('common.loadMore')}</ThemedText>
+ <MaterialIcons name="keyboard-arrow-down" size={16} color={colors.textMuted} />
+ </TouchableOpacity>
+ )}
</ThemedView>
);
};
\ No newline at end of file
diff --git a/apps/mobile-app/components/ui/UsernameDisplay.tsx b/apps/mobile-app/components/ui/UsernameDisplay.tsx
index f20b090ed..8b0d0fef5 100644
--- a/apps/mobile-app/components/ui/UsernameDisplay.tsx
+++ b/apps/mobile-app/components/ui/UsernameDisplay.tsx
@@ -1,3 +1,4 @@
+import { useTranslation } from 'react-i18next';
import { StyleSheet, View } from 'react-native';
import { useColors } from '@/hooks/useColorScheme';
@@ -11,6 +12,7 @@ import { Avatar } from './Avatar';
* Username display component that shows the avatar and "Logged in as" text.
*/
export function UsernameDisplay(): React.ReactNode {
+ const { t } = useTranslation();
const colors = useColors();
const { username } = useAuth();
@@ -31,7 +33,7 @@ export function UsernameDisplay(): React.ReactNode {
return (
<View style={styles.userInfoContainer}>
<Avatar />
- <ThemedText style={styles.usernameText}>Logged in as: {username}</ThemedText>
+ <ThemedText style={styles.usernameText}>{t('auth.loggedInAs')}: {username}</ThemedText>
</View>
);
}
diff --git a/apps/mobile-app/i18n/locales/en.json b/apps/mobile-app/i18n/locales/en.json
index 4c96ed434..d640f5f1e 100644
--- a/apps/mobile-app/i18n/locales/en.json
+++ b/apps/mobile-app/i18n/locales/en.json
@@ -11,7 +11,8 @@
"error": "Error",
"success": "Success",
"never": "Never",
- "copied": "Copied"
+ "copied": "Copied",
+ "loadMore": "Load more"
},
"auth": {
"login": "Log in",
@@ -44,7 +45,11 @@
"enterPassword": "Please enter your password",
"serverError": "Could not reach AliasVault server. Please try again later or contact support if the problem persists."
},
- "confirmLogout": "Are you sure you want to logout? You need to login again with your master password to access your vault."
+ "confirmLogout": "Are you sure you want to logout? You need to login again with your master password to access your vault.",
+ "noAccountYet": "No account yet?",
+ "createNewVault": "Create new vault",
+ "connectingTo": "Connecting to",
+ "loggedInAs": "Logged in as"
},
"credentials": {
"title": "Credentials",
@@ -101,6 +106,18 @@
"settings": {
"title": "Settings",
"iosAutofill": "iOS Autofill",
+ "iosAutofillSettings": {
+ "headerText": "You can configure AliasVault to provide native password autofill functionality in iOS. Follow the instructions below to enable it.",
+ "howToEnable": "How to enable:",
+ "step1": "1. Open iOS Settings via the button below",
+ "step2": "2. Go to \"General\"",
+ "step3": "3. Tap \"AutoFill & Passwords\"",
+ "step4": "4. Enable \"AliasVault\"",
+ "step5": "5. Disable other password providers (e.g. \"iCloud Passwords\") to avoid conflicts",
+ "openIosSettings": "Open iOS Settings",
+ "alreadyConfigured": "I already configured it",
+ "warningText": "Note: You'll need to authenticate with Face ID/Touch ID or your device passcode when using autofill."
+ },
"androidAutofill": "Android Autofill",
"vaultUnlock": "Vault Unlock Method",
"autoLock": "Auto-lock Timeout",
@@ -233,7 +250,8 @@
"settings": "Settings"
},
"emails": {
- "title": "Email Details",
+ "title": "Emails",
+ "emailDetails": "Email Details",
"subject": "Subject:",
"date": "Date:",
"from": "From:",
@@ -244,8 +262,11 @@
"emailNotFound": "Email not found",
"noPlainText": "This email does not contain any plain-text.",
"sizeKB": "KB",
+ "offlineMessage": "You are offline. Please connect to the internet to load your emails.",
+ "emptyMessage": "You have not received any emails at your private email addresses yet. When you receive a new email, it will appear here.",
"errors": {
"generic": "An error occurred",
+ "loadFailed": "Failed to load emails",
"deleteFailed": "Failed to delete email",
"dbNotAvailable": "Database context or email not available",
"decryptFailed": "Failed to decrypt attachment",