Skip to content

refactor: migrate OrgRepo, UserRepo, and device config to entity DAOs (#1235) - #1

Open
marsof02 wants to merge 6 commits into
chore/split-treetracker-daofrom
chore/treetracker-dao-split-repos
Open

refactor: migrate OrgRepo, UserRepo, and device config to entity DAOs (#1235)#1
marsof02 wants to merge 6 commits into
chore/split-treetracker-daofrom
chore/treetracker-dao-split-repos

Conversation

@marsof02

@marsof02 marsof02 commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Thank you for opening a Pull Request!

Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests are added/updated (if necessary)
  • Ensure the linter passes (./codeAnalysis to automatically apply formatting/linting)
  • Appropriate docs were updated (if necessary)
  • This change has no user-visible / UI effect (refactor, docs, CI, etc.), so screenshots are not applicable.

Part of Greenstand#1235 🦕

Summary

PR 2 of 6 for Greenstand#1235 — migrates leaf consumers off TreeTrackerDAO:

Stacks on Greenstand#1303 (branch chore/split-treetracker-dao).
Merge after PR 1, or review against that branch only.

TreeTrackerDAO is still used elsewhere; removed in a later PR.

Out of scope (follow-up PRs)

  • PR 3 — session + tree callers
  • PR 4 — planter (legacy)
  • PR 5 — location + sync/dashboard
  • PR 6 — remove TreeTrackerDAO, split tests

marsof02 and others added 4 commits July 16, 2026 12:30
* refactor: split TextButton.kt into multiple focused files for better organization

* fix: restore throttled navigation and resolve ktlint issues after TextButton split (Greenstand#1237)

* Clean up README.md by removing conflict markers

Removed unnecessary merge conflict markers from README.

---------

Co-authored-by: Aneesh Pallapolu <yaagnik.p@gmail.com>
* chore(deps): bump Compose to 1.10.5, compileSdk to 36, add Navigation 3 deps

Prerequisite for the Navigation 2 -> Navigation 3 migration:
navigation3-ui 1.1.1 requires Compose >= 1.10.0 and compileSdk 36.
material-icons-extended stays at 1.7.8 (last published version).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(navigation): migrate from Navigation 2 to Navigation 3

Replace androidx.navigation:navigation-compose with androidx.navigation3:

- Routes implement NavKey; back stack owned by the app via rememberNavBackStack
- New Navigator + NavOptions DSL (popUpTo<T>, popUpToRoot, launchSingleTop)
  replacing NavHostController and NavigationUtils' throttled helpers
- NavHost -> NavDisplay in Host.kt and ImageCaptureActivity, with saveable-state
  and ViewModel-store entry decorators and the same 500ms fade transitions
- trackedComposable -> custom screen-tracking NavEntryDecorator (Crashlytics
  breadcrumbs); HandleUIEvents gains an origin-is-top guard replacing the
  Nav2 RESUMED check
- Org deep link parsed manually from the launch intent (cold start only,
  matching previous behavior)
- NavigatorTest + FakeNavigator; previews/screenshot harness on LocalNavigator

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(navigation): provide NavigationEventDispatcherOwner for NavDisplay

NavDisplay's back handling crashed on launch: AppCompatActivity's
setContentView (appcompat 1.7.x) plants only the pre-navigationevent
view-tree owners, so nav3 could not find a NavigationEventDispatcher.

- Bump androidx.activity to 1.12.0, where ComponentActivity implements
  NavigationEventDispatcherOwner
- Plant the view-tree owner on the decor view in TreeTrackerActivity

Verified on a Pixel 7 API 35 emulator: cold start, splash auto-nav,
signup back handling, and org deep link all work.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(navigation): cover deep link parsing, route registry, event execution

- OrgDeepLinkTest (10 cases): parseStartRoute over valid/invalid scheme,
  host, path, query params, and URL-encoding (Robolectric for android.net.Uri)
- RouteRegistryTest (8 cases): no-arg resolution to NavKey, arg-route null,
  alias normalization, isValidRoute
- SettingsViewModelTest: two cases now execute the NavigationEvent lambda
  against a FakeNavigator and assert the resulting back stack, covering the
  event -> Navigator wiring and the new popUpToRoot() logout path

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(navigation): scope nav throttle per-screen instead of globally

The 300 ms navigation throttle lived on a single lastMutationTime field on
the one Navigator per NavDisplay, making it a global lock across every screen
and button: navigating on one screen dropped any navigation from another for
300 ms, so a user could not tap "next" through a flow quickly.

Bind each screen its own origin-scoped Navigator (via the per-entry decorator)
and gate throttled calls on "is my screen still the top of the stack?" rather
than a wall-clock timer:

- Navigator gains an `origin` binding and `scopedTo(originContentKey)`;
  isThrottled() drops a throttled call only when the caller's origin is no
  longer on top. Unscoped navigators keep the time-based debounce as a fallback
  for tests and non-entry hosts.
- rememberScreenTrackingNavEntryDecorator re-provides LocalNavigator as a view
  scoped to the entry's contentKey, so every screen gets per-screen double-tap
  protection with no call-site changes.

Result: rapid "next" across different screens all succeed (no time gap), while
a double-tap on one screen drops the second navigation (origin no longer top).
Also removes the side effect where a non-throttled navigate armed the window.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(navigation): shorten nav fade to 300ms

Reduce the NavDisplay transition duration from 500ms to 300ms. On a pop,
NavDisplay deliberately keeps the outgoing screen on top for the full fade
(targetZIndex = initialZIndex - 1f), so during that window it intercepts taps
meant for the revealed screen behind it. Halving the window makes tapping the
revealed screen right after Back land reliably, and makes transitions snappier
overall.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…enstand#1235) (Greenstand#1303)

* docs: add task_22 plan for splitting TreeTrackerDAO (Greenstand#1235)

* refactor: extract entity-specific Room DAO interfaces (Greenstand#1235)

* refactor: wire new DAOs in AppDatabase and RoomModule (Greenstand#1235)

* chore: run codeAnalysis formatting on database DAO files (Greenstand#1235)

* docs: add task_24 plan for splitting TreeTrackerDAO (Greenstand#1235)

---------

Co-authored-by: Jonathan Muller <elforama@gmail.com>
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

👋 Hi @marsof02, thanks for the contribution!

Before this PR can be reviewed and merged, please add:

  • a 🎥 screen recording / video demonstrating the change — a video is required even when there are no UI changes, to show that the parts of the app affected by this change still work

Just drag-and-drop the file(s) into the PR description and GitHub will upload them. This check re-runs automatically when you edit the description.

This PR is marked as non-UI, so a screenshot is not required — but a video is still required, showing that the parts of the app affected by this change still work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants