Skip to content

GT-2584: Migrate Banners to Circuit Presenter/UI pattern#4398

Merged
frett merged 5 commits into
developfrom
circuitBanners
Apr 23, 2026
Merged

GT-2584: Migrate Banners to Circuit Presenter/UI pattern#4398
frett merged 5 commits into
developfrom
circuitBanners

Conversation

@frett

@frett frett commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaces ViewModel-backed FavoriteToolsBanner and TutorialFeaturesBanner composables with Circuit BannerPresenter<T> / Layout pairs
  • Introduces Banner.UiState interface so parent presenters (HomePresenter, ToolsPresenter) receive typed banner state directly rather than dispatching on a BannerType enum
  • Wires banner presenters into parent presenters via Hilt @Binds, enabling the previously @Ignored Paparazzi snapshot test to run without a ViewModel

Test plan

  • Verify FavoriteToolsBannerPresenter unit tests pass
  • Verify TutorialFeaturesBannerPresenter unit tests pass
  • Verify FavoriteToolsBannerLayout and TutorialFeaturesBannerLayout UI tests pass
  • Verify HomePresenterTest and ToolsPresenterTest pass with FakeBannerPresenter
  • Verify Paparazzi snapshots pass (HomeLayout() - Banner - Tutorial no longer ignored)
  • Smoke-test: banner appears and dismisses correctly in the Home and Tools tabs on a device/emulator

🤖 Generated with Claude Code

frett and others added 2 commits April 22, 2026 16:39
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@frett frett left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code Review

Summary

Migrates FavoriteToolsBanner and TutorialFeaturesBanner from ViewModel-backed composables to Circuit BannerPresenter<T> / Layout pairs, introducing a typed Banner.UiState interface so parent presenters receive banner state directly.

Checklist Findings

✅ Looks Good

  • ktlint passes
  • UiState, UiEvent, and eventSink correctly nested inside each presenter
  • Both layout composables have modifier: Modifier = Modifier and delegate all interactions via state.eventSink(...)
  • BannerModule correctly uses @Binds + @InstallIn(SingletonComponent::class)
  • moleculeFlow + turbine used for presenter tests — correct choice for the custom BannerPresenter<T> interface
  • TestEventSink used correctly in layout tests
  • contentKey = { it?.type } added to AnimatedContent for correct animation keying across banner transitions
  • @Ignore removed from the Paparazzi snapshot test now that no ViewModel dependency blocks it
  • Paparazzi snapshots committed as LFS pointers (CI-generated)
  • FakeBannerPresenter provides a clean, reusable test double for parent presenter tests
  • private val settings / private val eventBus — constructor parameters correctly scoped

⚠️ Minor Issues

(none)

❌ Must Fix

(none)

Overall Verdict

APPROVE — Clean migration. No remaining issues.

@codecov

codecov Bot commented Apr 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.29%. Comparing base (d181e3d) to head (dfc83c4).
⚠️ Report is 7 commits behind head on develop.

Files with missing lines Patch % Lines
...g/cru/godtools/ui/banner/MaterialBanner+Preview.kt 0.00% 10 Missing ⚠️
...otlin/org/cru/godtools/ui/banner/MaterialBanner.kt 91.34% 1 Missing and 8 partials ⚠️
.../main/kotlin/org/cru/godtools/ui/banner/Banners.kt 60.00% 0 Missing and 2 partials ⚠️
...banner/tutorial/TutorialFeaturesBannerPresenter.kt 90.00% 1 Missing and 1 partial ⚠️
...c/main/kotlin/org/cru/godtools/ui/banner/Banner.kt 50.00% 1 Missing ⚠️
.../banner/favoritetools/FavoriteToolsBannerLayout.kt 88.88% 0 Missing and 1 partial ⚠️
...nner/favoritetools/FavoriteToolsBannerPresenter.kt 91.66% 0 Missing and 1 partial ⚠️
...ui/banner/tutorial/TutorialFeaturesBannerLayout.kt 88.88% 0 Missing and 1 partial ⚠️
...org/cru/godtools/ui/dashboard/tools/ToolsLayout.kt 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4398      +/-   ##
===========================================
+ Coverage    51.17%   51.29%   +0.12%     
===========================================
  Files          448      450       +2     
  Lines        12612    12625      +13     
  Branches      2090     2093       +3     
===========================================
+ Hits          6454     6476      +22     
+ Misses        5534     5529       -5     
+ Partials       624      620       -4     

☔ View full report in Codecov by Sentry.
📢 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.

Replace direct Settings flow observation with injected BannerPresenter dependencies in HomePresenter and ToolsPresenter, enabling proper Circuit-based composition and simplifying testing via FakeBannerPresenter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@frett frett merged commit d71b50a into develop Apr 23, 2026
13 checks passed
@frett frett deleted the circuitBanners branch April 23, 2026 01:27
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.

1 participant