fix(r8): keep GeocacheTab, the third enum a route argument resolves by name

main stopped shipping `-dontobfuscate` when the R8 work merged, and this
branch has since merged main, so its release build renames classes. The
geocaching hub takes its tab as a route argument —
`Route.Geocaches(initialTab: GeocacheTab?)` — and androidx.navigation
resolves an enum argument with Class.forName on the serial name. A renamed
GeocacheTab therefore throws while the nav graph is being built, which is
before anything is on screen: the app cannot get past login. It is the same
failure DiscoverTab and BookmarkType already have keeps for, on an enum
added after those were written.

The blanket `-keepclassmembers enum *` does not cover it. That rule pins the
constant names and deliberately lets the class be renamed, which is exactly
what breaks here.

Verified on a play release build of this branch: the contract passes 26/26,
mapping.txt carries
`...routes.GeocacheTab -> ...routes.GeocacheTab`, and the minified APK
starts, reaches the feed and opens the geocaching hub with all five tabs —
no FATAL EXCEPTION and no "Cannot find class with name". The new contract
line was mutation-tested: renaming the class in a copy of the mapping makes
the verifier exit 1 and name it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vitor Pamplona
2026-09-21 11:00:44 -04:00
co-authored by Claude Opus 5
parent d446839fa5
commit 1a66fe2e33
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -242,3 +242,4 @@
# breaks here. Every enum used as a route argument needs its name too.
-keep class com.vitorpamplona.amethyst.ui.navigation.routes.DiscoverTab { *; }
-keep class com.vitorpamplona.amethyst.ui.screen.loggedIn.bookmarkgroups.BookmarkType { *; }
-keep class com.vitorpamplona.amethyst.ui.navigation.routes.GeocacheTab { *; }
+1
View File
@@ -123,6 +123,7 @@ class com.vitorpamplona.amethyst.service.calendar.CalendarReminderWorker
# renamed. Add a line here whenever an enum becomes a route argument.
class com.vitorpamplona.amethyst.ui.navigation.routes.DiscoverTab
class com.vitorpamplona.amethyst.ui.screen.loggedIn.bookmarkgroups.BookmarkType
class com.vitorpamplona.amethyst.ui.navigation.routes.GeocacheTab
# --- Enum constants persisted as strings -------------------------------------