The minimalistic document archiving platform.
feat(mobile): add app settings and language selection (#1477)
Corentin Thomasset759f21a2774b
diff --git a/apps/mobile/app/(app)/(with-organizations)/(tabs)/_layout.tsx b/apps/mobile/app/(app)/(with-organizations)/(tabs)/_layout.tsxindex 56a7401b..d8f96993 100644--- a/apps/mobile/app/(app)/(with-organizations)/(tabs)/_layout.tsx+++ b/apps/mobile/app/(app)/(with-organizations)/(tabs)/_layout.tsx@@ -2,6 +2,7 @@ import { Tabs } from 'expo-router';import React from 'react';import { useSafeAreaInsets } from 'react-native-safe-area-context';+import { useAppTranslations } from '@/modules/i18n/hooks/use-app-translations';import { HapticTab } from '@/modules/ui/components/haptic-tab';import { Icon } from '@/modules/ui/components/icon';import { ImportTabButton } from '@/modules/ui/components/import-tab-button';@@ -10,6 +11,7 @@ import { useThemeColor } from '@/modules/ui/providers/use-theme-color';export default function TabLayout() {const colors = useThemeColor();const insets = useSafeAreaInsets();+ const t = useAppTranslations();return (<Tabs@@ -57,7 +59,7 @@ export default function TabLayout() {<Tabs.Screenname="settings"options={{- title: 'Settings',+ title: t.settings.title,tabBarIcon: ({ color }) => (<Icon name="settings" size={30} color={color} style={{ height: 30 }} />),diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsxindex 5f0aaaad..bbb268db 100644--- a/apps/mobile/app/_layout.tsx+++ b/apps/mobile/app/_layout.tsx@@ -37,6 +37,10 @@ function LocalizedLayout() {<Stack.Screen name="index" options={{ headerShown: false }} /><Stack.Screen name="config/server-selection" options={{ headerShown: false }} /><Stack.Screen name="(app)" options={{ headerShown: false }} />+ <Stack.Screen+ name="app-settings"+ options={{ presentation: 'modal', headerShown: false }}+ /><Stack.Screen name="modal" options={{ presentation: 'modal', title: 'Modal' }} /></Stack><ShareIntentHandler />diff --git a/apps/mobile/app/app-settings.tsx b/apps/mobile/app/app-settings.tsxnew file mode 100644index 00000000..674939b0--- /dev/null+++ b/apps/mobile/app/app-settings.tsx@@ -0,0 +1,3 @@+import { AppSettingsScreen } from '@/modules/app-settings/screens/app-settings.screen';++export default AppSettingsScreen;diff --git a/apps/mobile/src/modules/app-settings/components/app-settings-button.tsx b/apps/mobile/src/modules/app-settings/components/app-settings-button.tsxnew file mode 100644index 00000000..67c6d2ac--- /dev/null+++ b/apps/mobile/src/modules/app-settings/components/app-settings-button.tsx@@ -0,0 +1,47 @@+import type { ThemeColors } from '@/modules/ui/theme.constants';+import { useRouter } from 'expo-router';+import { Keyboard, StyleSheet, TouchableOpacity } from 'react-native';+import { useAppTranslations } from '@/modules/i18n/hooks/use-app-translations';+import { Icon } from '@/modules/ui/components/icon';+import { useThemeColor } from '@/modules/ui/providers/use-theme-color';++export function AppSettingsButton({ disabled = false }: { disabled?: boolean }) {+ const router = useRouter();+ const themeColors = useThemeColor();+ const t = useAppTranslations();+ const styles = createStyles({ themeColors });++ return (+ <TouchableOpacity+ style={[styles.button, disabled && styles.buttonDisabled]}+ onPress={() => {+ Keyboard.dismiss();+ router.push('/app-settings');+ }}+ disabled={disabled}+ accessibilityRole="button"+ accessibilityLabel={t.appSettings.title}+ accessibilityState={{ disabled }}+ >+ <Icon name="settings" size={20} color={themeColors.mutedForeground} />+ </TouchableOpacity>+ );+}++function createStyles({ themeColors }: { themeColors: ThemeColors }) {+ return StyleSheet.create({+ button: {+ width: 44,+ height: 44,+ alignItems: 'center',+ justifyContent: 'center',+ backgroundColor: themeColors.secondaryBackground,+ borderRadius: 8,+ borderWidth: 1,+ borderColor: themeColors.border,+ },+ buttonDisabled: {+ opacity: 0.5,+ },+ });+}diff --git a/apps/mobile/src/modules/app-settings/screens/app-settings.screen.tsx b/apps/mobile/src/modules/app-settings/screens/app-settings.screen.tsxnew file mode 100644index 00000000..c8993eda--- /dev/null+++ b/apps/mobile/src/modules/app-settings/screens/app-settings.screen.tsx@@ -0,0 +1,200 @@+import type { LocalePreference } from '@/modules/i18n/i18n.local-storage';+import type { ThemeColors } from '@/modules/ui/theme.constants';+import { useRouter } from 'expo-router';+import { useRef, useState } from 'react';+import {+ ActivityIndicator,+ ScrollView,+ StyleSheet,+ Text,+ TouchableOpacity,+ View,+} from 'react-native';+import { SafeAreaView } from 'react-native-safe-area-context';+import { useAppTranslations } from '@/modules/i18n/hooks/use-app-translations';+import { useLocale } from '@/modules/i18n/hooks/use-locale';+import { LOCALE_KEYS, locales } from '@/modules/i18n/locales';+import { Icon } from '@/modules/ui/components/icon';+import { useAlert } from '@/modules/ui/providers/alert-provider';+import { useThemeColor } from '@/modules/ui/providers/use-theme-color';++export function AppSettingsScreen() {+ const router = useRouter();+ const themeColors = useThemeColor();+ const t = useAppTranslations();+ const { localePreference, setLocalePreference } = useLocale();+ const { showAlert } = useAlert();+ const [isSaving, setIsSaving] = useState(false);+ const isSaveInProgress = useRef(false);+ const styles = createStyles({ themeColors });++ const languageOptions: { value: LocalePreference; label: string }[] = [+ { value: null, label: t.appSettings.language.useDeviceLanguage },+ ...LOCALE_KEYS.map((value) => ({ value, label: locales[value].name })),+ ];++ const handleLanguageChange = async (preference: LocalePreference) => {+ if (isSaveInProgress.current || preference === localePreference) {+ return;+ }++ isSaveInProgress.current = true;+ setIsSaving(true);++ try {+ await setLocalePreference(preference);+ } catch {+ showAlert({+ title: t.appSettings.errors.saveFailed.title,+ message: t.appSettings.errors.saveFailed.message,+ buttons: [{ text: t.common.ok }],+ });+ } finally {+ isSaveInProgress.current = false;+ setIsSaving(false);+ }+ };++ const handleClose = () => {+ if (router.canGoBack()) {+ router.back();+ } else {+ router.replace('/');+ }+ };++ return (+ <SafeAreaView style={styles.container}>+ <View style={styles.header}>+ <Text style={styles.title} accessibilityRole="header">+ {t.appSettings.title}+ </Text>+ <TouchableOpacity+ style={styles.closeButton}+ onPress={handleClose}+ accessibilityRole="button"+ accessibilityLabel={t.common.close}+ >+ <Icon name="x" size={24} color={themeColors.foreground} />+ </TouchableOpacity>+ </View>++ <ScrollView contentContainerStyle={styles.content}>+ <View style={styles.sectionHeader}>+ <Text style={styles.sectionTitle} accessibilityRole="header">+ {t.appSettings.language.title}+ </Text>+ {isSaving && <ActivityIndicator size="small" color={themeColors.primary} />}+ </View>+ <Text style={styles.description}>{t.appSettings.language.description}</Text>++ <View+ style={styles.languageOptions}+ accessibilityRole="radiogroup"+ accessibilityLabel={t.appSettings.language.title}+ accessibilityState={{ busy: isSaving }}+ >+ {languageOptions.map(({ value, label }) => {+ const isSelected = localePreference === value;++ return (+ <TouchableOpacity+ key={value ?? 'system'}+ style={[+ styles.languageOption,+ isSelected && styles.languageOptionSelected,+ isSaving && styles.languageOptionDisabled,+ ]}+ onPress={async () => handleLanguageChange(value)}+ disabled={isSaving}+ accessibilityRole="radio"+ accessibilityLabel={label}+ accessibilityState={{ checked: isSelected, disabled: isSaving }}+ >+ <Text style={styles.languageLabel}>{label}</Text>+ {isSelected && <Icon name="check" size={20} color={themeColors.primary} />}+ </TouchableOpacity>+ );+ })}+ </View>+ </ScrollView>+ </SafeAreaView>+ );+}++function createStyles({ themeColors }: { themeColors: ThemeColors }) {+ return StyleSheet.create({+ container: {+ flex: 1,+ backgroundColor: themeColors.background,+ },+ header: {+ flexDirection: 'row',+ alignItems: 'center',+ gap: 16,+ paddingHorizontal: 24,+ paddingTop: 16,+ paddingBottom: 24,+ },+ title: {+ flex: 1,+ fontSize: 28,+ fontWeight: 'bold',+ color: themeColors.foreground,+ },+ closeButton: {+ width: 44,+ height: 44,+ alignItems: 'center',+ justifyContent: 'center',+ borderRadius: 8,+ backgroundColor: themeColors.secondaryBackground,+ },+ content: {+ paddingHorizontal: 24,+ paddingBottom: 24,+ },+ sectionHeader: {+ flexDirection: 'row',+ alignItems: 'center',+ gap: 12,+ marginBottom: 8,+ },+ sectionTitle: {+ fontSize: 18,+ fontWeight: '600',+ color: themeColors.foreground,+ },+ description: {+ fontSize: 14,+ color: themeColors.mutedForeground,+ marginBottom: 20,+ },+ languageOptions: {+ gap: 8,+ },+ languageOption: {+ minHeight: 56,+ flexDirection: 'row',+ alignItems: 'center',+ gap: 12,+ paddingVertical: 14,+ paddingHorizontal: 16,+ borderRadius: 8,+ borderWidth: 2,+ borderColor: themeColors.border,+ backgroundColor: themeColors.secondaryBackground,+ },+ languageOptionSelected: {+ borderColor: themeColors.primary,+ },+ languageOptionDisabled: {+ opacity: 0.5,+ },+ languageLabel: {+ flex: 1,+ fontSize: 16,+ color: themeColors.foreground,+ },+ });+}diff --git a/apps/mobile/src/modules/auth/components/auth-navigation.tsx b/apps/mobile/src/modules/auth/components/auth-navigation.tsxnew file mode 100644index 00000000..ab89e412--- /dev/null+++ b/apps/mobile/src/modules/auth/components/auth-navigation.tsx@@ -0,0 +1,22 @@+import { StyleSheet, View } from 'react-native';+import { AppSettingsButton } from '@/modules/app-settings/components/app-settings-button';+import { BackToServerSelectionButton } from './back-to-server-selection';++export function AuthNavigation({ disabled = false }: { disabled?: boolean }) {+ return (+ <View style={styles.navigation}>+ <BackToServerSelectionButton disabled={disabled} />+ <AppSettingsButton disabled={disabled} />+ </View>+ );+}++const styles = StyleSheet.create({+ navigation: {+ flexDirection: 'row',+ alignItems: 'center',+ justifyContent: 'space-between',+ gap: 16,+ marginBottom: 16,+ },+});diff --git a/apps/mobile/src/modules/auth/components/back-to-server-selection.tsx b/apps/mobile/src/modules/auth/components/back-to-server-selection.tsxindex 4dd929fa..6e9fae36 100644--- a/apps/mobile/src/modules/auth/components/back-to-server-selection.tsx+++ b/apps/mobile/src/modules/auth/components/back-to-server-selection.tsx@@ -1,20 +1,25 @@import type { ThemeColors } from '@/modules/ui/theme.constants';import { router } from 'expo-router';import { StyleSheet, Text, TouchableOpacity } from 'react-native';+import { useAppTranslations } from '@/modules/i18n/hooks/use-app-translations';import { Icon } from '@/modules/ui/components/icon';import { useThemeColor } from '@/modules/ui/providers/use-theme-color';-export function BackToServerSelectionButton() {+export function BackToServerSelectionButton({ disabled = false }: { disabled?: boolean }) {const themeColors = useThemeColor();+ const t = useAppTranslations();const styles = createStyles({ themeColors });return (<TouchableOpacity- style={styles.backToServerButton}+ style={[styles.backToServerButton, disabled && styles.buttonDisabled]}onPress={() => router.push('/config/server-selection')}+ disabled={disabled}+ accessibilityRole="button"+ accessibilityState={{ disabled }}><Icon name="arrow-left" size={20} color={themeColors.mutedForeground} />- <Text style={styles.backToServerText}>Select server</Text>+ <Text style={styles.backToServerText}>{t.serverSelection.selectServer}</Text></TouchableOpacity>);}@@ -22,8 +27,8 @@ export function BackToServerSelectionButton() {function createStyles({ themeColors }: { themeColors: ThemeColors }) {return StyleSheet.create({backToServerButton: {- marginBottom: 16,- alignSelf: 'flex-start',+ flexShrink: 1,+ minHeight: 44,flexDirection: 'row',alignItems: 'center',gap: 6,@@ -34,7 +39,11 @@ function createStyles({ themeColors }: { themeColors: ThemeColors }) {borderWidth: 1,borderColor: themeColors.border,},+ buttonDisabled: {+ opacity: 0.5,+ },backToServerText: {+ flexShrink: 1,color: themeColors.mutedForeground,fontSize: 16,},diff --git a/apps/mobile/src/modules/auth/screens/login.screen.tsx b/apps/mobile/src/modules/auth/screens/login.screen.tsxindex 86625f32..30bc5d27 100644--- a/apps/mobile/src/modules/auth/screens/login.screen.tsx+++ b/apps/mobile/src/modules/auth/screens/login.screen.tsx@@ -20,7 +20,7 @@ import { useAlert } from '@/modules/ui/providers/alert-provider';import { useThemeColor } from '@/modules/ui/providers/use-theme-color';import { useServerConfig } from '../../config/hooks/use-server-config';import { getEnabledOAuthProviders } from '../auth.models';-import { BackToServerSelectionButton } from '../components/back-to-server-selection';+import { AuthNavigation } from '../components/auth-navigation';import { TwoFactorVerificationForm } from '../components/two-factor-verification';const loginSchema = v.object({@@ -105,8 +105,13 @@ export function LoginScreen() {if (isConfigLoading) {return (- <View style={[styles.container, styles.centerContent]}>- <ActivityIndicator size="large" color={themeColors.primary} />+ <View style={[styles.container, { paddingTop: insets.top }]}>+ <ScrollView contentContainerStyle={styles.scrollContent}>+ <AuthNavigation />+ <View style={styles.centerContent}>+ <ActivityIndicator size="large" color={themeColors.primary} />+ </View>+ </ScrollView></View>);}@@ -141,7 +146,7 @@ export function LoginScreen() {behavior={Platform.OS === 'ios' ? 'padding' : 'height'}><ScrollView contentContainerStyle={styles.scrollContent} keyboardShouldPersistTaps="handled">- <BackToServerSelectionButton />+ <AuthNavigation disabled={isSubmitting} /><View style={styles.header}><Text style={styles.title}>Welcome Back</Text>@@ -245,6 +250,7 @@ function createStyles({ themeColors }: { themeColors: ThemeColors }) {backgroundColor: themeColors.background,},centerContent: {+ flex: 1,justifyContent: 'center',alignItems: 'center',},diff --git a/apps/mobile/src/modules/auth/screens/signup.screen.tsx b/apps/mobile/src/modules/auth/screens/signup.screen.tsxindex 7749d8db..d5ec14d8 100644--- a/apps/mobile/src/modules/auth/screens/signup.screen.tsx+++ b/apps/mobile/src/modules/auth/screens/signup.screen.tsx@@ -19,7 +19,7 @@ import { useAuthClient } from '@/modules/api/providers/api.provider';import { useAlert } from '@/modules/ui/providers/alert-provider';import { useThemeColor } from '@/modules/ui/providers/use-theme-color';import { useServerConfig } from '../../config/hooks/use-server-config';-import { BackToServerSelectionButton } from '../components/back-to-server-selection';+import { AuthNavigation } from '../components/auth-navigation';const signupSchema = v.object({name: v.pipe(v.string(), v.minLength(1, 'Name is required')),@@ -84,19 +84,29 @@ export function SignupScreen() {if (isConfigLoading) {return (- <View style={[styles.container, styles.centerContent]}>- <ActivityIndicator size="large" color={themeColors.primary} />+ <View style={[styles.container, { paddingTop: insets.top }]}>+ <ScrollView contentContainerStyle={styles.scrollContent}>+ <AuthNavigation />+ <View style={styles.centerContent}>+ <ActivityIndicator size="large" color={themeColors.primary} />+ </View>+ </ScrollView></View>);}if (!isRegistrationEnabled) {return (- <View style={[styles.container, styles.centerContent]}>- <Text style={styles.errorText}>Registration is currently disabled</Text>- <TouchableOpacity style={styles.linkButton} onPress={() => router.back()}>- <Text style={styles.linkText}>Go back to login</Text>- </TouchableOpacity>+ <View style={[styles.container, { paddingTop: insets.top }]}>+ <ScrollView contentContainerStyle={styles.scrollContent}>+ <AuthNavigation />+ <View style={styles.centerContent}>+ <Text style={styles.errorText}>Registration is currently disabled</Text>+ <TouchableOpacity style={styles.linkButton} onPress={() => router.back()}>+ <Text style={styles.linkText}>Go back to login</Text>+ </TouchableOpacity>+ </View>+ </ScrollView></View>);}@@ -107,7 +117,7 @@ export function SignupScreen() {behavior={Platform.OS === 'ios' ? 'padding' : 'height'}><ScrollView contentContainerStyle={styles.scrollContent} keyboardShouldPersistTaps="handled">- <BackToServerSelectionButton />+ <AuthNavigation disabled={isSubmitting} /><View style={styles.header}><Text style={styles.title}>Create Account</Text>@@ -199,6 +209,7 @@ function createStyles({ themeColors }: { themeColors: ThemeColors }) {backgroundColor: themeColors.background,},centerContent: {+ flex: 1,justifyContent: 'center',alignItems: 'center',padding: 24,diff --git a/apps/mobile/src/modules/config/screens/server-selection.screen.tsx b/apps/mobile/src/modules/config/screens/server-selection.screen.tsxindex 951b52b5..8887b72d 100644--- a/apps/mobile/src/modules/config/screens/server-selection.screen.tsx+++ b/apps/mobile/src/modules/config/screens/server-selection.screen.tsx@@ -16,6 +16,7 @@ import {} from 'react-native';import { useSafeAreaInsets } from 'react-native-safe-area-context';import { queryClient } from '@/modules/api/providers/query.provider';+import { AppSettingsButton } from '@/modules/app-settings/components/app-settings-button';import { useAppTranslations } from '@/modules/i18n/hooks/use-app-translations';import { Icon } from '@/modules/ui/components/icon';import { useAlert } from '@/modules/ui/providers/alert-provider';@@ -139,6 +140,7 @@ export function ServerSelectionScreen() {<View style={styles.brandRow}><Icon name="file-text" size={28} color={themeColors.primary} /><Text style={styles.brandName}>{t.papra}</Text>+ <AppSettingsButton disabled={isValidating} /></View><Text style={styles.title}>{t.serverSelection.title}</Text>@@ -313,6 +315,7 @@ function createStyles({ themeColors }: { themeColors: ThemeColors }) {marginBottom: 48,},brandName: {+ flex: 1,fontSize: 24,fontWeight: 'bold',color: themeColors.foreground,diff --git a/apps/mobile/src/modules/documents/components/share-intent-handler.tsx b/apps/mobile/src/modules/documents/components/share-intent-handler.tsxindex 198bf4d1..eb1d642a 100644--- a/apps/mobile/src/modules/documents/components/share-intent-handler.tsx+++ b/apps/mobile/src/modules/documents/components/share-intent-handler.tsx@@ -2,13 +2,7 @@ import { usePathname, useRouter } from 'expo-router';import { useShareIntentContext } from 'expo-share-intent';import { useEffect } from 'react';-// While the user is on one of these screens, a pending share intent is kept-// on hold instead of redirecting: they first need to select a server, sign in,-// or create their first organization. Once they land back on a regular app-// screen, the pending share resumes.-const holdPathPrefixes = ['/auth', '/config', '/organizations/create'];--const sharePath = '/share';+import { shouldRedirectShareIntent } from '../share-intent.models';export function ShareIntentHandler() {const router = useRouter();@@ -16,11 +10,7 @@ export function ShareIntentHandler() {const { hasShareIntent } = useShareIntentContext();useEffect(() => {- if (!hasShareIntent) {- return;- }-- if (pathname === sharePath || holdPathPrefixes.some((prefix) => pathname.startsWith(prefix))) {+ if (!shouldRedirectShareIntent({ hasShareIntent, pathname })) {return;}diff --git a/apps/mobile/src/modules/documents/share-intent.models.test.ts b/apps/mobile/src/modules/documents/share-intent.models.test.tsnew file mode 100644index 00000000..2a39f5d1--- /dev/null+++ b/apps/mobile/src/modules/documents/share-intent.models.test.ts@@ -0,0 +1,23 @@+import { describe, expect, test } from 'vitest';+import { shouldRedirectShareIntent } from './share-intent.models';++describe('share intent models', () => {+ test('it does not redirect without a pending share', () => {+ expect(shouldRedirectShareIntent({ hasShareIntent: false, pathname: '/list' })).toBe(false);+ });++ test.each([+ '/app-settings',+ '/config/server-selection',+ '/auth/login',+ '/auth/signup',+ '/organizations/create',+ '/share',+ ])('a pending share does not interrupt %s', (pathname) => {+ expect(shouldRedirectShareIntent({ hasShareIntent: true, pathname })).toBe(false);+ });++ test.each(['/list', '/search', '/settings'])('a pending share resumes on %s', (pathname) => {+ expect(shouldRedirectShareIntent({ hasShareIntent: true, pathname })).toBe(true);+ });+});diff --git a/apps/mobile/src/modules/documents/share-intent.models.ts b/apps/mobile/src/modules/documents/share-intent.models.tsnew file mode 100644index 00000000..74b9898e--- /dev/null+++ b/apps/mobile/src/modules/documents/share-intent.models.ts@@ -0,0 +1,17 @@+// Keep pending shares on hold during setup and while editing app preferences.+// Opening app settings must not bypass server selection or authentication.+const holdPathPrefixes = ['/auth', '/config', '/organizations/create', '/app-settings'];++export function shouldRedirectShareIntent({+ hasShareIntent,+ pathname,+}: {+ hasShareIntent: boolean;+ pathname: string;+}) {+ return (+ hasShareIntent &&+ pathname !== '/share' &&+ !holdPathPrefixes.some((prefix) => pathname.startsWith(prefix))+ );+}diff --git a/apps/mobile/src/modules/i18n/locales.models.test.ts b/apps/mobile/src/modules/i18n/locales.models.test.tsindex 700cf89f..aa72c600 100644--- a/apps/mobile/src/modules/i18n/locales.models.test.ts+++ b/apps/mobile/src/modules/i18n/locales.models.test.ts@@ -28,6 +28,21 @@ describe('locales.models', () => {).to.eql('en');});+ test('it checks the device languages in preference order, skipping unsupported languages', () => {+ expect(+ resolveUserLocale([+ { languageCode: 'de', languageTag: 'de-DE' },+ { languageCode: 'fr', languageTag: 'fr-CA' },+ { languageCode: 'en', languageTag: 'en-US' },+ ]),+ ).toBe('fr');+ });++ test('it falls back to English when the device has no supported languages', () => {+ expect(resolveUserLocale([{ languageCode: 'de', languageTag: 'de-DE' }])).toBe('en');+ expect(resolveUserLocale([])).toBe('en');+ });+test('when a user locale matches a supported locale key by language code, it returns that key', () => {expect(resolveUserLocale([{ languageCode: 'en', languageTag: 'en-US' }], {diff --git a/apps/mobile/src/modules/i18n/translations/en.ts b/apps/mobile/src/modules/i18n/translations/en.tsindex 8b1f3b1d..68a91d61 100644--- a/apps/mobile/src/modules/i18n/translations/en.ts+++ b/apps/mobile/src/modules/i18n/translations/en.ts@@ -1,6 +1,40 @@export const en = {papra: 'Papra',+ common: {+ close: 'Close',+ cancel: 'Cancel',+ ok: 'OK',+ },+ appSettings: {+ title: 'App settings',+ language: {+ title: 'Language',+ description: 'Choose the language used by the app on this device.',+ useDeviceLanguage: 'Use device language',+ },+ errors: {+ saveFailed: {+ title: 'Could not save language',+ message: 'Your language has not been changed. Please try again.',+ },+ },+ },+ settings: {+ title: 'Settings',+ account: 'Account',+ app: 'App',+ name: 'Name',+ email: 'Email',+ emailVerified: 'Email verified',+ yes: 'Yes',+ no: 'No',+ signOut: {+ title: 'Sign out',+ confirmation: 'Are you sure you want to sign out?',+ },+ },serverSelection: {+ selectServer: 'Select server',title: 'Organize, secure &\narchive your documents.',subtitle: 'First, choose where your documents live.',continue: 'Continue',diff --git a/apps/mobile/src/modules/i18n/translations/fr.ts b/apps/mobile/src/modules/i18n/translations/fr.tsindex 0bbab63d..97fd6350 100644--- a/apps/mobile/src/modules/i18n/translations/fr.ts+++ b/apps/mobile/src/modules/i18n/translations/fr.ts@@ -1,7 +1,41 @@import type { AppMessages, PartialMessages } from '../i18n.types';export const fr = {+ common: {+ close: 'Fermer',+ cancel: 'Annuler',+ ok: 'OK',+ },+ appSettings: {+ title: 'Paramètres de l’application',+ language: {+ title: 'Langue',+ description: 'Choisissez la langue utilisée par l’application sur cet appareil.',+ useDeviceLanguage: 'Utiliser la langue de l’appareil',+ },+ errors: {+ saveFailed: {+ title: 'Impossible d’enregistrer la langue',+ message: 'Votre langue n’a pas été modifiée. Veuillez réessayer.',+ },+ },+ },+ settings: {+ title: 'Paramètres',+ account: 'Compte',+ app: 'Application',+ name: 'Nom',+ email: 'Adresse e-mail',+ emailVerified: 'Adresse e-mail vérifiée',+ yes: 'Oui',+ no: 'Non',+ signOut: {+ title: 'Se déconnecter',+ confirmation: 'Voulez-vous vraiment vous déconnecter ?',+ },+ },serverSelection: {+ selectServer: 'Choisir un serveur',title: 'Organisez, sécurisez &\narchivez vos documents.',subtitle: 'Tout d’abord, choisissez où vos documents se trouvent.',},diff --git a/apps/mobile/src/modules/users/screens/settings.screen.tsx b/apps/mobile/src/modules/users/screens/settings.screen.tsxindex 2d48a44b..0356eb4b 100644--- a/apps/mobile/src/modules/users/screens/settings.screen.tsx+++ b/apps/mobile/src/modules/users/screens/settings.screen.tsx@@ -1,8 +1,10 @@import type { ThemeColors } from '@/modules/ui/theme.constants';import { useRouter } from 'expo-router';-import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';+import { ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';import { SafeAreaView } from 'react-native-safe-area-context';import { useAuthClient } from '@/modules/api/providers/api.provider';+import { useAppTranslations } from '@/modules/i18n/hooks/use-app-translations';+import { Icon } from '@/modules/ui/components/icon';import { useAlert } from '@/modules/ui/providers/alert-provider';import { useThemeColor } from '@/modules/ui/providers/use-theme-color';@@ -12,15 +14,16 @@ export default function SettingsScreen() {const authClient = useAuthClient();const session = authClient.useSession();const { showAlert } = useAlert();+ const t = useAppTranslations();const handleSignOut = () => {showAlert({- title: 'Sign Out',- message: 'Are you sure you want to sign out?',+ title: t.settings.signOut.title,+ message: t.settings.signOut.confirmation,buttons: [- { text: 'Cancel', style: 'cancel' },+ { text: t.common.cancel, style: 'cancel' },{- text: 'Sign Out',+ text: t.settings.signOut.title,style: 'destructive',onPress: async () => {await authClient.signOut();@@ -36,37 +39,57 @@ export default function SettingsScreen() {return (<SafeAreaView style={styles.container}><View style={styles.header}>- <Text style={styles.title}>Settings</Text>+ <Text style={styles.title}>{t.settings.title}</Text></View>- <View style={styles.section}>- <Text style={styles.sectionTitle}>Account</Text>- {session.data?.user && (- <>- <View style={styles.infoRow}>- <Text style={styles.infoLabel}>Name</Text>- <Text style={styles.infoValue}>{session.data.user.name}</Text>- </View>- <View style={styles.infoRow}>- <Text style={styles.infoLabel}>Email</Text>- <Text style={styles.infoValue}>{session.data.user.email}</Text>- </View>- <View style={styles.infoRow}>- <Text style={styles.infoLabel}>Email Verified</Text>- <Text style={styles.infoValue}>{session.data.user.emailVerified ? 'Yes' : 'No'}</Text>- </View>- </>- )}- </View>+ <ScrollView>+ <View style={styles.section}>+ <Text style={styles.sectionTitle}>{t.settings.account}</Text>+ {session.data?.user && (+ <>+ <View style={styles.infoRow}>+ <Text style={styles.infoLabel}>{t.settings.name}</Text>+ <Text style={styles.infoValue}>{session.data.user.name}</Text>+ </View>+ <View style={styles.infoRow}>+ <Text style={styles.infoLabel}>{t.settings.email}</Text>+ <Text style={styles.infoValue}>{session.data.user.email}</Text>+ </View>+ <View style={styles.infoRow}>+ <Text style={styles.infoLabel}>{t.settings.emailVerified}</Text>+ <Text style={styles.infoValue}>+ {session.data.user.emailVerified ? t.settings.yes : t.settings.no}+ </Text>+ </View>+ </>+ )}+ </View>- <View style={styles.section}>- <TouchableOpacity- style={[styles.actionButton, styles.dangerButton]}- onPress={handleSignOut}- >- <Text style={[styles.actionButtonText, styles.dangerText]}>Sign Out</Text>- </TouchableOpacity>- </View>+ <View style={styles.section}>+ <Text style={styles.sectionTitle}>{t.settings.app}</Text>+ <TouchableOpacity+ style={[styles.actionButton, styles.appSettingsButton]}+ onPress={() => router.push('/app-settings')}+ accessibilityRole="button"+ >+ <Icon name="settings" size={20} color={themeColors.foreground} />+ <Text style={styles.appSettingsLabel}>{t.appSettings.title}</Text>+ <Icon name="chevron-right" size={20} color={themeColors.mutedForeground} />+ </TouchableOpacity>+ </View>++ <View style={styles.section}>+ <TouchableOpacity+ style={[styles.actionButton, styles.dangerButton]}+ onPress={handleSignOut}+ accessibilityRole="button"+ >+ <Text style={[styles.actionButtonText, styles.dangerText]}>+ {t.settings.signOut.title}+ </Text>+ </TouchableOpacity>+ </View>+ </ScrollView></SafeAreaView>);}@@ -99,6 +122,7 @@ function createStyles({ themeColors }: { themeColors: ThemeColors }) {paddingHorizontal: 8,},infoRow: {+ gap: 16,flexDirection: 'row',justifyContent: 'space-between',alignItems: 'center',@@ -109,10 +133,13 @@ function createStyles({ themeColors }: { themeColors: ThemeColors }) {marginBottom: 8,},infoLabel: {+ flexShrink: 1,fontSize: 14,color: themeColors.mutedForeground,},infoValue: {+ flexShrink: 1,+ textAlign: 'right',fontSize: 14,fontWeight: '500',color: themeColors.foreground,@@ -130,6 +157,18 @@ function createStyles({ themeColors }: { themeColors: ThemeColors }) {color: themeColors.foreground,textAlign: 'center',},+ appSettingsButton: {+ flexDirection: 'row',+ alignItems: 'center',+ gap: 12,+ minHeight: 48,+ },+ appSettingsLabel: {+ flex: 1,+ fontSize: 16,+ fontWeight: '500',+ color: themeColors.foreground,+ },dangerButton: {backgroundColor: themeColors.destructiveBackground,},