####Background
The Apps team plans to explore if a personalized Wikipedia in Review feature that displays insights about a user's reading history, editing history, and donation history is engaging for App users, and inspires them to make a donation to the Wikimedia Foundation.
####Requirements
- Show total edits for 2024 up to 500, for their primary language wiki in the App
- Display 500+ if they have more than 500 edits
- Reverted edits do not need to be removed
- Only display edits from the article namespace
- Only display if user has 1 or more edits
- Only show to logged-in users
- If user has no edits, or is not logged in, show collective slide
Nice to have
- Show primary language code in dynamic illustration
- Additional sentence that mentions up to 3 article names: //Articles you edited included: "Polar Bear", "Swiss Alps", "Goat"//
####Designs
| {F57613395} | {F57613402}
| [[ https://www.figma.com/design/JRTyGA3rZ0qlQ9eqh0FMhE/iOS---Wikipedia-YiR?node-id=146-3087&t=1jHJZb18ROiHwXMZ-4 | Personalized ]] | [[ https://www.figma.com/design/JRTyGA3rZ0qlQ9eqh0FMhE/iOS---Wikipedia-YiR?node-id=147-11433&t=1jHJZb18ROiHwXMZ-4 | Collective ]]
####Engineering Notes
- (data half, part 1) In the WMFYearInReviewDataController, add a method that fetches the user's contributions from their primary wiki, calculates a total count of edits for the year and returns that count.
- The method should allow passing in username and the primary app project from the app-side.
- The method should construct correct API url parameters using the username. Also pass in a `ucstart` date of November 1st 2024 and a `ucend` date of January 1st 2024. Bonus points if you can pull these dates from the WMFDeveloperSettingsDataController's remote config `dataPopulationStartDateString` and `dataPopulationEndDateString` values. You should also send `ucnamespace` of 0 and `ucprop` values of `ids|title|timestamp|tags|flags` (here we are asking only for edits in the Article namespace, i.e. not talk page edits. Also explicitly asking for edit tags and flags in case we eventually need to filter out certain edits from the count.)
- Example API call - `https://en.wikipedia.org/w/api.php?action=query&format=json&list=usercontribs&formatversion=2&uclimit=10&ucstart=2024-11-01T22%3A20%3A13.000Z&ucend=2024-01-01T22%3A20%3A13.000Z&ucuser=TSevener%20(WMF)&ucnamespace=0&ucprop=ids%7Ctitle%7Ctimestamp%7Ctags%7Cflags`
- You can reference the `WMFGrowthTasksDataController` [[ https://github.com/wikimedia/wikipedia-ios/blob/main/WMFData/Sources/WMFData/Data%20Controllers/Growth%20Tasks/WMFGrowthTasksDataController.swift#L28 | getImageRecommendationsCombined ]] method as an example of how to construct an API url with parameters and fetch it using our mediawiki service class.
- The method should use our media wiki service to fetch the data. Use Codable to parse through the response.
- The method should get a count of all edits returned in the `usercontribs` array.
- The method should also check to see if there are more edits or not. Do this by checking to see if a "uccontinue" key and value is returned at the top of the response. You can see what this object looks like if you change the `uclimit` to 10 in the above API call.
- The method should return the final edit count and a boolean whether there are more edits or not.
- (data part 2, blocked on T376041) Upon app resume, pull persisted slide item object for this slide identifier. If evaluated = no, they are logged in, AND remote config does not have a personalized slide kill switch, call method in previous bullet point. Store returned data in persisted report model from T376041. Then set evaluated = yes for persisted report model. If edit count > 0, set display = yes for persisted report model. Save model.
- (UI half, blocked on previous bullet point) Ensure that when we create the view models before presenting slides (see T376044), fetch the persisted model from previous bullet point. If display = yes, build a slide view model with this data (using the report model's metadata). Ensure slide view model is inserted into the correct order, and that associated collective "fallback" slide is NOT inserted.
### Test Steps
1. Put app in one of the accepted locations (Italy, Mexico) and an accepted language (Italian,The latest Wikipedia (white icon) TestFlight build should have this slide in place.
1. SpanishPut device settings region into an accepted location (Italy, or English)Mexico).
2. Get an account with edits (or hardcode it for testing) (test more than 500 for 500+In onboarding, choose a primary app language of Spanish, 0 for no personalized slideEnglish, or any amount in between to see regular personalized slide) or Italian.
3. Log into an account that has edits on primary app language
4. Go to app Settings and enable feature flag in Developer Settings menu
5. Background/foreground the app to trigger YiR report creation
6. Entry point should appear in Profile menu.
7. Go through slideshow as normal, comparing the third slide to desired outcome