3.6 KiB
3.6 KiB
feature:settings
Screen
SettingsScreen -- sealed interface SettingsRoute : NavKey with primary route SettingsTabbed (@Serializable data object). Receives onLogout and onNavigateBack callbacks.
Sections
- Account: displays user profile from
UserApi.getUser() - Appearance: theme toggle (System / Light / Dark) via
ThemeDataStore - Server: shows current server URL from
ServerDataStore - About: app version info
- Danger Zone: delete account with confirmation dialog
Theme
ThemeModeenum:SYSTEM,LIGHT,DARK- Persisted in
ThemeDataStore(DataStore) setThemeMode()writes to DataStore; the app's root composable observesthemeDataStore.themeModeflow- Applied via Compose
MaterialThemewithisSystemInDarkTheme()for SYSTEM mode
Logout
SettingsViewModel.logout()callsAuthRepository.logout()which clears tokens fromEncryptedSharedPreferences- Sets
isLoggedOut = truein UI state; screen callsonLogoutcallback to navigate to auth graph
Delete Account
SettingsViewModel.deleteAccount()callsUserApi.deleteUser()thenAuthRepository.logout()- Sets
isAccountDeleted = truein UI state; triggers navigation to auth graph
ViewModel Dependencies
UserApi-- fetch/delete user profileAuthRepository-- logout (clear tokens)ThemeDataStore-- observe and set theme preferenceServerDataStore-- observe current server URL
Future Sections (from spec, not yet implemented)
- Chat tab (font size, message layout, auto-scroll toggle)
- Speech tab (STT/TTS engine config)
- Data tab (import/export, clear chats, shared links management)
- Balance tab (conditional, token credits display)
- 2FA setup/disable in Account section
New Settings Sections
SettingsScreennow organized into: Account, Appearance, General (Language, Personalization), Chat (Presets), Advanced (Fork Behavior, Commands), Server, About, Danger Zone- Each new setting opens a dialog or navigates to a dedicated screen
Settings Sub-screens (via SettingsNavigation)
MemoriesScreen— full memory CRUD, enable/disable toggle, own ViewModel (MemoriesViewModel)McpServersScreen— server list with status badges, CRUD, reinitialize, tools sheet (McpViewModel)PresetManagerScreen— list/delete presets (PresetManagerViewModel)CommandsConfigScreen— enable/disable slash commands- Routes:
Memories,McpServers,PresetManager(all@Serializabledata objects extendingSettingsRoute) - Gotcha: Memories and MCP navigation routes defined in their own files (
MemoriesNavigation.kt,McpNavigation.kt) but wired throughSettingsNavigation.kt - Gotcha:
McpServerDialogusesMcpServerTypeenum (SSE, STREAMABLE_HTTP) — must match backend expectations - Gotcha: Memory keys are immutable after creation (edit dialog disables key field)
API Keys
ApiKeysScreen— list/create/delete API keys, own ViewModel (ApiKeysViewModel)- Route:
ApiKeys(@Serializabledata object extendingSettingsRoute), accessible from Settings → Security section ApiKeyCreateDialogis two-phase: name input → show created key value with copy button- Gotcha: The key value is only available in the creation response — it cannot be retrieved again from the server. The dialog must show it immediately after creation.
Dialogs
LanguageSelectorDialog— 37+ locales with search, single-select radioForkSettingsDialog— 3 fork modes (TARGET, BRANCHES, ALL)PersonalizationDialog— "About you" + "Response style" text areas with enable toggle