Skip to content

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

Add iOS autofill tip to settings screen with simple state (#771)

Leendert de Borst65d3b1d94f56
diff --git a/mobile-app/app/(tabs)/(settings)/_layout.tsx b/mobile-app/app/(tabs)/(settings)/_layout.tsx
index eb707f359..a83ae0d83 100644
--- a/mobile-app/app/(tabs)/(settings)/_layout.tsx
+++ b/mobile-app/app/(tabs)/(settings)/_layout.tsx
@@ -12,6 +12,16 @@ export default function SettingsLayout() {
headerShown: false,
}}
/>
+ <Stack.Screen
+ name="ios-autofill"
+ options={{
+ title: 'iOS Autofill',
+ headerBackTitle: 'Settings',
+ headerStyle: {
+ backgroundColor: colors.headerBackground,
+ },
+ }}
+ />
<Stack.Screen
name="vault-unlock"
options={{
diff --git a/mobile-app/app/(tabs)/(settings)/index.tsx b/mobile-app/app/(tabs)/(settings)/index.tsx
index e91f1f506..67a046abf 100644
--- a/mobile-app/app/(tabs)/(settings)/index.tsx
+++ b/mobile-app/app/(tabs)/(settings)/index.tsx
@@ -1,4 +1,4 @@
-import { StyleSheet, View, ScrollView, TouchableOpacity, Image, Animated } from 'react-native';
+import { StyleSheet, View, ScrollView, TouchableOpacity, Image, Animated, Platform } from 'react-native';
import { ThemedText } from '@/components/ThemedText';
import { ThemedView } from '@/components/ThemedView';
import { useWebApi } from '@/context/WebApiContext';
@@ -15,12 +15,13 @@ import { useRef, useState, useEffect } from 'react';
export default function SettingsScreen() {
const webApi = useWebApi();
const colors = useColors();
- const { username, getAuthMethodDisplay } = useAuth();
+ const { username, getAuthMethodDisplay, shouldShowIosAutofillReminder } = useAuth();
const { getAutoLockTimeout } = useAuth();
const scrollY = useRef(new Animated.Value(0)).current;
const scrollViewRef = useRef<ScrollView>(null);
const [autoLockDisplay, setAutoLockDisplay] = useState<string>('');
const [authMethodDisplay, setAuthMethodDisplay] = useState<string>('');
+
useEffect(() => {
const loadAutoLockDisplay = async () => {
const autoLockTimeout = await getAutoLockTimeout();
@@ -60,6 +61,10 @@ export default function SettingsScreen() {
router.push('/(tabs)/(settings)/auto-lock');
};
+ const handleIosAutofillPress = () => {
+ router.push('/(tabs)/(settings)/ios-autofill');
+ };
+
const styles = StyleSheet.create({
container: {
flex: 1,
@@ -104,7 +109,7 @@ export default function SettingsScreen() {
separator: {
height: StyleSheet.hairlineWidth,
backgroundColor: colors.accentBorder,
- marginLeft: 52, // Icon width (24) + marginRight (12) + paddingHorizontal (16)
+ marginLeft: 52,
},
settingItemText: {
flex: 1,
@@ -116,6 +121,22 @@ export default function SettingsScreen() {
color: colors.textMuted,
marginRight: 8,
},
+ settingItemBadge: {
+ backgroundColor: colors.primary,
+ width: 16,
+ height: 16,
+ borderRadius: 8,
+ justifyContent: 'center',
+ alignItems: 'center',
+ marginRight: 8,
+ },
+ settingItemBadgeText: {
+ color: '#FFFFFF',
+ fontSize: 10,
+ fontWeight: '600',
+ textAlign: 'center',
+ lineHeight: 16,
+ },
userInfoContainer: {
flexDirection: 'row',
alignItems: 'center',
@@ -188,6 +209,27 @@ export default function SettingsScreen() {
</View>
<View style={styles.section}>
+ {Platform.OS === 'ios' && (
+ <>
+ <TouchableOpacity
+ style={styles.settingItem}
+ onPress={handleIosAutofillPress}
+ >
+ <View style={styles.settingItemIcon}>
+ <Ionicons name="key-outline" size={20} color={colors.text} />
+ </View>
+ <View style={[styles.settingItemContent]}>
+ <ThemedText style={styles.settingItemText}>iOS Autofill</ThemedText>
+ {shouldShowIosAutofillReminder && (
+ <View style={styles.settingItemBadge}>
+ <ThemedText style={styles.settingItemBadgeText}>1</ThemedText>
+ </View>
+ )}
+ </View>
+ </TouchableOpacity>
+ <View style={styles.separator} />
+ </>
+ )}
<TouchableOpacity
style={styles.settingItem}
onPress={handleVaultUnlockPress}
diff --git a/mobile-app/app/(tabs)/(settings)/ios-autofill.tsx b/mobile-app/app/(tabs)/(settings)/ios-autofill.tsx
new file mode 100644
index 000000000..66e20f0d0
--- /dev/null
+++ b/mobile-app/app/(tabs)/(settings)/ios-autofill.tsx
@@ -0,0 +1,156 @@
+import { StyleSheet, View, TouchableOpacity, ScrollView, Linking } from 'react-native';
+import { ThemedText } from '@/components/ThemedText';
+import { ThemedView } from '@/components/ThemedView';
+import { useColors } from '@/hooks/useColorScheme';
+import { useAuth } from '@/context/AuthContext';
+import { router } from 'expo-router';
+
+export default function IosAutofillScreen() {
+ const colors = useColors();
+ const { markIosAutofillConfigured, shouldShowIosAutofillReminder } = useAuth();
+
+ const handleConfigurePress = async () => {
+ await markIosAutofillConfigured();
+ await Linking.openURL('App-Prefs:root');
+ };
+
+ const handleAlreadyConfigured = async () => {
+ await markIosAutofillConfigured();
+ router.back();
+ };
+
+ const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ },
+ scrollView: {
+ flex: 1,
+ },
+ scrollContent: {
+ paddingBottom: 40,
+ },
+ header: {
+ padding: 16,
+ },
+ headerText: {
+ fontSize: 13,
+ color: colors.textMuted,
+ },
+ instructionContainer: {
+ padding: 16,
+ },
+ instructionTitle: {
+ fontSize: 17,
+ fontWeight: '600',
+ color: colors.text,
+ marginBottom: 8,
+ },
+ instructionStep: {
+ fontSize: 15,
+ color: colors.text,
+ marginBottom: 8,
+ lineHeight: 22,
+ },
+ warningText: {
+ fontSize: 15,
+ color: colors.textMuted,
+ fontStyle: 'italic',
+ marginTop: 8,
+ },
+ buttonContainer: {
+ padding: 16,
+ paddingBottom: 32,
+ },
+ configureButton: {
+ backgroundColor: colors.primary,
+ paddingVertical: 16,
+ borderRadius: 10,
+ alignItems: 'center',
+ },
+ configureButtonText: {
+ color: '#FFFFFF',
+ fontSize: 16,
+ fontWeight: '600',
+ },
+ noticeContainer: {
+ backgroundColor: colors.accentBackground,
+ padding: 16,
+ margin: 16,
+ borderRadius: 10,
+ },
+ noticeText: {
+ fontSize: 15,
+ color: colors.text,
+ textAlign: 'center',
+ },
+ secondaryButton: {
+ backgroundColor: colors.accentBackground,
+ paddingVertical: 16,
+ borderRadius: 10,
+ alignItems: 'center',
+ marginTop: 12,
+ },
+ secondaryButtonText: {
+ color: colors.text,
+ fontSize: 16,
+ fontWeight: '600',
+ },
+ });
+
+ return (
+ <ThemedView style={styles.container}>
+ <ScrollView
+ style={styles.scrollView}
+ contentContainerStyle={styles.scrollContent}
+ >
+ <View style={styles.header}>
+ <ThemedText style={styles.headerText}>
+ You can configure AliasVault to provide native password autofill functionality in iOS. Follow the instructions below to enable it.
+ </ThemedText>
+ </View>
+
+ <View style={styles.instructionContainer}>
+ <ThemedText style={styles.instructionTitle}>How to enable:</ThemedText>
+ <ThemedText style={styles.instructionStep}>
+ 1. Open iOS Settings via the button below
+ </ThemedText>
+ <ThemedText style={styles.instructionStep}>
+ 2. Go to "General"
+ </ThemedText>
+ <ThemedText style={styles.instructionStep}>
+ 3. Tap "AutoFill & Passwords"
+ </ThemedText>
+ <ThemedText style={styles.instructionStep}>
+ 4. Enable "AliasVault"
+ </ThemedText>
+ <ThemedText style={styles.instructionStep}>
+ 5. Disable other password providers (e.g. "iCloud Passwords") to avoid conflicts
+ </ThemedText>
+ <ThemedText style={styles.warningText}>
+ Note: You'll need to authenticate with Face ID/Touch ID or your device passcode when using autofill.
+ </ThemedText>
+ </View>
+ <View style={styles.buttonContainer}>
+ <TouchableOpacity
+ style={styles.configureButton}
+ onPress={handleConfigurePress}
+ >
+ <ThemedText style={styles.configureButtonText}>
+ Open Settings
+ </ThemedText>
+ </TouchableOpacity>
+ {shouldShowIosAutofillReminder && (
+ <TouchableOpacity
+ style={styles.secondaryButton}
+ onPress={handleAlreadyConfigured}
+ >
+ <ThemedText style={styles.secondaryButtonText}>
+ I already configured it
+ </ThemedText>
+ </TouchableOpacity>
+ )}
+ </View>
+ </ScrollView>
+ </ThemedView>
+ );
+}
\ No newline at end of file
diff --git a/mobile-app/app/(tabs)/_layout.tsx b/mobile-app/app/(tabs)/_layout.tsx
index e6246d841..32597f73a 100644
--- a/mobile-app/app/(tabs)/_layout.tsx
+++ b/mobile-app/app/(tabs)/_layout.tsx
@@ -1,6 +1,6 @@
import { Tabs, usePathname } from 'expo-router';
import React, { useEffect } from 'react';
-import { Platform } from 'react-native';
+import { Platform, View } from 'react-native';
import { router } from 'expo-router';
import { IconSymbol } from '@/components/ui/IconSymbol';
import TabBarBackground from '@/components/ui/TabBarBackground';
@@ -8,6 +8,7 @@ import { useColors } from '@/hooks/useColorScheme';
import { useAuth } from '@/context/AuthContext';
import { useDb } from '@/context/DbContext';
import emitter from '@/utils/EventEmitter';
+import { ThemedText } from '@/components/ThemedText';
export default function TabLayout() {
const colors = useColors();
@@ -73,7 +74,38 @@ export default function TabLayout() {
name="(settings)"
options={{
title: 'Settings',
- tabBarIcon: ({ color }) => <IconSymbol size={28} name="gear" color={color} />,
+ tabBarIcon: ({ color }) => (
+ <View style={{ position: 'relative' }}>
+ <IconSymbol size={28} name="gear" color={color} />
+ {Platform.OS === 'ios' && authContext.shouldShowIosAutofillReminder && (
+ <View
+ style={{
+ position: 'absolute',
+ top: -4,
+ right: -4,
+ backgroundColor: colors.primary,
+ borderRadius: 8,
+ width: 16,
+ height: 16,
+ justifyContent: 'center',
+ alignItems: 'center',
+ }}
+ >
+ <ThemedText
+ style={{
+ color: '#FFFFFF',
+ fontSize: 10,
+ fontWeight: '600',
+ textAlign: 'center',
+ lineHeight: 16,
+ }}
+ >
+ 1
+ </ThemedText>
+ </View>
+ )}
+ </View>
+ )
}}
/>
</Tabs>
diff --git a/mobile-app/context/AuthContext.tsx b/mobile-app/context/AuthContext.tsx
index 4af518171..13358db97 100644
--- a/mobile-app/context/AuthContext.tsx
+++ b/mobile-app/context/AuthContext.tsx
@@ -1,7 +1,7 @@
import React, { createContext, useContext, useState, useEffect, useMemo, useCallback, useRef } from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { useDb } from './DbContext';
-import { AppState } from 'react-native';
+import { AppState, Platform, Linking } from 'react-native';
import { router, usePathname } from 'expo-router';
import { NavigationContainerRef, ParamListBase } from '@react-navigation/native';
import * as LocalAuthentication from 'expo-local-authentication';
@@ -28,8 +28,13 @@ type AuthContextType = {
getAuthMethodDisplay: () => Promise<string>;
getAutoLockTimeout: () => Promise<number>;
setAutoLockTimeout: (timeout: number) => Promise<void>;
+ // iOS Autofill methods
+ shouldShowIosAutofillReminder: boolean;
+ markIosAutofillConfigured: () => Promise<void>;
}
+const IOS_AUTOFILL_CONFIGURED_KEY = 'ios_autofill_configured';
+
/**
* Auth context.
*/
@@ -43,6 +48,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
const [isInitialized, setIsInitialized] = useState(false);
const [username, setUsername] = useState<string | null>(null);
const [globalMessage, setGlobalMessage] = useState<string | null>(null);
+ const [shouldShowIosAutofillReminder, setShouldShowIosAutofillReminder] = useState(false);
const appState = useRef(AppState.currentState);
const dbContext = useDb();
const pathname = usePathname();
@@ -239,6 +245,33 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
};
}, [isVaultUnlocked]);
+ /**
+ * Load iOS Autofill state from storage
+ */
+ const loadIosAutofillState = useCallback(async () => {
+ if (Platform.OS !== 'ios') {
+ setShouldShowIosAutofillReminder(false);
+ return;
+ }
+
+ const configured = await AsyncStorage.getItem(IOS_AUTOFILL_CONFIGURED_KEY);
+ setShouldShowIosAutofillReminder(configured !== 'true');
+ }, []);
+
+ /**
+ * Mark iOS Autofill as configured
+ */
+ const markIosAutofillConfigured = useCallback(async () => {
+ const configured = await AsyncStorage.getItem(IOS_AUTOFILL_CONFIGURED_KEY);
+ await AsyncStorage.setItem(IOS_AUTOFILL_CONFIGURED_KEY, configured === 'true' ? 'false' : 'true');
+ setShouldShowIosAutofillReminder(configured !== 'true');
+ }, []);
+
+ // Load iOS Autofill state on mount
+ useEffect(() => {
+ loadIosAutofillState();
+ }, [loadIosAutofillState]);
+
const contextValue = useMemo(() => ({
isLoggedIn,
isInitialized,
@@ -255,7 +288,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
getAuthMethodDisplay,
getAutoLockTimeout,
setAutoLockTimeout,
- }), [isLoggedIn, isInitialized, username, globalMessage, getEnabledAuthMethods, setAuthTokens, login, logout, clearGlobalMessage, initializeAuth, setAuthMethods, getAuthMethodDisplay, isFaceIDEnabled, getAutoLockTimeout, setAutoLockTimeout]);
+ // iOS Autofill methods
+ shouldShowIosAutofillReminder,
+ markIosAutofillConfigured,
+ }), [isLoggedIn, isInitialized, username, globalMessage, getEnabledAuthMethods, setAuthTokens, login, logout, clearGlobalMessage, initializeAuth, setAuthMethods, getAuthMethodDisplay, isFaceIDEnabled, getAutoLockTimeout, setAutoLockTimeout, shouldShowIosAutofillReminder, markIosAutofillConfigured]);
return (
<AuthContext.Provider value={contextValue}>