Skip to content

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

Add toast on vault unlock biometric enable (#771)

Leendert de Borst8bc1a49602c7
diff --git a/apps/mobile-app/app/(tabs)/settings/index.tsx b/apps/mobile-app/app/(tabs)/settings/index.tsx
index ae1da4c81..5aaba1ca4 100644
--- a/apps/mobile-app/app/(tabs)/settings/index.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/index.tsx
@@ -1,7 +1,7 @@
import { StyleSheet, View, ScrollView, TouchableOpacity, Image, Animated, Platform } from 'react-native';
-import { router } from 'expo-router';
+import { router, useFocusEffect } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
-import { useRef, useState, useEffect } from 'react';
+import { useRef, useState, useEffect, useCallback } from 'react';
import { ThemedText } from '@/components/themed/ThemedText';
import { ThemedView } from '@/components/themed/ThemedView';
@@ -27,46 +27,48 @@ export default function SettingsScreen() : React.ReactNode {
const [autoLockDisplay, setAutoLockDisplay] = useState<string>('');
const [authMethodDisplay, setAuthMethodDisplay] = useState<string>('');
- useEffect(() => {
- /**
- * Load the auto-lock display.
- */
- const loadAutoLockDisplay = async () : Promise<void> => {
- const autoLockTimeout = await getAutoLockTimeout();
- let display = 'Never';
+ useFocusEffect(
+ useCallback(() => {
+ /**
+ * Load the auto-lock display.
+ */
+ const loadAutoLockDisplay = async () : Promise<void> => {
+ const autoLockTimeout = await getAutoLockTimeout();
+ let display = 'Never';
- if (autoLockTimeout === 5) {
- display = '5 seconds';
- } else if (autoLockTimeout === 30) {
- display = '30 seconds';
- } else if (autoLockTimeout === 60) {
- display = '1 minute';
- } else if (autoLockTimeout === 900) {
- display = '15 minutes';
- } else if (autoLockTimeout === 1800) {
- display = '30 minutes';
- } else if (autoLockTimeout === 3600) {
- display = '1 hour';
- } else if (autoLockTimeout === 14400) {
- display = '4 hours';
- } else if (autoLockTimeout === 28800) {
- display = '8 hours';
- }
+ if (autoLockTimeout === 5) {
+ display = '5 seconds';
+ } else if (autoLockTimeout === 30) {
+ display = '30 seconds';
+ } else if (autoLockTimeout === 60) {
+ display = '1 minute';
+ } else if (autoLockTimeout === 900) {
+ display = '15 minutes';
+ } else if (autoLockTimeout === 1800) {
+ display = '30 minutes';
+ } else if (autoLockTimeout === 3600) {
+ display = '1 hour';
+ } else if (autoLockTimeout === 14400) {
+ display = '4 hours';
+ } else if (autoLockTimeout === 28800) {
+ display = '8 hours';
+ }
- setAutoLockDisplay(display);
- };
+ setAutoLockDisplay(display);
+ };
- /**
- * Load the auth method display.
- */
- const loadAuthMethodDisplay = async () : Promise<void> => {
- const authMethod = await getAuthMethodDisplay();
- setAuthMethodDisplay(authMethod);
- };
+ /**
+ * Load the auth method display.
+ */
+ const loadAuthMethodDisplay = async () : Promise<void> => {
+ const authMethod = await getAuthMethodDisplay();
+ setAuthMethodDisplay(authMethod);
+ };
- loadAutoLockDisplay();
- loadAuthMethodDisplay();
- }, [getAutoLockTimeout, getAuthMethodDisplay, getBiometricDisplayName]);
+ loadAutoLockDisplay();
+ loadAuthMethodDisplay();
+ }, [getAutoLockTimeout, getAuthMethodDisplay])
+ );
/**
* Handle the logout.
diff --git a/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx b/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx
index 18e4f2eb1..be39539eb 100644
--- a/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx
+++ b/apps/mobile-app/app/(tabs)/settings/vault-unlock.tsx
@@ -1,6 +1,7 @@
import { StyleSheet, View, Alert, Platform, Linking, Switch, TouchableOpacity } from 'react-native';
import * as LocalAuthentication from 'expo-local-authentication';
import { useState, useEffect, useCallback } from 'react';
+import Toast from 'react-native-toast-message';
import { ThemedText } from '@/components/themed/ThemedText';
import { ThemedSafeAreaView } from '@/components/themed/ThemedSafeAreaView';
@@ -105,6 +106,16 @@ export default function VaultUnlockSettingsScreen() : React.ReactNode {
setIsFaceIDEnabled(value);
setAuthMethods(value ? ['faceid', 'password'] : ['password']);
+
+ // Show toast notification only on Face ID enabled
+ if (value) {
+ Toast.show({
+ type: 'success',
+ text1: 'Face ID is now successfully enabled',
+ position: 'bottom',
+ visibilityTime: 1200,
+ });
+ }
}, [hasFaceID, setAuthMethods]);
const styles = StyleSheet.create({