Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAY-3850][PAY-3849] Add listen streak noti on web #11379

Merged
merged 4 commits into from
Feb 16, 2025

Conversation

faridsalau
Copy link
Contributor

@faridsalau faridsalau commented Feb 14, 2025

Description

This PR enhances challenge reward notifications to support listen streak challenges with dynamic messaging and UI updates.

Key Changes:

  • Data Model Updates
    Added listenStreak field to notification types across the stack (SDK, store, API models) to track streak duration

  • Backend Logic

    • Modified handle_user_challenges SQL function to:
      • Fetch listen streak duration from new challenge_listen_streak table
      • Include streak count in notification data for challenge ID 'e'
    • Updated notification extension/mapping logic to pass streak data through APIs
  • Notification Content

    • Added special case handling for 'e' challenge ID in:
      • Web UI notification component with dynamic titles/messages
      • Rewards page configuration (updated fire icon)
  • UI Improvements

    • Created dynamic notification messages that change based on streak duration
    • Added day counter in notification titles for streak challenges
    • Modified message phrasing for ongoing vs initial streak rewards
    • Updated audio amount formatting utilities

Visual Changes:

  • Replaced headphone icon with fire icon for streak challenges
  • Added progressive messaging encouraging streak continuation
  • Example notification text:
    "You've earned 1 $AUDIO for maintaining your listening streak! Keep your streak going to continue earning daily rewards!"

How Has This Been Tested?

npm run web:dev

  • Add a user using audius-cmd
  • Add a track
  • In packages/discovery-provider/src/challenges/listen_streak_endless_challenge.py, change NUM_DAYS_IN_STREAK to 2 for easier testing
    • Also in this file, search for "stage" and add an or env == "dev" case
  • Trigger two reward notifications by earning the listen streak
image image

Copy link

changeset-bot bot commented Feb 14, 2025

⚠️ No Changeset found

Latest commit: f3d2aeb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

const messages = {
amountEarned: (amount: BNAudio) =>
`You've earned ${formatNumberCommas(Number(amount.toString()))} $AUDIO`,
`You've earned ${formatNumber(amount)} $AUDIO`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lols should we add this as an extra util fn?? nah...

case ChallengeName.ListenStreakEndless: {
const amountEarned = Number(formatNumber(amount))
if (amountEarned > 1) {
return `You've earned ${amountEarned} $AUDIO for hitting Day ${listenStreak} of your listening streak! You’ll now earn an additional $AUDIO reward for every day you keep your streak going!`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's pull this out to a messages thing

Copy link
Contributor

@dharit-tan dharit-tan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve pending the messages comment

@faridsalau faridsalau merged commit 7d310ef into main Feb 16, 2025
12 checks passed
@faridsalau faridsalau deleted the farid/listen-streak-notis branch February 16, 2025 08:00
audius-infra pushed a commit that referenced this pull request Feb 17, 2025
[7d310ef] [PAY-3850][PAY-3849] Add listen streak noti on web (#11379) Farid Salau
[03d7f9e] [PAY-3946] Fix multiple plays in same batch breaking listen streak (#11380) Reed
[4066498] [C-5782, C-5783] Add user comments endpoint and tan query hook (#11366) Kyle Shanks
[0342ae5] fix integration test (#11378) alecsavvy
audius-infra pushed a commit that referenced this pull request Feb 22, 2025
[f7023af] [QA-1995] Fix manager mode dropdown rendering off screen (#11442) Randy Schott
[b250f91] Re-enable redux cache sync to tan-query (#11441) Andrew Mendelsohn
[0868942] Remove hcaptcha from mobile (#11438) Reed
[02fc876] [C-5796] Add empty state for comment history (#11436) KJ
[ae6a324] [C-5786] Update user comments endpoint and add user CommentHistoryPage (#11427) KJ
[1e7469f] [PAY-3953] Use db value for public key (#11391) Farid Salau
[13f9ca0] [PAY-3858] Re-do challenge progress status label logic (#11429) Reed
[f96aeec] Don't add computeLimit instruction to buyAudio flow swap (#11430) Marcus Pasell
[5c595da] Custom component for web oneshot challenge (#11428) Reed
[71768b4] [C-5674] Migrate notifications to tan-query (#11425) Dylan Jeffers
[d881678] [C-5204] Fix android comment input clipping (#11386) Dylan Jeffers
[99f5cd1] Fix batcher context resolver (#11426) Dylan Jeffers
[67d4e5e] Refactor web challenge-rewards-modal (#11424) Dylan Jeffers
[509c54e] Upgrade elliptic package to 6.6.1 (#11388) Dylan Jeffers
[15a6c07] Misc fixes for mobile audio, usdc screens (#11422) Reed
[17eef87] [C-5779] Update mobile profile layout (#11421) Randy Schott
[bbf1bcf] Deprecate wallet.ts and formatUtils.ts functions in favor of FixedDecimal (#11423) Marcus Pasell
[1896f71] [QA-1993] Fix suggested-artists UI overflow (#11420) Dylan Jeffers
[2a9c257] Mobile reward notif navs to RewardsScreen, open drawer (#11419) Reed
[9e75c9f] Fix reward panel ordering (#11418) Reed
[be0c636] Remove one shot and listen streak feature flags (#11416) Reed
[52201bf] Fix crash from `useGetTrackCommentNotificationSetting` returning undefined (#11395) Farid Salau
[451a173] Fix android line height (#11413) Dylan Jeffers
[eba6779] Minor profile page style fixes (#11412) Randy Schott
[44b88d3] Update collectibles hook to return null instead of empty objects (#11410) Randy Schott
[2b2124e] [QA-1979] Fix now playing UI in collection pages (#11408) Dylan Jeffers
[fc3b294] Fix edit playlist nav link when unfetched (#11403) Andrew Mendelsohn
[024323e] Fix create playlists for users with capcase handle (#11406) Dylan Jeffers
[7ebd72b] Fix text clipping for rewards text (#11400) Dylan Jeffers
[01e82df] [PAY-3949] Add fire emoji to notification  (#11402) Farid Salau
[5427e77] Fix drag n drop playlist reordering (#11401) Andrew Mendelsohn
[19bb6ab] Add mobile notification for endless streak (#11398) Farid Salau
[9ba62e3] [PAY-3848] Add ListenStreakReminder notification (#11389) Dylan Jeffers
[f653e01] [C-5784] Use normalized batch entities in lineup queries (#11376) Andrew Mendelsohn
[0f8fe4a] Fix top tracks (#11393) Farid Salau
[e68da94] Fix "Complete Upload" crash (#11392) Farid Salau
[7d310ef] [PAY-3850][PAY-3849] Add listen streak noti on web (#11379) Farid Salau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants