Skip to content

feat: book reviews (Hilt rework) + richer book detail screen#15

Merged
fabiodalez-dev merged 3 commits into
mainfrom
rework/book-reviews
Jul 2, 2026
Merged

feat: book reviews (Hilt rework) + richer book detail screen#15
fabiodalez-dev merged 3 commits into
mainfrom
rework/book-reviews

Conversation

@fabiodalez-dev

Copy link
Copy Markdown
Owner

Summary

Reworks the book-reviews feature (stars + text) onto the now-merged main (Hilt DI, offline cache, WorkManager sync) and addresses the review findings, then redesigns the book detail screen for readability. Consumes the server endpoints in the Pinakes API PR (feat(mobile-api): book reviews endpoints).

DI migration (main removed ServiceLocator/LocalServices)

  • ReviewsRepository provided from AppModule.
  • BookReviewsViewModel / MyReviewsViewModel@HiltViewModel; the book id now flows through SavedStateHandle (ARG_BOOK_ID), same as BookDetailViewModel. Hand-written ViewModelProvider.Factorys deleted; call sites use hiltViewModel().

Review findings

  • Graceful degradation — if the instance's server lacks the reviews endpoint (404/not_found), the whole section collapses instead of showing an error banner on a book the user can't act on.
  • Delete confirmation dialog — a destructive, irreversible delete no longer fires on the raw tap.
  • My-reviews load-more dedups by id on append (a cursor overlap must not duplicate a LazyColumn key).
  • Read-only StarRating exposes a single "N.N out of 5" contentDescription instead of five undescribed star icons.
  • i18n — 3 new keys (delete-confirm title/message, rating a11y label) added to all 4 locales (it/en/fr/de); full key parity (342 each).
  • _contract/MOBILE_API_SPEC.md — corrected recensioni columns (stelle/descrizione, not voto/testo) + documented the always-on moderation semantics.

Book detail redesign (nicer, more complete, larger/darker text)

  • Title → headlineSmall bold; author → titleMedium SemiBold onSurface; subtitle darkened.
  • Section headings unified to a SemiBold titleMedium via a shared SectionTitle.
  • Description → bodyLarge onSurface, 26sp line height (larger + darker).
  • Metadata grouped into one rounded surfaceContainerLow card (a single spec sheet); MetadataRow values → bodyLarge Medium onSurface. Blank guards drop empty labelled rows.

Verification

Validated on an emulator against a live instance: login → catalog → a rich book (Il nome della rosa) shows the full spec card + About + the reviews section with a working "Write a review" affordance for a borrower; the end-to-end reviews flow (eligibility can_review, upsert→pending moderation, mine any-state, delete 200404) confirmed against the server. 67 unit tests, assembleDebug + assembleRelease (R8) green.

claude and others added 3 commits July 2, 2026 08:02
Bring the website's book-review feature to the Android app: a borrower can
leave a 1–5 star rating with optional text on a title they've had on loan,
everyone can read other users' reviews on the book detail, and each user has a
"My reviews" page listing their own reviews.

App:
- Models: BookReviews (aggregate + own + others), Review, ReviewRequest,
  MyReview; `reviews` feature flag on HealthFeatures/InstanceFeatures.
- API: GET/PUT/DELETE catalog/books/{id}/reviews and GET me/reviews, plus
  ReviewsRepository (cursor-paginated), wired into the ServiceLocator.
- UI: reusable StarRating (read-only, half stars) and StarRatingInput
  (tappable) components matching the app's Material theme; a reviews section on
  the book detail with the aggregate rating, an inline create/edit/delete
  composer (gated on having borrowed the title + the feature flag), and other
  users' reviews; a My Reviews screen reachable from Profile.
- i18n: review strings in all four locales (it/en/fr/de).

Contract:
- Document the endpoints and schemas in openapi.json, the endpoint manifest and
  MOBILE_API_SPEC.md for the backend to implement.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXHZkQnAVpxkJRQ7QqY3Ab
Integrates the now-merged main (Hilt DI, offline cache, WorkManager sync)
into the book-reviews feature and reworks it to match:

DI migration (ServiceLocator/LocalServices are gone in main):
- ReviewsRepository provided from AppModule.
- BookReviewsViewModel / MyReviewsViewModel → @hiltviewmodel; the book id
  now flows through SavedStateHandle (ARG_BOOK_ID), same as BookDetailViewModel.
- Call sites use hiltViewModel(); hand-written Factories deleted.

Review findings:
- Graceful degradation: if the instance's server lacks the reviews endpoint
  (404/not_found), the whole section collapses instead of showing an error
  banner on a book the user can't act on.
- Delete confirmation dialog — a destructive, irreversible delete no longer
  fires on the raw tap.
- My-reviews load-more dedups by id on append (cursor overlap must not
  duplicate a LazyColumn key).
- Read-only StarRating exposes a single 'N.N out of 5' contentDescription
  instead of five undescribed star icons.
- i18n: 3 new keys (delete-confirm title/message, rating a11y label) added
  to all 4 locales (it/en/fr/de).
- _contract/MOBILE_API_SPEC.md: correct recensioni columns (stelle/descrizione,
  not voto/testo) + document the always-on moderation semantics.

Full build green: 67 unit tests, assembleDebug + assembleRelease (R8).
Redesign the book detail card for readability and completeness:
- Title → headlineSmall bold; author → titleMedium SemiBold onSurface
  (was small onSurfaceVariant); subtitle darkened to onSurface.
- Section headings ('About', 'Details', 'Reviews', audiobook/ebook) unified
  to a SemiBold titleMedium onSurface via a shared SectionTitle.
- Description text bumped to bodyLarge onSurface with 26sp line height
  (was bodyMedium onSurfaceVariant) — larger and darker.
- Metadata grouped into one rounded surfaceContainerLow card so it reads as
  a single spec sheet; MetadataRow values → bodyLarge Medium onSurface
  (larger, high-contrast) with roomier vertical rhythm.
- Blank guards on string metadata (publisher/language/isbn/…): the API can
  send an empty string, so don't render a labelled row with no value.

Verified on the emulator against a live instance: rich book (Il nome della
rosa) shows the full spec card + About + the reviews section with a working
'Write a review' affordance for a borrower. 67 unit tests, assembleDebug +
assembleRelease green.
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@fabiodalez-dev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 92060a69-a63a-4d37-b094-c33c5cac7733

📥 Commits

Reviewing files that changed from the base of the PR and between 754d25e and f755d40.

📒 Files selected for processing (23)
  • _contract/MOBILE_API_SPEC.md
  • _contract/endpoint-manifest.spec.js
  • _contract/openapi.json
  • app/src/main/java/com/pinakes/app/data/model/Models.kt
  • app/src/main/java/com/pinakes/app/data/network/PinakesApi.kt
  • app/src/main/java/com/pinakes/app/data/repository/ReviewsRepository.kt
  • app/src/main/java/com/pinakes/app/data/store/FeatureStore.kt
  • app/src/main/java/com/pinakes/app/di/AppModule.kt
  • app/src/main/java/com/pinakes/app/ui/components/Rating.kt
  • app/src/main/java/com/pinakes/app/ui/components/Support.kt
  • app/src/main/java/com/pinakes/app/ui/navigation/MainScaffold.kt
  • app/src/main/java/com/pinakes/app/ui/navigation/PinakesNavHost.kt
  • app/src/main/java/com/pinakes/app/ui/navigation/Routes.kt
  • app/src/main/java/com/pinakes/app/ui/screens/detail/BookDetailScreen.kt
  • app/src/main/java/com/pinakes/app/ui/screens/detail/BookReviewsSection.kt
  • app/src/main/java/com/pinakes/app/ui/screens/detail/BookReviewsViewModel.kt
  • app/src/main/java/com/pinakes/app/ui/screens/profile/ProfileScreen.kt
  • app/src/main/java/com/pinakes/app/ui/screens/reviews/MyReviewsScreen.kt
  • app/src/main/java/com/pinakes/app/ui/screens/reviews/MyReviewsViewModel.kt
  • i18n/de.json
  • i18n/en.json
  • i18n/fr.json
  • i18n/it.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rework/book-reviews

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

Comment @coderabbitai help to get the list of available commands.

@fabiodalez-dev fabiodalez-dev merged commit 79a0aa3 into main Jul 2, 2026
1 of 2 checks passed
@fabiodalez-dev fabiodalez-dev deleted the rework/book-reviews branch July 2, 2026 15:43
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