mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-06 11:48:24 +00:00
feat: give My Fitness its own navigation destination
My Fitness was reachable only from an icon in the Workouts top bar, which buried the one screen the Health Connect permissions exist to serve. It is now a NavBarItem, so it appears in the drawer and can be pinned to the bottom bar like any other destination. It sits under "You" rather than "Feeds": every other Feeds entry is a stream of other people's events, while this is the user's own training — the same reason Profile, Drafts and Wallet live there. Four places had to stay in sync, three of them guarded: DrawerSectionsTest and BottomBarCategoriesTest fail the build when a catalog id is missing from a section or a picker category, and BottomBarFeedPreloaders' exhaustive `when` caught the fourth. My Fitness reads Health Connect on the device and issues no REQs, so its preload branch is deliberately empty. Adding the enum value needs no migration: nav items are persisted by name and unknown names are already dropped on decode, so an older build ignores the row rather than failing the settings blob. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019egdJyBHnrATZHjs86up8f
This commit is contained in:
+9
@@ -40,6 +40,7 @@ enum class NavBarItem {
|
||||
DISCOVER,
|
||||
NOTIFICATIONS,
|
||||
PROFILE,
|
||||
MY_FITNESS,
|
||||
MY_LISTS,
|
||||
BOOKMARKS,
|
||||
WEB_BOOKMARKS,
|
||||
@@ -255,6 +256,13 @@ val NavBarCatalog: Map<NavBarItem, NavBarItemDef> =
|
||||
icon = MaterialSymbols.DirectionsRun,
|
||||
resolveRoute = { Route.Workouts },
|
||||
),
|
||||
NavBarItem.MY_FITNESS to
|
||||
NavBarItemDef(
|
||||
id = NavBarItem.MY_FITNESS,
|
||||
labelRes = R.string.my_fitness,
|
||||
icon = MaterialSymbols.AutoMirrored.ShowChart,
|
||||
resolveRoute = { Route.MyFitness },
|
||||
),
|
||||
NavBarItem.GIT_REPOSITORIES to
|
||||
NavBarItemDef(
|
||||
id = NavBarItem.GIT_REPOSITORIES,
|
||||
@@ -505,6 +513,7 @@ val BottomBarCategories: List<NavBarCategory> =
|
||||
MaterialSymbols.AccountCircle,
|
||||
listOf(
|
||||
NavBarItem.PROFILE,
|
||||
NavBarItem.MY_FITNESS,
|
||||
NavBarItem.MY_LISTS,
|
||||
NavBarItem.BOOKMARKS,
|
||||
NavBarItem.WEB_BOOKMARKS,
|
||||
|
||||
+1
@@ -107,6 +107,7 @@ private val DrawerNavigateItems: List<NavBarItem> =
|
||||
private val DrawerYouItems: List<NavBarItem> =
|
||||
listOf(
|
||||
NavBarItem.PROFILE,
|
||||
NavBarItem.MY_FITNESS,
|
||||
NavBarItem.MY_LISTS,
|
||||
NavBarItem.BOOKMARKS,
|
||||
NavBarItem.WEB_BOOKMARKS,
|
||||
|
||||
+4
@@ -117,6 +117,10 @@ private fun PreloadFor(
|
||||
// Favorite apps is a device-local launcher grid — nothing to preload from relays.
|
||||
NavBarItem.FAVORITE_APPS -> {}
|
||||
|
||||
// My Fitness summarises the user's own Health Connect data on the device. It issues no
|
||||
// REQs, so there is nothing to warm up from relays.
|
||||
NavBarItem.MY_FITNESS -> {}
|
||||
|
||||
NavBarItem.CALENDARS,
|
||||
NavBarItem.CALENDAR_COLLECTIONS,
|
||||
-> CalendarsFilterAssemblerSubscription(accountViewModel)
|
||||
|
||||
@@ -2771,4 +2771,8 @@
|
||||
rationale screen. Needs to be an Android resource (not a commons Compose resource)
|
||||
because android:label on the manifest entry can only reference @string/. -->
|
||||
<string name="health_connect_rationale_activity_label">Health Connect and Amethyst</string>
|
||||
|
||||
<!-- My Fitness: the signed-in user's own training summary. Android resource because
|
||||
NavBarItemDef labels are R.string ids. -->
|
||||
<string name="my_fitness">My Fitness</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user