feat: configurable bottom navigation bar (Issue #23)

## What
Adds a new Navigation Bar section to Settings where users can customize which items appear in the bottom navigation bar.

## Features
- Pick from any of the 19 drawer screens (max 5 items)
- Remove items with a close/delete button
- Items persist via SharedPreferences (CSV format)
- Invalid names are silently dropped
- Existing screens and auth-aware filtering respected

Closes #23
This commit is contained in:
M57 authored and GitHub committed 2026-06-18 21:16:21 +03:00
1 parent 837678c590
commit 34df198c4d
6 files changed
+179 -18

No files matched your search

@@ -20,6 +20,7 @@ object AuthManager {
private const val KEY_PORT = "port"
private const val KEY_AUTO_RECONNECT = "auto_reconnect"
private const val KEY_THEME_PREFERENCE = "theme_preference"
private const val KEY_BOTTOM_NAV_ITEMS = "bottom_nav_items"
private const val DEFAULT_HOST = "127.0.0.1"
private const val DEFAULT_PORT = 9119
@@ -117,4 +118,21 @@ object AuthManager {
/** Convenience: build the WebSocket URL with token query param.
* NOTE: Token in query string — trusted local network only. */
fun wsUrl(): String = "ws://${getHost()}:${getPort()}/api/ws?token=${getToken().orEmpty()}"
// ── Bottom nav bar items ──────────────────────────────────────────────
/** Default bottom-nav items (NavKey data-object names). */
private val DEFAULT_BOTTOM_NAV_ITEMS =
listOf("ChatScreen", "SkillsScreen", "CronJobsScreen", "SystemScreen", "SettingsScreen")
/** Returns the list of selected bottom-nav item keys (data-object names). */
fun getBottomNavItems(): List<String> {
val raw = requirePrefs().getString(KEY_BOTTOM_NAV_ITEMS, null) ?: return DEFAULT_BOTTOM_NAV_ITEMS
return raw.split(",").filter { it.isNotBlank() }
}
/** Persist the ordered list of bottom-nav item keys (max 5, data-object names). */
fun setBottomNavItems(items: List<String>) {
requirePrefs().edit().putString(KEY_BOTTOM_NAV_ITEMS, items.joinToString(",")).apply()
}
}