Skip to content

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

Add pull to refresh to email page (#771)

Leendert de Borst0eb7e74eb659
diff --git a/mobile-app/app/(tabs)/(credentials)/index.tsx b/mobile-app/app/(tabs)/(credentials)/index.tsx
index 47273f403..9a47925eb 100644
--- a/mobile-app/app/(tabs)/(credentials)/index.tsx
+++ b/mobile-app/app/(tabs)/(credentials)/index.tsx
@@ -143,11 +143,6 @@ export default function CredentialsScreen() {
);
});
- const handleCredentialPress = (credentialId: string) => {
- Keyboard.dismiss();
- navigateToCredential(credentialId);
- };
-
const styles = StyleSheet.create({
container: {
flex: 1,
diff --git a/mobile-app/app/(tabs)/(emails)/index.tsx b/mobile-app/app/(tabs)/(emails)/index.tsx
index da500024a..6366167fb 100644
--- a/mobile-app/app/(tabs)/(emails)/index.tsx
+++ b/mobile-app/app/(tabs)/(emails)/index.tsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState, useCallback } from 'react';
-import { StyleSheet, View, ActivityIndicator, ScrollView } from 'react-native';
-import { router, Stack } from 'expo-router';
+import { StyleSheet, View, ActivityIndicator, ScrollView, RefreshControl } from 'react-native';
+import { Stack } from 'expo-router';
import { MailboxEmail } from '@/utils/types/webapi/MailboxEmail';
import { useDb } from '@/context/DbContext';
import { useWebApi } from '@/context/WebApiContext';
@@ -92,29 +92,6 @@ export default function EmailsScreen() {
setIsRefreshing(false);
}, [loadEmails]);
- const formatEmailDate = (dateSystem: string): string => {
- const now = new Date();
- const emailDate = new Date(dateSystem);
- const secondsAgo = Math.floor((now.getTime() - emailDate.getTime()) / 1000);
-
- if (secondsAgo < 60) {
- return 'just now';
- } else if (secondsAgo < 3600) {
- const minutes = Math.floor(secondsAgo / 60);
- return `${minutes} ${minutes === 1 ? 'min' : 'mins'} ago`;
- } else if (secondsAgo < 86400) {
- const hours = Math.floor(secondsAgo / 3600);
- return `${hours} ${hours === 1 ? 'hr' : 'hrs'} ago`;
- } else if (secondsAgo < 172800) {
- return 'yesterday';
- } else {
- return emailDate.toLocaleDateString('en-GB', {
- day: '2-digit',
- month: '2-digit'
- });
- }
- };
-
const renderContent = () => {
if (isLoading) {
return (
@@ -188,16 +165,20 @@ export default function EmailsScreen() {
<ThemedSafeAreaView style={styles.container}>
<Stack.Screen options={{ title: "Emails" }} />
<ThemedView style={styles.content}>
- <ScrollView>
+ <ScrollView
+ refreshControl={
+ <RefreshControl
+ refreshing={isRefreshing}
+ onRefresh={onRefresh}
+ colors={[colors.primary]}
+ tintColor={colors.primary}
+ />
+ }
+ >
<TitleContainer title="Emails" />
{renderContent()}
</ScrollView>
- {isRefreshing && (
- <View style={styles.refreshIndicator}>
- <ActivityIndicator size="large" />
- </View>
- )}
- </ThemedView>
+ </ThemedView>
</ThemedSafeAreaView>
);
}
diff --git a/mobile-app/components/CredentialCard.tsx b/mobile-app/components/CredentialCard.tsx
index e357ec363..b2075619c 100644
--- a/mobile-app/components/CredentialCard.tsx
+++ b/mobile-app/components/CredentialCard.tsx
@@ -1,4 +1,4 @@
-import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
+import { StyleSheet, View, Text, TouchableOpacity, Keyboard } from 'react-native';
import { CredentialIcon } from './CredentialIcon';
import { useColors } from '@/hooks/useColorScheme';
import { Credential } from '@/utils/types/Credential';
@@ -70,7 +70,10 @@ export function CredentialCard({ credential }: CredentialCardProps) {
return (
<TouchableOpacity
style={styles.credentialCard}
- onPress={() => router.push(`/(tabs)/(credentials)/${credential.Id}`)}
+ onPress={() => {
+ Keyboard.dismiss();
+ router.push(`/(tabs)/(credentials)/${credential.Id}`);
+ }}
activeOpacity={0.7}
>
<View style={styles.credentialContent}>