import React from 'react'; import { View, Text, TouchableOpacity, StyleSheet, ScrollView, Switch, Alert } from 'react-native'; import { useTheme } from '@react-navigation/native'; import { useRouter, Stack } from 'expo-router'; import { Ionicons } from '@expo/vector-icons'; import { useAuth } from '~/context/AuthProvider'; import { useAppTheme } from '~/theme/ThemeProvider'; import { useEmailsStore } from '~/store/emailsStore'; export default function SettingsScreen() { const { colors } = useTheme(); const router = useRouter(); const { signOut } = useAuth(); const { isDarkMode, themeMode, setThemeMode, toggleTheme } = useAppTheme(); const { accounts } = useEmailsStore(); const handleLogout = async () => { Alert.alert('Sign Out', 'Are you sure you want to sign out?', [ { text: 'Cancel', style: 'cancel' }, { text: 'Sign Out', style: 'destructive', onPress: async () => { await signOut(); router.replace('/auth/login'); }, }, ]); }; return ( {/* Accounts Section */} EMAIL ACCOUNTS {accounts.map((account) => ( router.push('/accounts')} > {account.name} {account.email} {account.isDefault && ( Default )} ))} router.push('/accounts')} > Add Account {/* Appearance Section */} APPEARANCE Dark Mode { Alert.alert('Theme Mode', 'Choose theme mode', [ { text: 'Light', onPress: () => setThemeMode('light') }, { text: 'Dark', onPress: () => setThemeMode('dark') }, { text: 'System', onPress: () => setThemeMode('system') }, { text: 'Cancel', style: 'cancel' }, ]); }} > Theme Mode {themeMode.charAt(0).toUpperCase() + themeMode.slice(1)} {/* About Section */} ABOUT Version 1.0.0 {/* Sign Out */} Sign Out ); } const styles = StyleSheet.create({ container: { flex: 1, }, section: { marginTop: 24, }, sectionTitle: { fontSize: 12, fontWeight: '600', paddingHorizontal: 16, marginBottom: 8, }, item: { flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, paddingVertical: 12, borderBottomWidth: StyleSheet.hairlineWidth, borderBottomColor: 'rgba(128, 128, 128, 0.2)', }, iconContainer: { width: 36, height: 36, borderRadius: 8, justifyContent: 'center', alignItems: 'center', marginRight: 12, }, itemContent: { flex: 1, }, itemTitle: { fontSize: 16, }, itemSubtitle: { fontSize: 13, marginTop: 2, }, defaultBadge: { paddingHorizontal: 8, paddingVertical: 2, borderRadius: 4, marginRight: 8, }, defaultBadgeText: { fontSize: 12, fontWeight: '500', }, dangerItem: { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: 'rgba(128, 128, 128, 0.2)', }, });