Reward song
A locked song given for good after a finished song, up to a number a day. A/B test: v0 (baseline) gives none, v1 and v2 differ only in the number. Code: src/features/song-reward.
Flow
- A full Game Mode song ends and its result settles (
onRevealComplete). Tutorial songs, Learn Mode and single-part runs do not count; a replay does. PlayResultScreencallsuseSongRewardFlowStore.present(). It counts the song, picks the next one, unlocks it (unlockSongEntitlement, sourcepromo, both modes) and only then shows the progress.- The bar fills. When it is full the popup opens: Play now goes the way "Next song" does (ads rules included), Later closes it.
- On that result only, the song leads the suggestions (
resultSongId→rewardSongIdinpick-session-recommendations.ts). Leaving the result clears it. - After "Later", or when there was nothing to give, the result's own paywalls and No Ads popup run as before. After "Play now" they stay due.
Nothing is shown when the day's songs are spent, the list has nothing left, or the group gives none. A failed unlock spends no turn.
Remote Config
A song the player can already play, or that the app does not list, is passed over. Development builds: EXPO_PUBLIC_RC_REWARD_SONG, EXPO_PUBLIC_RC_REWARD_SONG_POOL in .env.local.
The day
logic/reward-window.ts. The count starts over at reset_at on the player's own clock. That moment is kept as an absolute time, so changing the time zone does not end a day early, and two resets are never less than 23 hours apart, so hopping zones cannot chain short days. The device clock is trusted: setting it forward opens a day early.
Testing the reset (development builds)
EXPO_PUBLIC_REWARD_SONG_RESET_MINUTES in .env.local, then restart Metro. A release build ignores it.
The clock (SongRewardDebugClock) sits at the top of every screen: the count, the time to the reset, the next song, and each id of the pool that is passed over and why.
Edge cases
Analytics
reward_song_show and reward_song_click (action: play_now / later), both with variant, song_id, song_name, reward_index (which song of the day). User property reward_song_variant. A song opened from the popup is a recommended_result play at song_order 1.
UI
SongRewardHost (root layout) draws SongRewardProgress and SongRewardPopup. Both are placeholders: they take display-ready values, so the design replaces only their drawing. The time the bar stays up is SONG_REWARD_PROGRESS_MS in flow-store.ts.
Source: docs/features/song-reward.md