===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.
| [[ https://www.figma.com/file/cedgOU5CyOR0UVqtjDOvzE/iOS-Notifications?node-id=305%3A9 | Figma link ]]
The text in 'Learn more about notifications' will need to be updated by folks who better understand the technical updates to the new notification system, I simply copied this over from what is currently available in the app.
Notification settings should appear in the same place as they do currently Settings > Notifications
- Error state for push notification subscription failure
- If notification types are supposed to be toggled OFF by default, then upon login we MUST make a call to options API toggle them all off on the server.
- Handle logout state on this screen. if they want notifications, they have to be logged in.
- Handle "unsuccessfully registered" state on this screen. It could be OS deviceToken generation failed, or PI subscription failed.
- Handle "user denied permissions" state on this screen, with an option to go into settings (if not already).
- Upon load, fetch read options API for the user's primary app language and set current settings (https://www.mediawiki.org/wiki/API:Userinfo)
- Upon first toggle, ask user for permissions if user hasn't authorized yet.
- Then upon toggle of any, set updates via API (https://www.mediawiki.org/wiki/API:Options) for user's primary language. If there was a failure in setting it, show an error and reset toggles to what it was before.
- If user's primary language changes, update the users **new** primary language settings with the **old** primary language settings. This will be behind the scenes, if there was an error with this, the read API the next time this screen is loaded will automatically show the server state.
- There's an explore feed card that asks for remote notification permissions, maybe remove this entirely or only if they are logged out.
- 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.
- Heavily test and optimize this screen for accessibility.
To read notification preferences: https://www.mediawiki.org/wiki/API:Userinfo
To update notification preferences: https://www.mediawiki.org/wiki/API:Options
**Notification Type > API associated value for reading and updating**
Talk page message > echo-subscriptions-push-edit-user-talk
Thanks > echo-subscriptions-push-edit-thank
Talk page subscription > echo-subscriptions-push-dt-subscription
Translations > echo-subscriptions-push-cx
Mention > echo-subscriptions-push-mention
Failed mention > echo-subscriptions-push-mention-failure
Successful mention > echo-subscriptions-push-mention-success
Page link > echo-subscriptions-push-article-linked
Connection with Wikidata > echo-subscriptions-push-wikibase-action
Failed login attempts > echo-subscriptions-push-login-fail
Login from an unfamiliar device > echo-subscriptions-push-login-success
Page review > echo-subscriptions-push-page-review
User rights change > echo-subscriptions-push-user-rights
Edit revert > echo-subscriptions-push-reverted
Email from other user > echo-subscriptions-push-emailuser
Edit milestone > echo-subscriptions-push-thank-you-edit