For AI agents: the complete documentation index is available at ../../llms.txt, the full documentation bundle is available at ../../llms-full.txt, and this page is available as Markdown at ../../docs/features/song-reward.md.

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

  1. 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.
  2. PlayResultScreen calls useSongRewardFlowStore.present(). It counts the song, picks the next one, unlocks it (unlockSongEntitlement, source promo, both modes) and only then shows the progress.
  3. The bar fills. When it is full the popup opens: Play now goes the way "Next song" does (ads rules included), Later closes it.
  4. On that result only, the song leads the suggestions (resultSongId → rewardSongId in pick-session-recommendations.ts). Leaving the result clears it.
  5. 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

KeyValueLocked per install
reward_song{"variant":"v1","max_songs":2,"songs_per_reward":1,"reset_at":"24:00"}. Only variant is needed; max_songs defaults to 2 (v1) / 5 (v2)Yes, with ab_lock_version
reward_song_pool{"songs":["rush-e","bella-ciao"]}: catalog ids, given in this orderNo, read live

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.

ValueResetClock
5 (any number above 0)That many minutes after the first song finished in the periodShown
0The real ruleShown
Unset or not a numberThe real ruleHidden

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

CaseWhat happens
A pool song is free or already ownedPassed over, no turn spent
An id the catalog does not have, or spelt in another casePassed over; the list is tried to its end
The song already sits in the suggestionsIt moves to the top; the column keeps its five cards
Counting or unlocking takes over 3 s (SONG_REWARD_PREPARE_CAP_MS)The result goes on to its paywalls. A song unlocked late is kept and counted, with no popup
The player leaves before the progress shows (dropPreparing)Nothing shows. Nothing is spent unless the unlock had begun; then the song is kept and counted
Weak networkThe cover and the MIDI are fetched from the moment the song is unlocked (preload, best effort); the popup draws an empty cover box until the art arrives

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