Skip to content

UI: connect the screens to the backend and clean up the UI layer - #18

Open
wenja0618 wants to merge 7 commits into
networking-6-remotefrom
ui-cleanup
Open

wenja0618 wants to merge 7 commits into
networking-6-remotefrom
ui-cleanup

Conversation

@wenja0618

Copy link
Copy Markdown
Contributor

Stack 7/7. Builds on #17.

Switches every screen to RoomieRepository (the backend by default) and restructures the UI layer. It's large, so it's split into commits by area, and reviewing commit by commit is easiest. Only the last commit is guaranteed to build on its own.

Structure

  • One screen per file. Components shared between screens, or big enough to stand alone, get their own file. Pieces used by only one screen stay private in it.
  • Feature components live with their feature (ui/chores/components, ui/notes/components, ui/shopping/components). ui/components holds the app-wide ones (split out of Common.kt and Fields.kt).
  • Every ViewModel is in its own file, one per screen. Onboarding has one per step instead of one shared ViewModel.
  • Removed components and helpers nothing used (DayTaskRow, RoomieDatePickerDialog, DateButton, IconTextRow, unused date helpers).

State and logic

  • Each screen is a thin wrapper that gets its ViewModel, plus a stateless …Content(ui, …).
  • ViewModels expose a single UI state built by pure functions (choresUiState, homeUiState, noteBoardUiState, shoppingUiState, …), so the logic that used to live in composables is unit-tested. Examples: filtering, form validation, the rotation preview, pin limits, the shopping subtitles, and keeping people in house order.
  • Forms live in the ViewModel and change through events: Add Chore, Edit Rotation, Leave a Note, Edit item and the onboarding steps. Purely visual state stays in Compose: whether a dropdown or calendar is open, and press-and-hold gestures.

Previews

  • 47 @Previews covering every screen state and shared component.
  • They use FakeRoomieRepository.demoState() through the same state builders as the app, wrapped in a new RoomiePreview.

Strings

  • All UI text is in strings.xml, with plurals for counts and content descriptions prefixed cd_.
  • Tab labels and buddy names are resources. Dates and weekday letters follow the device locale.
  • Error messages that come from the repository are still shown as-is (UiText.Raw).

Formatting

  • New .editorconfig (ktlint, Android Studio style, 120 columns). ktlint passes on all of ui/ and its tests.

Wiring

  • RepositoryModule replaces FakeDataModule and provides RemoteRoomieRepository, or the demo data with roomie.fakeData=true in local.properties.
  • AppViewModel shows repository errors as toasts and refreshes on resume and every 30 seconds.
  • Controls the backend doesn't support are hidden via Capabilities.

Test: assembleDebug succeeds. 66 unit tests pass, 1 skipped (the live backend test), including the new ChoresUiStateTest and ScreenStateTest.

@wenja0618
wenja0618 requested a review from caleb-bit November 28, 2026 08:53
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 534866cd-db47-4d3d-93c2-01cf66a0777d
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@wenja0618
wenja0618 added this pull request to stack #16 November 28, 2026 08:53
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