From 5d4f211f17627ddf925f19187411b517fc9ff97b Mon Sep 17 00:00:00 2001 From: ronia Date: Fri, 19 Jun 2026 13:35:57 +0300 Subject: [PATCH] fix: bottom navigation bar customization not reflected in NavigationBar (Issue #37) --- app/src/main/java/com/m57/hermescontrol/Navigation.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/m57/hermescontrol/Navigation.kt b/app/src/main/java/com/m57/hermescontrol/Navigation.kt index 0dee65c4..c2722382 100644 --- a/app/src/main/java/com/m57/hermescontrol/Navigation.kt +++ b/app/src/main/java/com/m57/hermescontrol/Navigation.kt @@ -178,8 +178,13 @@ fun MainNavigation() { val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed) val scope = rememberCoroutineScope() - // Read dynamic bottom-nav config - val bottomNavItems = remember { resolveBottomNavItems(AuthManager.getBottomNavItems()) } + // Read dynamic bottom-nav config. + // NB: deliberately NOT wrapped in remember { … } — AuthManager values change + // when the user customises items in Settings (saved to SharedPreferences). + // Without a key that tracks prefs changes, remember would cache the stale + // defaults and the NavigationBar would never reflect the user's picks. + // Reading fresh on every recomposition is negligible (pure map over 18 items). + val bottomNavItems = resolveBottomNavItems(AuthManager.getBottomNavItems()) val bottomNavKeys = remember(bottomNavItems) { bottomNavItems.map { it.key }.toSet() } // Sync primary screens to NavigationController