Update our current Settings > Notifications subpage.
- Add primary toggle to enable and disable push notifications
Add per notification type toggles
- Add educational cell
- Add edge case handling (permissions denied, subscription failed,
API read/write calls for types toggles failed.
Why are we doing this?
As we begin to support contribution notifications through the iOS app, we need a place for contributors to opt into and out of specific notification types.
Feature job story
As an existing editor I need a way to opt into and out of notifications on my iOS device.
Designs
Figma: https://www.figma.com/file/cedgOU5CyOR0UVqtjDOvzE/iOS-Notifications?node-id=962%3A1899
| Logged out | Logged in - Settings | Logged in - Settings > Push Notifications (off) |
|---|---|---|
Information architecture
- No settings related to notifications are shown when a user is logged out
- On log in there
are two notifications related settingsis one notifications-related setting:
1. Type subscription (shared with web) is available under Settings > Account > Notification subscriptions
- Push notifications subscriptions are available under Settings > Push notifications
Error states
For error states please see https://phabricator.wikimedia.org/T288773
Dependencies
https://phabricator.wikimedia.org/T287305
Related
https://phabricator.wikimedia.org/T288773
Development Notes
Note: To keep track of device token subscription success/failure, I think we will need to keep a subscription boolean flag in UserDefaults.
- 1. Show single primary toggle OFF if OS permissions have not been attempted and the subscription flag is false.
Hide individual types toggles in this state. - 2. When toggled on, prompt for permissions and subscribe device token (subscription call work is already done in https://phabricator.wikimedia.org/T287305). Persist subscription success in UserDefaults flag. Note, we need to be prepared to wait for device token to come in after the user enables permissions. Some devices seem to set one immediately after registration in didFinishLaunching, and others seem to wait for permissions to be enabled first.
[ ] 3. When permissions and subscription succeeds in previous step, pull types preference flags from API (https://www.mediawiki.org/wiki/API:Userinfo). If that succeeds, show types toggles with ON/OFF states according to API. If that fails, show popup error (T288773).
- 4. When permissions from step 2 are denied, display cell that sends user to OS Settings. (https://phabricator.wikimedia.org/T288773).
- 5. When screen is first pushed, check permissions, subscribed flag,
and individual types preferences from the APIand be sure UI reflects accordingly. - 6. When device is foregrounded, recheck permissions and update state accordingly in case they changed their permissions in the background.
[ ] 7. When toggling a type toggle: make write preference flags API call (https://www.mediawiki.org/wiki/API:Options). Because global preferences API stuff didn't pan out, we need to make this call for every app preferred language, plus wikidata and commons. If call to update fails, show error prompt and flip toggle back to previous state (T288773)
[ ] 8. If the user adds new app preferred languages, make write preference flags API call on the new language wikis so they match preferences on old app languages. If this fails...try again later. No strong opinions from Product on when to try again later, consider other exponential back off methods in the app for this (reading lists, etc).
- 9. Upon logout, behind the scenes unsubscribe device token from push.
- 10. Privacy bonus: we could listen for their OS permissions (check on foreground), and proactively subscribe or unsubscribe their device token if permissions change to one of these states. (TBD on if this is a must, it adds many opportunities for bugs).
Other things to do:
[ ] 11. There's an explore feed card that could cause complications. Handle them here or break off into another task. (Might be best to address this during/after T288693)
[ ] 12. Disable current news notification code for now, there is a separate task (https://phabricator.wikimedia.org/T287307) to add back in and test that it still works. Moved this task to https://phabricator.wikimedia.org/T302294
- 13. Heavily test and optimize this screen for accessibility.



