pocket-casts-ios
pocket-casts-ios copied to clipboard
End of Year: sync Listening History
📘 Project: #376 |
---|
If we identify the user doesn't have the entire 2022 listening history, we sync this with the server adding the missing episodes.
This is a case that might happen for a very active user that switched devices during this year — given we only sync the latest 100 items.
How do we identify if a user needs a sync?
We look at their listening history. If they have an episode from last year, we assume that their 2022 listening history is complete.
A much more bulletproof strategy would be to call the endpoint to check the number of items for the user, and sync if needed, just once. But I'm not sure what would be the impact of such a call on the backend (@Ferdev curious to hear your thoughts about it).
To test
You'll need an account with more than 100 items. Please ping me and I can provide one.
- Enable the
endOfYear
flag inFeatureFlag.swift
- Do a clean run of the app in Staging mode (Schemes > pocketcasts > change "Build Configuration" to Staging)
- Login with an account with more than 100 items
- Check your listening history, you should see just ~40 items
- Put a breakpoint on
EndOfYearStoriesBuilder.swift
line39
- Check your EoY stories
- ✅ The hitpoint should be hit, proceed with execution
- ✅ You should see the spinner for a few seconds
- ✅ The stories should appear
- Dismiss the stories
- Check your Listening History
- ✅ You should have more than 100 items there now (the oldest episode is an archived episode called "39. Mother"
- Check your stories again
- ✅ The endpoint should not be hit (2022 sync happens just once)
Checklist
- [x] I have considered if this change warrants user-facing release notes and have added them to
CHANGELOG.md
if necessary. - [x] I have considered adding unit tests for my changes.
- [x] I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.