android-oss icon indicating copy to clipboard operation
android-oss copied to clipboard

MBL-2455: Select your reward autoscrolling to Secret Reward card

Open jlplks opened this issue 5 months ago • 1 comments
trafficstars

📲 What

Added automatic scroll behavior to the RewardCarouselScreen that scrolls to the first available secret reward when the rewards list is initially displayed.

🤔 Why

As part of the Secret Rewards feature, this auto-scroll behavior was a nice-to-have enhancement to improve the user experience. It helps bring immediate focus to the secret reward by scrolling to it automatically when the screen loads, ensuring that users are visually directed toward this exclusive content from the beginning—without needing to manually explore the carousel.

🛠 How

  • Added a LaunchedEffect block scoped to the rewards list.
  • On initial composition, the screen checks for the first secret and available reward.
  • If found, the carousel automatically scrolls to bring it into view using LazyListState.animateScrollToItem().
  • Added a mutableStateOf flag to ensure this effect only runs once per screen lifecycle to avoid unnecessary scrolling or side effects.
  • Added a slight delay (600ms) before scrolling to allow the UI to settle and prevent race conditions in rendering.

👀 See

auto_scroll_secret_reward.webm

📋 QA

  1. Use the following secret reward deep link to open a project with secret rewards: https://staging.kickstarter.com/projects/1768690592/panda-accessories-late-p?secret_reward_token=7b592878 2. The app should open the project page and when clicking on back this project RewardCarouselScreen is displayed. 3. On initial load, the carousel should automatically scroll to the first available secret reward. 4. Verify: • The scroll only happens once (no repeated scrolling on recomposition). • If no secret rewards are available, the carousel does not scroll. • Reward selection still works as expected. • Regular rewards are unaffected.

Story 📖

MBL-2455

jlplks avatar Jun 12 '25 18:06 jlplks

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 66.75%. Comparing base (fe01391) to head (d7a2f08).

Files with missing lines Patch % Lines
...vities/compose/projectpage/RewardCarouselScreen.kt 80.00% 2 Missing and 2 partials :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2346      +/-   ##
============================================
+ Coverage     66.34%   66.75%   +0.40%     
- Complexity     2296     2297       +1     
============================================
  Files           371      371              
  Lines         26335    26353      +18     
  Branches       3968     3971       +3     
============================================
+ Hits          17473    17591     +118     
+ Misses         6825     6703     -122     
- Partials       2037     2059      +22     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Jun 12 '25 20:06 codecov-commenter