Skip to content

GT-3107 Convert AccountLayout to Circuit - #4592

Open
tjohnson009 wants to merge 1 commit into
developfrom
GT-3107-Convert-AccountLayout-To-Circuit
Open

tjohnson009 wants to merge 1 commit into
developfrom
GT-3107-Convert-AccountLayout-To-Circuit

Conversation

@tjohnson009

Copy link
Copy Markdown
Contributor

Resolves GT-3107

Converts the Account screen to a Circuit Presenter/UI pair, following the same structure as the Dashboard and Tool Details conversions. Follow-up from the review of #4583.

Changes

  • AccountScreen — new @Parcelize data object ParcelableScreen.
  • AccountPresenter — replaces AccountViewModel, with UiState/UiEvent nested in the presenter (internal, @ConsistentCopyVisibility) matching DashboardPresenter. It also absorbs AccountActivityViewModel and GlobalActivityViewModel (each was a single stateIn flow), so the child pager pages are driven from the same state object. Syncing uses the shared SyncTaskRegistry/SyncTracker mechanism from gto-support — the same pattern as DashboardPresenter — so the initial sync fires on task registration, pull-to-refresh flows through triggerSyncTasks(force = true), and sync failures are caught and logged by SyncTracker. Up navigation is navigator.pop().
  • AccountLayout — now a @CircuitInject UI that is a pure function of UiState, wrapped in DrawerMenuLayout (preserving the drawer previously provided by AccountActivity). Rendering is unchanged — the pre-existing AccountLayoutHeader Paparazzi goldens verify without modification. AccountLayoutHeader also gained a modifier parameter.
  • Navigation — the drawer menu's Profile item launches startCircuitActivity(AccountScreen) through the shared CircuitActivity host. AccountActivity, startAccountActivity(), AccountLayoutEvent, and the manifest entry are removed.

Why child ViewModels were converted in the same pass

AccountActivityLayout/GlobalActivityLayout previously instantiated ViewModels inside composition, which is what made the assembled screen unrenderable in Paparazzi. With the whole screen state-driven, GT-3108 (consolidating the Account Paparazzi tests to full-screen snapshots) is unblocked.

Tests

  • New AccountPresenterTest covering state production (user, pages incl. remote-config gating, activity data, drawer), the launch-time sync, forced sync via pull-to-refresh, and up navigation. Sync tests gate the mocked sync service on a CompletableDeferred so the isSyncRunning transitions are asserted deterministically.
  • verifyPaparazzi passes against the existing goldens; full app unit tests and ktlint pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mm8jFZh3uaPNENLcbnuxow

Converts the Account screen to a Circuit Presenter/UI pair, replacing
AccountActivity and AccountViewModel. The presenter also absorbs the
single-flow AccountActivityViewModel and GlobalActivityViewModel so the
entire screen renders from a plain UiState, which unblocks full-screen
Paparazzi coverage (GT-3108).

- Add AccountScreen ParcelableScreen
- Add AccountPresenter with UiState/UiEvent nested per convention;
  syncing uses the shared SyncTaskRegistry/SyncTracker mechanism from
  gto-support, matching DashboardPresenter
- AccountLayout is now a @CircuitInject UI wrapped in DrawerMenuLayout
- Up navigation flows through navigator.pop() via UiEvent.NavigateUp
- Drawer menu launches the screen via startCircuitActivity(AccountScreen)
- Remove AccountActivity from the manifest

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Mm8jFZh3uaPNENLcbnuxow
@tjohnson009
tjohnson009 requested a review from a team September 8, 2026 15:40
@codecov

codecov Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.68539% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.89%. Comparing base (86953db) to head (f984247).
⚠️ Report is 13 commits behind head on develop.

Files with missing lines Patch % Lines
...otlin/org/cru/godtools/ui/account/AccountLayout.kt 9.75% 37 Missing ⚠️
...in/org/cru/godtools/ui/account/AccountPresenter.kt 93.33% 1 Missing and 2 partials ⚠️
...otlin/org/cru/godtools/ui/account/AccountScreen.kt 0.00% 1 Missing ⚠️
...tools/ui/account/activity/AccountActivityLayout.kt 0.00% 1 Missing ⚠️
...lin/org/cru/godtools/ui/drawer/DrawerMenuLayout.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4592      +/-   ##
===========================================
+ Coverage    53.54%   53.89%   +0.34%     
===========================================
  Files          440      438       -2     
  Lines        11582    11588       +6     
  Branches      1960     1962       +2     
===========================================
+ Hits          6202     6245      +43     
+ Misses        4790     4751      -39     
- Partials       590      592       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +77 to +82
userActivity = remember { userActivityManager.userActivityFlow }
.collectAsState(UserActivity(emptyMap())).value,
globalActivity = GlobalActivityScreen.UiState(
activity = remember { globalActivityRepository.getGlobalActivityFlow() }
.collectAsState(GlobalActivityAnalytics()).value
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's put these changes on hold, I think I want global activity and account activity to have their own sub-presenters and not just be wrapped up into a large Account Presenter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to do some research to see if SubCircuit fits this use case or not

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants