Skip to content

fix(ui): Fix Rating Bar Interaction and Data Persistence

AGHARAHIMOV AGHASALIM requested to merge fix/ui-rating-interaction into main

What does this MR do?

This MR resolves two critical issues with the Rating feature in the Movie Details screen:

  1. Interaction: The RatingBar was previously read-only. It is now interactive, allowing users to tap and slide to set a score (0.5 - 5.0).
  2. Persistence: Previously, the rating would reset to 0 visually when reopening the screen, even if it was saved in the database.

Technical Changes:

  • Modified DetailsUiState to include a nullable userRating field.
  • Updated DetailsViewModel to query the local database for the user's rating during loadMovie and checkDatabaseStatus.
  • Refactored ActionBottomSheet to observe the uiState.userRating flow instead of relying on static arguments, ensuring the UI always reflects the database state.

How to Test:

  1. Open a movie details screen.
  2. Click the "..." action button.
  3. Rate the movie (e.g., 4 stars). Verify the "Rated" toast appears.
  4. Close the bottom sheet or navigate back.
  5. Open the same movie again.
  6. Verify: The RatingBar should properly display the 4 stars you set previously.

Merge request reports