feat: book reviews (Hilt rework) + richer book detail screen#15
Conversation
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.
|
Warning Review limit reached
Next review available in: 33 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (23)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
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)
ReviewsRepositoryprovided fromAppModule.BookReviewsViewModel/MyReviewsViewModel→@HiltViewModel; the book id now flows throughSavedStateHandle(ARG_BOOK_ID), same asBookDetailViewModel. Hand-writtenViewModelProvider.Factorys deleted; call sites usehiltViewModel().Review findings
404/not_found), the whole section collapses instead of showing an error banner on a book the user can't act on.LazyColumnkey).StarRatingexposes a single "N.N out of 5"contentDescriptioninstead of five undescribed star icons._contract/MOBILE_API_SPEC.md— correctedrecensionicolumns (stelle/descrizione, notvoto/testo) + documented the always-on moderation semantics.Book detail redesign (nicer, more complete, larger/darker text)
headlineSmallbold; author →titleMediumSemiBoldonSurface; subtitle darkened.titleMediumvia a sharedSectionTitle.bodyLargeonSurface, 26sp line height (larger + darker).surfaceContainerLowcard (a single spec sheet);MetadataRowvalues →bodyLargeMediumonSurface. 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,mineany-state, delete200→404) confirmed against the server. 67 unit tests,assembleDebug+assembleRelease(R8) green.