[BTAPP-59] Add flag to build-apk.sh to build an APK with the settings view hidden #88

Merged
chris merged 5 commits from feature/BTAPP-59 into main 2026-09-02 18:05:02 -06:00
Owner

Ticket

BTAPP-59 Add flag to build-apk.sh to build an APK with the settings view hidden

Summary

  • Adds Config.HideSettings (reads EXPO_PUBLIC_HIDE_SETTINGS) to app/lib/config/index.ts, following the app's single-source-of-truth env pattern.
  • app/app/(tabs)/_layout.tsx sets href: null on the Settings tab when Config.HideSettings is true (Expo Router's standard way to deregister a route from the tab bar without removing it). The layout body and its test now live at app/lib/screens/tabs-layout/ — a co-located _layout.test.tsx in app/app/ collided with the route's own module slot (Expo Router's require.context treats .test as a stripped platform extension there).
  • build-apk.sh gets a new --hide-settings flag that sets EXPO_PUBLIC_HIDE_SETTINGS=1 on the gradle build step. It requires --release (a debug build loads its JS from the long-running Metro service, which never sees the env var) and force-invalidates Gradle's JS-bundling task output on every release build, so toggling the flag between builds can't reuse a stale cached bundle in either direction.
  • Documents EXPO_PUBLIC_HIDE_SETTINGS in app/.env.example and app/CLAUDE.md's env var table.
## Ticket [BTAPP-59](http://192.168.2.100:7123/home/browse/BTAPP-59/) Add flag to build-apk.sh to build an APK with the settings view hidden ## Summary - Adds `Config.HideSettings` (reads `EXPO_PUBLIC_HIDE_SETTINGS`) to `app/lib/config/index.ts`, following the app's single-source-of-truth env pattern. - `app/app/(tabs)/_layout.tsx` sets `href: null` on the Settings tab when `Config.HideSettings` is true (Expo Router's standard way to deregister a route from the tab bar without removing it). The layout body and its test now live at `app/lib/screens/tabs-layout/` — a co-located `_layout.test.tsx` in `app/app/` collided with the route's own module slot (Expo Router's `require.context` treats `.test` as a stripped platform extension there). - `build-apk.sh` gets a new `--hide-settings` flag that sets `EXPO_PUBLIC_HIDE_SETTINGS=1` on the gradle build step. It requires `--release` (a debug build loads its JS from the long-running Metro service, which never sees the env var) and force-invalidates Gradle's JS-bundling task output on every release build, so toggling the flag between builds can't reuse a stale cached bundle in either direction. - Documents `EXPO_PUBLIC_HIDE_SETTINGS` in `app/.env.example` and `app/CLAUDE.md`'s env var table.
Reads EXPO_PUBLIC_HIDE_SETTINGS at module load, following the existing
single-source-of-truth pattern in app/lib/config/index.ts. Defaults to
false when unset.
Sets href: null on the settings Tabs.Screen, Expo Router's standard way
to deregister a route from the tab bar without removing it.
Sets EXPO_PUBLIC_HIDE_SETTINGS=1 on the gradle build step inside the dev
container so it's inlined into the JS bundle, producing a sideloadable
APK variant with the Settings tab hidden. Composes with --release/--debug.
- Move the tabs layout body and its test out of app/app/ (Expo Router's
  route root) to app/lib/screens/tabs-layout, since a co-located
  _layout.test.tsx there collided with the real route's module slot.
  app/app/(tabs)/_layout.tsx is now a thin re-export.
- Refuse --hide-settings without --release in build-apk.sh: a debug build
  loads its JS from Metro, which never sees EXPO_PUBLIC_HIDE_SETTINGS, so
  the flag was previously a silent no-op.
- Force-invalidate Gradle's JS-bundling task output when --hide-settings
  is set, since it doesn't track EXPO_PUBLIC_* env vars as task inputs and
  could otherwise reuse a stale UP-TO-DATE bundle across toggles.
- Document EXPO_PUBLIC_HIDE_SETTINGS in app/CLAUDE.md's env var table.
- Test hardening: restore Config.HideSettings in afterEach, throw a clear
  error from the screenOptions() test helper on an unmatched tab name, and
  cover both Config.HideSettings values in the "other tabs unaffected" test.
BTAPP-59: Invalidate the release JS bundle cache on every release build
All checks were successful
app / check (pull_request) Successful in 21s
app / android (pull_request) Successful in 53s
plane-sync / sync (pull_request) Successful in 1s
7402eaf10d
The previous fix only cleared createBundleReleaseJsAndAssets's output when
--hide-settings was set, covering plain-release -> hide-settings-release but
not the reverse: a plain --release build run right after a --hide-settings
one (no JS source change in between) could come back UP-TO-DATE and reuse
the hidden-Settings bundle. Hoist the invalidation to run for every release
build regardless of which way the flag was toggled. Also narrows the
generated/assets path to match generated/res's existing
createBundleReleaseJsAndAssets scoping, rather than wiping all of
generated/assets.
chris merged commit 889d5a050c into main 2026-09-02 18:05:02 -06:00
chris deleted branch feature/BTAPP-59 2026-09-02 18:05:02 -06:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
chris/budget-tracker!88
No description provided.